| ---------------------- |
| - BUILD INSTRUCTIONS - |
| ---------------------- |
| |
| Step 1: Build gcc |
| ----------------- |
| |
| Check out the gcc lto branch from the gcc subversion repository: |
| svn checkout svn://gcc.gnu.org/svn/gcc/branches/lto SomeLocalDir |
| It should be possible to check out gcc mainline instead: |
| svn checkout svn://gcc.gnu.org/svn/gcc/trunk SomeLocalDir |
| However I only test with mainline from time to time (plugin development |
| is currently against the lto branch), so it's safer to use the lto branch. |
| Apply the patches in the gcc-patches subdirectory, if any. Hopefully one day |
| the plugin will work with an unpatched gcc, but for the moment a few small |
| patches need to be applied. Configure gcc with your favorite options. |
| Build gcc, and install it somewhere. |
| |
| Step 2: Build the plugin |
| ------------------------ |
| |
| In the Makefile, set the GCCSOURCE_DIR variable to point to the place you |
| checked out the gcc repository, rather than to where I checked it out. |
| Set the GCCOBJECT_DIR to point to the place you built the repository. |
| Admire the awfulness of the build system, and make a mental note to rewrite |
| it properly. |
| |
| Build the plugin using "make". The end result of the build is a shared |
| library, llvm.so. |
| |
| ---------------------- |
| - USAGE INSTRUCTIONS - |
| ---------------------- |
| |
| Run gcc as usual, but pass -fplugin=./llvm.so as an extra command line argument. |
| Make sure you use the gcc you installed above, not the system gcc! |
| |
| Currently the plugin isn't capable of compiling much - you have been warned. |
| |
| The plugin accepts a few command line arguments, for example |
| -fplugin-arg-llvm-enable-gcc-optzns |
| Search for the comment "Process any plugin arguments" in llvm-backend.cpp, |
| the argument parsing code is just after this. |