A guide for building, and testing L-FCPA1

This latest L-FCPA patch is released for gcc-4.7.2.

NOTE: To build gcc-4.7.2 refer to the following instructions

Step I : Downloading the gcc source code tarball

  • Make a new folder 'lfcpa', and cd to it
         ~/$. mkdir lfcpa
         ~/$. cd lfcpa
  • Download gcc-4.7.2 tarball in this folder.
  • Download the required version of patch file in this folder.
  • Untar the gcc-4.7.2 tarball
         ~/lfcpa$. tar -xvf gcc-4.7.2-tar.gz
    After untarring, you will see a folder 'gcc-4.7.2'
  • Make the 'build' and 'install' directories.
         ~/lfcpa$. mkdir build
         ~/lfcpa$. mkdir install

Step II : Building GCC 4.7.2

  • Let us assume that $INSTALL is the absolute path of install directory, and $SRC is the absolute path of gcc-4.7.2 directory.
  • cd to the build directory.
         ~/lfcpa$. cd build
  • Configure gcc-4.7.2. For example, if we wish to build a C compiler, type the following to configure gcc.
         ~/lfcpa/build$. $SRC/configure --enable-languages=c --prefix=$INSTALL
    If you are on a 64 bit system, disable multilib during configure by the option --disable-multilib
  • After configuring successfully, build gcc-4.7.2.
         ~/lfcpa/build$. make
  • If a successful make, install the gcc binaries in the install directory.
         ~/lfcpa/build$. make install

Now use the pristine gcc-4.7.2 build for the l-fcpa plugin by following the steps below:

Step I : Building the plugin

  • Untar the tarball
         ~/$.tar -xvf lfcpa-gcc-4.7-V1.1-multiple.tar.gz
    After untarring, you will see a folder "lfcpa-gcc-4.7-V1.1-multiple".
  • Change directory to this folder
         ~/$.cd lfcpa-plugin-gcc-4.7-V1.1-multiple
  • Make changes in the Makefile
         ~/lfcpa-plugin-gcc-4.7-V1.1-multiple$. vi Makefile
    Modify the value of BASE_DIR with the path to the base directory of your pristine gcc-4.7.2 build
  • Hook the plugin dynamically in gcc
         ~/lfcpa-plugin-gcc-4.7-V1.1-multiple$. make
    You will see a file named after the successful make.

NOTE: When we have multiple files, LTO dumps GIMPLE IR in .o files created with -c option (which disable linking and creation of the final executable). When this is being done, we do not have the complete program. Hence we do not give the option of executing our plugin for this part of compilation. Eventually, when the .o files are linked, the entire program becomes available. Thus the plugin is invoked at this stage (and we do not give -c option).

Step II : Testing L-FCPA

  • Create any sample program inside the directory lfcpa-gcc-4.7-V1.1-multiple. Multiple dependent files may also be created.(As a trial dependent files test1.c and test2.c are already given)
  • Modify the Makefile to reflect the input file names by changing the value of OBJS with your input file name with .o extension
  • Run the command
         ~/lfcpa-plugin-gcc-4.7-V1.1-multiple$. make test
  • Inspect the generated lfcpa dump result.233i.lfcpa to analyze the information gathered by the pass.
  • Use the following to delete all dump files
         ~/lfcpa-plugin-gcc-4.7-V1.1-multiple$. make clean

1. Also referred to as lipta in the previous version of paper

Tested on Firefox version 3.0.8 and above     |    Site designed and maintained by GRC    |    © 2013, GCC Resource Center