Skip to content

README for the GNU CIL collection (refs/vendors/st/heads/README)

Notifications You must be signed in to change notification settings

BrickBot/gnu-cil-README

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 

Repository files navigation

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:https://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:https://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:https://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:https://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:https://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 ...

About

README for the GNU CIL collection (refs/vendors/st/heads/README)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published