Plugins are supported on platforms that support -ldl
-rdynamic. They are loaded by the compiler using dlopen
and invoked at pre-determined locations in the compilation
process.
Plugins are loaded with
-fplugin=/path/to/name.so -fplugin-arg-name-key1[=value1]
The plugin arguments are parsed by GCC and passed to respective plugins as key-value pairs. Multiple plugins can be invoked by specifying multiple -fplugin arguments.
A plugin can be simply given by its short name (no dots or slashes). When simply passing -fplugin=name, the plugin is loaded from the plugin directory, so -fplugin=name is the same as -fplugin=`gcc -print-file-name=plugin`/name.so, using backquote shell syntax to query the plugin directory.