A guide to applying the patch, building, and testing gdfa
The current gdfa patch is released for gcc-4.5.0 and gcc-4.3.0. You can download the patch and
substitute gcc-4.x.x in the instructions given below with your gcc tarball version.
Step I : Downloading the gcc source code tarball and patch files
- Make a new folder 'gdfa', and cd to it
~/$. mkdir gdfa
~/$. cd gdfa
- Download gcc-4.x.x tarball in this folder.
- Download the required version of patch file in this folder.
- Untar the gcc-4.x.x tarball
~/gdfa$. tar -xvf gcc-4.x.x-tar.gz
After untarring, you will see a folder 'gcc-4.x.x'
- Make the 'build' and 'install' directories.
~/gdfa$. mkdir build
~/gdfa$. mkdir install
Step II : Applying the patch
- Apply the appropriate version of patch. For example, if you wish to apply the version 1.4 patch,
and you have downloaded the same in step I, issue the following command on the terminal:
~/gdfa$. patch -p0 < gdfa-v1.4-gcc-4.5.0.patch
Step III : Building GCC 4.3.0
- Let us assume that $INSTALL is the absolute path of install directory, and
$SRC is the absolute path of gcc-4.x.x directory.
- cd to the build directory.
~/gdfa$. cd build
- Configure gcc-4.x.x. For example, if we wish to build a C compiler, type the following to configure gcc.
~/gdfa/build$. $SRC/configure --enable-languages=c --prefix=$INSTALL
If you are building gcc-4.5.0, disable LTO support by including the option --disable-lto
- After configuring successfully, build gcc-4.x.x.
- If a successful make, install the gcc binaries in the install directory.
~/gdfa/build$. make install
Step IV : Testing gdfa
- Create any sample program, say 'test.c'.
- Perform gdfa analysis using the recently built gcc-4.x.x.
~/$. $INSTALL/bin/gcc -fdump-tree-all -fgdfa -fgdfa-details test.c
- Inspect the generated dumps to analyze the information gathered by gdfa passes.