[plugins] RFA: Merge plugins into mainline [4/5 - configury]

Diego Novillo dnovillo@google.com
Fri Apr 10 23:06:00 GMT 2009


Gerald Pfeifer <gerald@pfeifer.com> wrote:
>
> On Thu, 2 Apr 2009, Diego Novillo wrote:
> > 2009-04-02  Le-Chun Wu  <lcwu@google.com>
> >
> >       * configure.ac: Add --enalbe-plugin support. Set pluginlibs only for
>                            ^^^^^^^^^^^^^^^
>
> Typo here.  (It looks fine in the actual code.)

Fixed.



Ian Lance Taylor <iant@google.com> wrote:

> > -ACX_PKGVERSION([GCC])
> > +ACX_PKGVERSION([plugins merged with rev 145344])
>
> Incorrect change.

Artifact of svn diff.  Files added by svn merge do not diff
right, so I had to diff branch and trunk.  I re-added the new
files and generated a new diff (attached).

> > -    vec.h $(TARGET_H) $(CGRAPH_H)
> > +    vec.h $(TARGET_H) $(CGRAPH_H) plugin.h
>
> It seems to me that plugin.h includes gcc-plugin.h, so you need to
> introduce a PLUGIN_H make variable and use it in the dependencies.

Done.

> The configure script should give an error if somebody uses an explicit
> --enable-plugin on a system which does not support plugins.

Done.

> It's not clear to me that we should be testing for ELF hosts, although
> that may suffice for now.  As far as I can see, all the plugin support
> requires is dlopen and dlsym.  We could have the configure script test
> for those, rather than use a list of hosts.

Fixed.  I changed the test to an explicit check for -rdynamic
-ldl.



Paolo Bonzini <bonzini@gnu.org> wrote:

> Indeed, I think dependencies should not be in the "configury" patch.
> (A note for the future only).

OK.

> Separate checks for -ldl *and* -rdynamic would be preferrable.  In
> case in the future some alternative to -rdynamic is introduced (e.g.
> for Windows, which can use GetModuleHandle+GetProcAddress) it is
> easier if there is less coupling between different tests.

Done.  I do not have a windows machine, so I could not test your
suggestion for an -rdynamic alternative.



Joseph S. Myers <joseph@codesourcery.com> wrote:

> Apart from all the other problems noted with the test needing to be a host
> test and potentially being able to test for features rather than host
> triplets, I don't see anything to address building with plugin support
> disabled, or on hosts without plugin support.

Done.  I added ENABLE_PLUGIN support for plugin.c.  We only
include <dlfcn.h> if that macro is set.  We also conditionally
compile the calls to dlopen and dlsym.  The rest of the plugin
harness is independent, so it will be simply converted to a nop.

This same variable is now used to enable testsuite support in
site.exp.

> It looks like the configure option only affects linking; plugin.o will
> still be built unconditionally and the rest of the compiler will
> unconditionally contain calls to plugin functions.

Yes, and that's fine.  None of the actual dl* functions will be
called.

> You need to ensure that plugin.c does not include dlfcn.h on hosts where
> it is not available, and does not call dlopen etc. where not available or
> when plugin support is disabled.  The functions in plugin.c should still
> be available (so the rest of the compiler can call them unconditionally),

Done.

> but should have conditional code so that an error is given if -fplugin is
> used when plugin support is disabled, and so that all the other functions
> return quietly when no plugins are in use whether or not plugin support is

Done.

> The patches will need testing in at least three configurations: with
> plugins enabled, with them disabled on a host supporting plugins and on a
> host not supporting them (e.g. MinGW or Darwin).  This includes making
> sure the plugin tests are run only when plugins are enabled.

Done.

Bootstrapped and tested on x86_64 with --enable-plugin and with
--disable-plugin.

Bootstrapped and tested on Darwin/i386.  Tested that --enable-plugin gives
an error message.

Attached is the full merge patch from the plugins branch.  I need
approval for the configuration and testsuite changes.


Thanks.


2009-04-10  Diego Novillo  <dnovillo@google.com>

	* configure.ac: Add --enable-plugin support.
	Set pluginlibs only for targets supporting -ldl -rdynamic.
	* configure: Regenerate.

2009-04-10  Le-Chun Wu  <lcwu@google.com>

	* Makefile.tpl: Define and export PLUGINLIBS.
	* Makefile.in: Regenerate.

gcc/ChangeLog

2009-04-10  Le-Chun Wu  <lcwu@google.com>

	* configure.ac: Add PLUGINLIBS variable.
	* configure: Regenerate.
	* Makefile.in: Add PLUGINLIBS to link command. Add/modify dependencies
	for plugin.o and files including plugin.h.

2009-04-10  Diego Novillo  <dnovillo@google.com>

	* configure.ac: Add --enable-plugin support.
	Define ENABLE_PLUGIN when specified.
	* Makefile.in (PLUGIN_H): Define.
	Export ENABLE_PLUGIN and GMPINC to site.exp.
	* config.in: Regenerate.

2009-04-10  Le-Chun Wu  <lcwu@google.com>

	* tree-pass.h (register_one_dump_file): Add a prototype for
	register_one_dump_file.
	* toplev.c (compile_file): Call initialize_plugins.
	(do_compile): Call invoke_plugin_callbacks.
	(toplev_main): Call invoke_plugin_callbacks.
	* common.opt: Add -fplugin= and -fplugin-arg-.
	* gcc-plugin.h: New public header file for plugins to include.
	* plugin.c: New source file.
	* plugin.h: New internal header file.
	* passes.c (register_one_dump_file): Make it external.

2009-04-10  Le-Chun Wu  <lcwu@google.com>
            Diego Novillo  <dnovillo@google.com>

	* opts.c (common_handle_option): Handle OPT_fplugin_ and
	OPT_fplugin_arg_.

2009-04-10  Le-Chun Wu  <lcwu@google.com>

	* c-parser.c (c_parser_declspecs): Call invoke_plugin_callbacks.

2009-04-10  Diego Novillo  <dnovillo@google.com>

	* doc/plugins.texi: New.
	* doc/gccint.texi: Add reference to Plugins chapter.
	* doc/invoke.texi: Document -fplugin and -fplugin-arg
	* diagnostic.c (diagnostic_report_diagnostic): Warn about
	loaded plugins, if any.
	* timevar.def (TV_PLUGIN_INIT): Define.
	(TV_PLUGIN_RUN): Define.
	* plugin.c: Include timevar.h
	(plugins_active_p): New.
	(dump_active_plugins): New.
	(debug_active_plugins): New.

gcc/testsuite/ChangeLog

2009-04-10  Le-Chun Wu  <lcwu@google.com>
            Diego Novillo  <dnovillo@google.com>

	* lib/plugin-support.exp: New file containing support procs for
	plugin testcases.
	* lib/target-supports.exp (check_plugin_available): New proc.
	* gcc.dg/plugin/plugin.exp: New driver script for gcc testcases.
	* gcc.dg/plugin/selfassign.c: New plugin source file.
	* gcc.dg/plugin/self-assign-test-1.c: New test.
	* gcc.dg/plugin/self-assign-test-2.c: Likewise.
	* g++.dg/README: Add description for plugin test.
	* g++.dg/dg.exp: Exclude plugin tests from the general test list.
	* g++.dg/plugin/plugin.exp: New driver script for g++ testcases.
	* g++.dg/plugin/selfassign.c: New plugin source file.
	* g++.dg/plugin/self-assign-test-1.C: New test.
	* g++.dg/plugin/self-assign-test-2.C: Likewise.
	* g++.dg/plugin/self-assign-test-3.C: Likewise.
	* g++.dg/plugin/dumb_plugin.c: New plugin source file.
	* g++.dg/plugin/dumb-plugin-test-1.C: New test.

gcc/cp/ChangeLog

2009-04-10  Le-Chun Wu  <lcwu@google.com>

	* Make-lang.in: Modify dependencies of files including plugin.h.

2009-04-10  Le-Chun Wu  <lcwu@google.com>

	* decl.c (finish_function): Call invoke_plugin_callbacks.
	* parser.c (cp_parser_type_specifier): Call invoke_plugin_callbacks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20090410-plugins-merge.diff.txt.gz
Type: application/x-gzip
Size: 22864 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090410/c47be231/attachment.bin>


More information about the Gcc-patches mailing list