Welcome to the SAFECode compiler! This manual provides instructions for
downloading and compiling SAFECode. It also provides information on software
that you must have in order to install SAFECode.
SAFECode depends upon several other pieces of software. SAFECode is built
using the LLVM Compiler Infrastructure, so you
must have LLVM. SAFECode also uses libraries from the
Automatic Pool Allocation project. Directions on how to download these will be
provided with the directions on downloading SAFECode.
SAFECode comes only as source code; you will need the proper tools (namely GCC
and GNU make) to compile it. The necessary requirements are those needed by
LLVM and are listed
here.
SAFECode is currently supported on Linux and Mac OS X running on x86
processors (only 32-bit code is known to work).
SAFECode is stored in a CVS repository. You will need to use CVS over ssh to
check out the source code. Before you begin, set the CVS_RSH environment
variable to "ssh" so that CVS uses SSH to log into llvm.org.
You will need to get the LLVM source code from the Subversion repository. You
will then need to put Automatic Pool Allocation and SAFECode into the projects
subdirectory of the LLVM source distribution. The following commands should do
the trick:
- cd where-you-want-llvm-to-live
- svn co http://llvm.org/svn/llvm-project/llvm/branches/release_16 llvm
- cd llvm/projects
-
svn co http://llvm.org/svn/llvm-project/poolalloc/trunk poolalloc
- export CVS_RSH=ssh
-
cvs -d :ext:username@llvm.org:/home/vadve/shared/InternalCVS co safecode
You may optionally want to get the LLVM Test Suite (test-suite) source code:
- cd llvm/projects
-
svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
If you use the LLVM Test Suite, you will also need the LLVM GCC front-end, and
you will need to configure LLVM so that it knows where to find llvm-gcc and
llvm-g++. Directions for downloading and installing the front-end can be found
in the
LLVM Getting Started Guide
.
Once you have the source code checked out, you should be able to configure LLVM
and the poolalloc project using just the top level LLVM configure script. You
can then configure SAFECode separately (currently, the LLVM configure script
does not configure SAFECode automatically). You may need to add the following
options to the command line when running configure in order to
configure Automatic Pool Allocation and SAFECode correctly:
-
--with-llvmsrc=directory:
Specifies the location of the LLVM source directory. This option is used by
the Automatic Pool Allocation and SAFECode build systems to find the LLVM
source tree; it is ignored by the LLVM configure script but passed to the
Automatic Pool Allocation configure script. This option is not needed if
building in the source tree (i.e., SRCDIR == OBJDIR) and the project
(poolalloc or safecode) is in the LLVM projects subdirectory.
-
--with-llvmobj=directory:
Specifies the location of the LLVM object directory. This option is used by
the Automatic Pool Allocation and SAFECode build systems to find the LLVM
object tree; it is ignored by the LLVM configure script but passed to the
Automatic Pool Allocation configure script. This option is not needed if
building in the source tree (i.e., SRCDIR == OBJDIR) and the project
(poolalloc or safecode) is in the LLVM projects subdirectory.
Additional options for the SAFECode configure script include:
- --with-poolalloc-srcdir:
Specifies the location of the source code for Automatic Pool Allocation.
- --with-poolalloc-objdir:
Specifies the location of the object code for Automatic Pool Allocation.
The overall process will look like the following if you are building Automatic
Pool Allocation and SAFECode in the the projects subdirectory of the LLVM
object tree:
- cd LLVM-object-directory
- LLVM-source-directory/configure [options]
- cd projects/safecode
- SAFECode-source-directory/configure [options]
To build SAFECode, first compile the LLVM tools, then Automatic Pool
Allocation, and then SAFECode itself:
- cd LLVM-object-directory
- make tools-only
- cd projects/poolalloc
- make
- cd ../safecode
- make
SAFECode will, by default, perform the same type of build that LLVM does. For
example, if LLVM is configured to do a Release build by default, SAFECode will
do a Release build by default as well.
There are three types of builds:
-
Debug:
The SAFECode libraries and tools are placed in Debug/lib and
Debug/bin in the SAFECode object tree. The libraries and programs
are compiled with debug symbols enabled. The tools may operate more slowly
due to the extra debug information.
-
Release:
The SAFECode libraries and tools are placed in Release/lib and
Release/bin in the SAFECode object tree. The libraries and programs
are compiled at a higher optimization level and debug symbols are stripped
from executables, making the SAFECode tools faster.
-
Profile:
The SAFECode libraries and tools are placed in Profile/lib and
Profile/bin in the SAFECode object tree. The libraries and programs
are compiled to generate profiling information which can be used to find
performance bottlenecks.
If you only want to use SAFECode, use a Release build. If you are doing
development work on SAFECode, use the Debug or Profile builds as appropriate.