comparison gcc/doc/plugins.texi @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
14 and invoked at pre-determined locations in the compilation 14 and invoked at pre-determined locations in the compilation
15 process. 15 process.
16 16
17 Plugins are loaded with 17 Plugins are loaded with
18 18
19 @option{-fplugin=/path/to/NAME.so} @option{-fplugin-arg-NAME-<key1>[=<value1>]} 19 @option{-fplugin=/path/to/@var{name}.so} @option{-fplugin-arg-@var{name}-@var{key1}[=@var{value1}]}
20 20
21 The plugin arguments are parsed by GCC and passed to respective 21 The plugin arguments are parsed by GCC and passed to respective
22 plugins as key-value pairs. Multiple plugins can be invoked by 22 plugins as key-value pairs. Multiple plugins can be invoked by
23 specifying multiple @option{-fplugin} arguments. 23 specifying multiple @option{-fplugin} arguments.
24 24
25 A plugin can be simply given by its short name (no dots or 25 A plugin can be simply given by its short name (no dots or
26 slashes). When simply passing @option{-fplugin=NAME}, the plugin is 26 slashes). When simply passing @option{-fplugin=@var{name}}, the plugin is
27 loaded from the @file{plugin} directory, so @option{-fplugin=NAME} is 27 loaded from the @file{plugin} directory, so @option{-fplugin=@var{name}} is
28 the same as @option{-fplugin=`gcc -print-file-name=plugin`/NAME.so}, 28 the same as @option{-fplugin=`gcc -print-file-name=plugin`/@var{name}.so},
29 using backquote shell syntax to query the @file{plugin} directory. 29 using backquote shell syntax to query the @file{plugin} directory.
30 30
31 @section Plugin API 31 @section Plugin API
32 32
33 Plugins are activated by the compiler at specific events as defined in 33 Plugins are activated by the compiler at specific events as defined in
43 to assert that it has been licensed under a GPL-compatible license. 43 to assert that it has been licensed under a GPL-compatible license.
44 If this symbol does not exist, the compiler will emit a fatal error 44 If this symbol does not exist, the compiler will emit a fatal error
45 and exit with the error message: 45 and exit with the error message:
46 46
47 @smallexample 47 @smallexample
48 fatal error: plugin <name> is not licensed under a GPL-compatible license 48 fatal error: plugin @var{name} is not licensed under a GPL-compatible license
49 <name>: undefined symbol: plugin_is_GPL_compatible 49 @var{name}: undefined symbol: plugin_is_GPL_compatible
50 compilation terminated 50 compilation terminated
51 @end smallexample 51 @end smallexample
52 52
53 The type of the symbol is irrelevant. The compiler merely asserts that 53 The declared type of the symbol should be int, to match a forward declaration
54 it exists in the global scope. Something like this is enough: 54 in @file{gcc-plugin.h} that suppresses C++ mangling. It does not need to be in
55 any allocated section, though. The compiler merely asserts that
56 the symbol exists in the global scope. Something like this is enough:
55 57
56 @smallexample 58 @smallexample
57 int plugin_is_GPL_compatible; 59 int plugin_is_GPL_compatible;
58 @end smallexample 60 @end smallexample
59 61