aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBasile Starynkevitch <basile@starynkevitch.net>2009-06-17 13:36:47 +0000
committerBasile Starynkevitch <bstarynk@gcc.gnu.org>2009-06-17 13:36:47 +0000
commit07ae5620f974a7a0d74fab9ab83260302574078b (patch)
tree6c340721081cf9d3139737f992836804eebbe867 /gcc
parent5eb4df45ce442bdb807cc674e45dbc31fdf3d4ba (diff)
downloadgcc-07ae5620f974a7a0d74fab9ab83260302574078b.zip
gcc-07ae5620f974a7a0d74fab9ab83260302574078b.tar.gz
gcc-07ae5620f974a7a0d74fab9ab83260302574078b.tar.bz2
plugins.texi (Building GCC plugins): Added new section.
2009-06-17 Basile Starynkevitch <basile@starynkevitch.net> * gcc/doc/plugins.texi (Building GCC plugins): Added new section. From-SVN: r148612
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/doc/plugins.texi34
2 files changed, 38 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2291ec2..7c20d41 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-17 Basile Starynkevitch <basile@starynkevitch.net>
+
+ * doc/plugins.texi (Building GCC plugins): Added new section.
+
2009-06-17 Ian Lance Taylor <iant@google.com>
* c-pch.c (get_ident): Don't set size of templ array.
diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi
index f02f931..9ae0a18 100644
--- a/gcc/doc/plugins.texi
+++ b/gcc/doc/plugins.texi
@@ -262,3 +262,37 @@ register_attributes (void *event_data, void *data)
@}
@end smallexample
+
+
+@section Building GCC plugins
+
+If plugins are enabled, GCC installs the headers needed to build a
+plugin (somehwere in the installation tree, e.g. under
+@file{/usr/local}). In particular a @file{plugin/include} directory
+is installed, containing all the header files needed to build plugins.
+
+On most systems, you can query this @code{plugin} directory by
+invoking @command{gcc -print-file-name=plugin} (replace if needed
+@command{gcc} with the appropriate program path).
+
+The following GNU Makefile excerpt shows how to build a simple plugin:
+
+@smallexample
+GCC=gcc
+PLUGIN_SOURCE_FILES= plugin1.c plugin2.c
+PLUGIN_OBJECT_FILES= $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
+GCCPLUGINS_DIR:= $(shell $(GCC) -print-file-name=plugin)
+CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -O2
+
+plugin.so: $(PLUGIN_OBJECT_FILES)
+ $(GCC) -shared $^ -o $@
+@end smallexample
+
+A single source file plugin may be built with @code{gcc -I`gcc
+-print-file-name=plugin`/include -fPIC -shared -O2 plugin.c -o
+plugin.so}, using backquote shell syntax to query the @file{plugin}
+directory.
+
+Plugins needing to use @command{gengtype} require a GCC build
+directory for the same version of GCC that they will be linked
+against.