-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
203 lines (154 loc) · 7.01 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
This file contains instructions to install the following:
* The CIL frontend
* The CIL backend, which can be built using either of two ways
- Mono tools (preferred)
- DotGnu tools
------------
Introduction
------------
Information and background regarding the CIL project is available at the following links:
* Contextual Overview – https://www.mono-project.com/archived/gcc4cil/
- Not part of the GNU project, but provides good info
* GNU GCC CLI Back-End and Front-End – https://gcc.gnu.org/projects/cli.html
* 2006 Google Summer of Code
- Project Description – https://www.mono-project.com/archived/summer2006/#gcc-cil-backend
- Project Blog – https://gcc-cil.blogspot.com
-------------------------------------------------------------------------------------------
HOW TO Clone from GNU GCC refs/vendors/* (Using refs/vendors/st/heads/README as an Example)
-------------------------------------------------------------------------------------------
tree view:
https://gcc.gnu.org/git/?p=gcc.git;a=tree;h=refs/vendors/st/heads/README;hb=refs/vendors/st/heads/README
commands:
# List the remote vendor refs
git ls-remote --refs git://gcc.gnu.org/git/gcc.git refs/vendors/st/\*
# Initialize an empty git repository
git init
# Add a remote for the GNU GCC repository: git remote add -t <branch> <remote name> <repository>
git remote add -t refs/vendors/st/heads/README gnu-st git://gcc.gnu.org/git/gcc.git
# The .git/config file is created with an improperly-formed fetch entry that must be manually corrected
# Find the following "remote" section in the file: [remote "gnu-st"]
# Look for the following "fetch" entry: fetch = +refs/heads/refs/vendors/st/heads/README:refs/remotes/gnu-st/refs/vendors/st/heads/README
# Remove the "refs/heads" prefix
# The line should instead read as follows: fetch = +refs/vendors/st/heads/README:refs/remotes/gnu-st/refs/vendors/st/heads/README
# Save the modified .git/config file
# Fetch from the remote: git fetch <remote name>
git fetch gnu-st
# Reset the repository to that commit
git reset --hard FETCH_HEAD
# Add a remote for our working remote: git remote add <remote name> <remote URL>
# -To make this remote the default, name it "origin"
git remote add origin https://github.com/BrickBot/gnu-cil-README.git
# Mirror this repository to the working remote: git push --mirror --force <remote name>
git push --mirror --force origin
-------------------------------------------------------------
HOW TO Build and Install CIL Backend with Mono-based binutils
-------------------------------------------------------------
dependencies:
- Mono C# compiler mcs or mcs1
- ilasm (from Mono or DotGnu) in the path
- a CLI framework for the standard libraries (mscorlib.dll, ...)
build directories
# Sources directory
mkdir <...>/gcc-src
# Build directory
mkdir <...>/gcc-build
mkdir <...>/gcc-build/binutils
mkdir <...>/gcc-build/gcc
# Build directory for host libstd (pending to automatize)
mkdir <...>/gcc-build/gcc/libstd
# Install directory
mkdir <...>/image
* Check out components:
svn co https://clibinutils.svn.sourceforge.net/svnroot/clibinutils/mono-based-binutils/trunk <...>/gcc-src/binutils
svn co svn://gcc.gnu.org/svn/gcc/branches/st/cli-be <...>/gcc-src/gcc
* Set environment variables (examples with bash syntax):
- if mono c# compiler is not in the path or is different than gmcs set MCS
export MCS=gmcs
- to specify wich is the runtime (mscorlib.dll, ...) to link to, define CLISTDDIR
export CLISTDDIR=/usr/lib/mono/2.0:/usr/lib/mono/1.0
* Build and install binutils:
cd <...>/gcc-build/binutils
<...>/gcc-src/binutils/configure --target=cil32 --prefix=<...>/image
make
make install
* Build and install gcc:
cd <...>/gcc-build/gcc
<...>/gcc-src/gcc/configure --target=cil32 --enable-languages=c --disable-bootstrap --prefix=<...>/image --with-local-prefix=<...>/image/cil32
make
make install
* Build and install host libstd (pending to automatize)
cd <...>/gcc-build/gcc/libstd
<...>/gcc-src/gcc/libstd/configure --enable-native-lib --with-mcs=gmcs --prefix=<...>/image
make
make install
Now in <...>/image/bin you can find all the tools cil32-gcc, cil32-as, ...
There are also 2 small wrappers to execute code compiled with the
toolchain on Mono and DotGnu. They are called cil32-mono and
cil32-ilrun
Host libstd implementation is in <...>/image/lib/<architecture>, remember to add this
path to your LD_LIBRARY_PATH if you plan to use CIL Frontend.
---------------------------------------------------------------
HOW TO Build and Install CIL Backend with DotGnu-based binutils
---------------------------------------------------------------
dependencies:
- Mono C# compiler (mcs or mcs1)
- DotGnu Binutils (ilasm, ilalink and OpenSystem.C.dll) in the path
- a CLI framework for the standard libraries (mscorlib.dll, ...)
build directories
# Sources directory
mkdir <...>/gcc-src
# Build directory
mkdir <...>/gcc-build
mkdir <...>/gcc-build/binutils
mkdir <...>/gcc-build/gcc
# Install directory
mkdir <...>/image
* Check out components:
svn co https://clibinutils.svn.sourceforge.net/svnroot/clibinutils/dotgnu-based-binutils/trunk <...>/gcc-src/binutils
svn co svn://gcc.gnu.org/svn/gcc/branches/st/cli-be <...>/gcc-src/gcc
* Set environment variables (examples with bash syntax):
- if mono c# compiler is not in the path or is different than gmcs set MCS
export MCS=gmcs
- add DotGnu binary dir to the PATH
export PATH=/home.local/work-gcc/dotgnu/usr/bin/:$PATH
- define OPENSYSTEM_C_DLL as the library used by the DotGnu linker
export OPENSYSTEM_C_DLL=<...>/usr/lib/cscc/lib/OpenSystem.C.dll
* Build and install binutils:
cd <...>/gcc-build/binutils
<...>/gcc-src/binutils/configure --target=cil32 --prefix=<...>/image --with-local-prefix=<...>/image/cil32
make
make install
* Build and install gcc:
cd <...>/gcc-build/gcc
<...>/gcc-src/gcc/configure --target=cil32 --enable-languages=c --disable-bootstrap --prefix=<...>/image --with-local-prefix=<...>/image/cil32
make
make install
Now in <...>/image/bin you can find all the tools cil32-gcc, cil32-as, ...
There are also 2 small wrappers to execute code compiled with the
toolchain on Mono and DotGnu. They are called cil32-mono and
cil32-ilrun
-------------------------------------
HOW TO Build and Install CIL Frontend
-------------------------------------
dependencies:
- libmono with header files from Mono project
build directories
# Sources directory
mkdir <...>/gcc-src
# Build directory
mkdir <...>/gcc-build
mkdir <...>/gcc-build/cilfe_build
# Install directory
mkdir <...>/cilfe_image
check out components:
svn co svn://gcc.gnu.org/svn/gcc/branches/st/cli-fe <...>/gcc-src/gcc
build and install gcc:
cd <...>/gcc-build/cilfe_build
<...>/gcc-src/gcc/configure --enable-languages=cil --disable-bootstrap --prefix=<...>/cilfe_image
make
make install
Now in <...>/image/bin you can find gcil. Unless you use the flag -fno-cil-use-libstd, gcil will try
to link libstd functions with the host libstd.so implementation. Remember to:
- Add the path to libstd.so (<back end base>/image/lib/<architecture) to LD_LIBRARY_PATH
- Link with the libstd library:
$ gcil -lstd ...