A guide to applying the patch, building, and testing lipta
The current lipta patch is released for gcc-4.6.0. The list of pre-requisites for gcc-4.6.0 can be
found here. A detailed compilation
of the steps to install the prerequisites can be found here.
A simpler installation guide after installing the prerequisites is given below.
If you wish to use the
full pointer analysis (ipta), replace lipta by ipta in each step
Step I : Downloading the gcc source code tarball and patch files
- Make a new folder 'lipta', and cd to it
~/$. mkdir lipta
~/$. cd lipta
- Download gcc-4.6.0 tarball
in this folder.
- Download the required version of patch file in this folder.
- Untar the gcc-4.6.0 tarball
~/lipta$. tar -xvf gcc-4.6.0-tar.gz
After untarring, you will see a folder 'gcc-4.6.0'
- Make the 'build' and 'install' directories.
~/lipta$. mkdir build
~/lipta$. mkdir install
Step II : Applying the patch
- Apply the appropriate version of patch. For example, if you wish to apply the
version 1.0 patch, and you have downloaded the same in step I, issue the
following command on the terminal:
~/lipta$. patch -p0 < lipta-v1.0-gcc-4.6.0.patch
Step III : Building GCC 4.6.0
- Let us assume that $INSTALL is the absolute path of install directory, and
$SRC is the absolute path of gcc-4.6.0 directory.
- cd to the build directory.
~/lipta$. cd build
- Configure gcc-4.6.0. For example, if we wish to build a C compiler,
type the following to configure gcc.
~/lipta/build$. $SRC/configure --enable-languages=c
If you are on a 64 bit system, disable multilib during configure by the option --disable-multilib
- After configuring successfully, build gcc-4.6.0.
- If a successful make, install the gcc binaries in the install directory.
~/lipta/build$. make install
Step IV : Testing lipta
- Create any sample program, say 'test.c'.
- Perform lipta analysis using the recently built gcc-4.6.0.
~/$. $INSTALL/bin/gcc -fdump-ipa-lipta -flipta -O2 test.c
- Inspect the generated dumps to analyze the information gathered by lipta pass.
- If you wish to use Link Time Optimization (LTO) to
process multiple input files together, use additional
command line switches -flto -flto-partition=none
- If you wish to get only the time taken for the lipta pass, use additional flag -ftime-lipta with the command in step IV