MilePost > libplugin
Font size:      

Tutorial - Writing a plugin for GCC

Tutorial - Writing a plugin for GCC

This is a very short tutorial. It just covers the small details required when writing plugins for GCC. The only real issue is that you have to have the right headers set up. This tutorial tells you how to get them. We won't actually write a plugin - you should know how to do that from previous tutorials.


The headers for GCC are more complicated that for most programs. The problem is that GCC creates a lot of headers on the fly while building itself.

We suppose that you have built GCC from source. You'll have one directory the following directories:

  • gcc.src with the GCC source.
  • gcc.obj with the GCC object files - this is the temporary stuff GCC creates.
  • gcc.bin with the GCC installation directory.

If you have that then the headers you will most often need will be in the following directories:

  • gcc.obj/gcc
  • gcc.obj/gcc/include
  • gcc.src/gcc
  • gcc.src/include
  • gcc.src/libcpp/include
  • gcc.src/libdecnumber
  • gcc.obj/libdecnumber

Hopefully, that should give you enough to start building GCC plugins.