diff options
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/Makefile.in | 10 | ||||
-rwxr-xr-x | gcc/configure | 52 | ||||
-rw-r--r-- | gcc/configure.ac | 26 | ||||
-rw-r--r-- | gcc/gcc-plugin.h | 5 | ||||
-rw-r--r-- | gcc/plugin.c | 28 |
6 files changed, 97 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 883f1b84f6f..8b95f6187ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2009-04-29 Rafael Avila de Espindola <espindola@google.com> + + * Makefile.in (PLUGIN_VERSION_H): New. + (OBJS-common): Remove plugin-version.o. + (plugin.o): Depend on (PLUGIN_VERSION_H). + (plugin-version.o): Remove. + * configure: Regenerate + * configure.ac: Create plugin-version.h. + * gcc-plugin.h (plugin_gcc_version): Remove. + (plugin_default_version_check): Change signature. + * plugin-version.c: Remove. + * plugin.c: Include plugin-version.h. + (str_plugin_gcc_version_name): Remove. + (try_init_one_plugin): Pass gcc version to plugin_init. + (plugin_default_version_check): Both gcc and plugin versions are now + arguments. + 2009-04-29 Bernd Schmidt <bernd.schmidt@analog.com> * config/bfin/bfin.c (bfin_optimize_loop): Unify handling of diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e01f0fba982..2283138956e 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -881,6 +881,7 @@ IPA_PROP_H = ipa-prop.h $(TREE_H) vec.h $(CGRAPH_H) GSTAB_H = gstab.h stab.def BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h PLUGIN_H = plugin.h gcc-plugin.h +PLUGIN_VERSION_H = plugin-version.h configargs.h # # Now figure out from those variables how to compile and link. @@ -1158,7 +1159,6 @@ OBJS-common = \ params.o \ passes.o \ plugin.o \ - plugin-version.o \ pointer-set.o \ postreload-gcse.o \ postreload.o \ @@ -2475,13 +2475,7 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ gt-passes.h $(DF_H) $(PREDICT_H) plugin.o : plugin.c $(PLUGIN_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TOPLEV_H) $(TREE_H) $(TREE_PASS_H) intl.h - -plugin-version.o : plugin-version.c $(SYSTEM_H) gcc-plugin.h configargs.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ - -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \ - -DREVISION=$(REVISION_s) -DDEVPHASE=$(DEVPHASE_s) -c \ - -DPLUGIN $(srcdir)/plugin-version.c $(OUTPUT_OPTION) + $(TOPLEV_H) $(TREE_H) $(TREE_PASS_H) intl.h $(PLUGIN_VERSION_H) main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) diff --git a/gcc/configure b/gcc/configure index 2415a6cb2d9..e96fcf528a3 100755 --- a/gcc/configure +++ b/gcc/configure @@ -13451,6 +13451,30 @@ static const struct { } configure_default_options[] = $configure_default_options; EOF +gcc_BASEVER=$(cat $srcdir/BASE-VER) +gcc_DEVPHASE=$(cat $srcdir/DEV-PHASE) +gcc_DATESTAMP=$(cat $srcdir/DATESTAMP) +if test -f $srcdir/REVISION ; then + gcc_REVISION=$(cat $srcdir/REVISION) +else + gcc_REVISION="" +fi +cat > plugin-version.h <<EOF +#include "configargs.h" + +static char basever[] = "$gcc_BASEVER"; +static char datestamp[] = "$gcc_DATESTAMP"; +static char devphase[] = "$gcc_DEVPHASE"; +static char revision[] = "$gcc_REVISION"; + +/* FIXME plugins: We should make the version information more precise. + One way to do is to add a checksum. */ + +static struct plugin_gcc_version gcc_version = {basever, datestamp, + devphase, revision, + configuration_arguments}; +EOF + # Internationalization # If we haven't got the data from the intl directory, # assume NLS is disabled. @@ -14359,13 +14383,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:14362: $ac_compile\"" >&5) + (eval echo "\"\$as_me:14386: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:14365: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:14389: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:14368: output\"" >&5) + (eval echo "\"\$as_me:14392: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -15522,7 +15546,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 15525 "configure"' > conftest.$ac_ext + echo '#line 15549 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16821,11 +16845,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16824: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16848: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16828: \$? = $ac_status" >&5 + echo "$as_me:16852: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17160,11 +17184,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17163: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17187: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17167: \$? = $ac_status" >&5 + echo "$as_me:17191: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17265,11 +17289,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17268: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17292: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17272: \$? = $ac_status" >&5 + echo "$as_me:17296: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17320,11 +17344,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17323: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17347: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17327: \$? = $ac_status" >&5 + echo "$as_me:17351: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20132,7 +20156,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20135 "configure" +#line 20159 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -20228,7 +20252,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20231 "configure" +#line 20255 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 849b856f9c9..306adc18d2d 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1495,6 +1495,32 @@ static const struct { EOF changequote([,])dnl +changequote(,)dnl +gcc_BASEVER=$(cat $srcdir/BASE-VER) +gcc_DEVPHASE=$(cat $srcdir/DEV-PHASE) +gcc_DATESTAMP=$(cat $srcdir/DATESTAMP) +if test -f $srcdir/REVISION ; then + gcc_REVISION=$(cat $srcdir/REVISION) +else + gcc_REVISION="" +fi +cat > plugin-version.h <<EOF +#include "configargs.h" + +static char basever[] = "$gcc_BASEVER"; +static char datestamp[] = "$gcc_DATESTAMP"; +static char devphase[] = "$gcc_DEVPHASE"; +static char revision[] = "$gcc_REVISION"; + +/* FIXME plugins: We should make the version information more precise. + One way to do is to add a checksum. */ + +static struct plugin_gcc_version gcc_version = {basever, datestamp, + devphase, revision, + configuration_arguments}; +EOF +changequote([,])dnl + # Internationalization ZW_GNU_GETTEXT_SISTER_DIR diff --git a/gcc/gcc-plugin.h b/gcc/gcc-plugin.h index 543dc933742..96c867d4bc6 100644 --- a/gcc/gcc-plugin.h +++ b/gcc/gcc-plugin.h @@ -78,11 +78,10 @@ struct plugin_gcc_version const char *configuration_arguments; }; -extern struct plugin_gcc_version plugin_gcc_version; - /* The default version check. Compares every field in VERSION. */ -extern bool plugin_default_version_check(struct plugin_gcc_version *version); +extern bool plugin_default_version_check (struct plugin_gcc_version *, + struct plugin_gcc_version *); /* Function type for the plugin initialization routine. Each plugin module should define this as an externally-visible function with name diff --git a/gcc/plugin.c b/gcc/plugin.c index c406c38b5f3..3b7cc78a193 100644 --- a/gcc/plugin.c +++ b/gcc/plugin.c @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "plugin.h" #include "timevar.h" +#include "plugin-version.h" /* Event names as strings. Keep in sync with enum plugin_event. */ const char *plugin_event_name[] = @@ -99,7 +100,6 @@ static struct pass_list_node *prev_added_pass_node; /* Each plugin should define an initialization function with exactly this name. */ static const char *str_plugin_init_func_name = "plugin_init"; -static const char *str_plugin_gcc_version_name = "plugin_gcc_version"; #endif /* Helper function for the hash table that compares the base_name of the @@ -567,10 +567,8 @@ try_init_one_plugin (struct plugin_name_args *plugin) { void *dl_handle; plugin_init_func plugin_init; - struct plugin_gcc_version *version; char *err; PTR_UNION_TYPE (plugin_init_func) plugin_init_union; - PTR_UNION_TYPE (struct plugin_gcc_version*) version_union; dl_handle = dlopen (plugin->full_name, RTLD_NOW); if (!dl_handle) @@ -593,12 +591,9 @@ try_init_one_plugin (struct plugin_name_args *plugin) return false; } - PTR_UNION_AS_VOID_PTR (version_union) = - dlsym (dl_handle, str_plugin_gcc_version_name); - version = PTR_UNION_AS_CAST_PTR (version_union); - /* Call the plugin-provided initialization routine with the arguments. */ - if ((*plugin_init) (plugin->base_name, version, plugin->argc, plugin->argv)) + if ((*plugin_init) (plugin->base_name, &gcc_version, plugin->argc, + plugin->argv)) { error ("Fail to initialize plugin %s", plugin->full_name); return false; @@ -816,22 +811,23 @@ debug_active_plugins (void) /* The default version check. Compares every field in VERSION. */ bool -plugin_default_version_check(struct plugin_gcc_version *version) +plugin_default_version_check (struct plugin_gcc_version *gcc_version, + struct plugin_gcc_version *plugin_version) { /* version is NULL if the plugin was not linked with plugin-version.o */ - if (!version) + if (!gcc_version || !plugin_version) return false; - if (strcmp (version->basever, plugin_gcc_version.basever)) + if (strcmp (gcc_version->basever, plugin_version->basever)) return false; - if (strcmp (version->datestamp, plugin_gcc_version.datestamp)) + if (strcmp (gcc_version->datestamp, plugin_version->datestamp)) return false; - if (strcmp (version->devphase, plugin_gcc_version.devphase)) + if (strcmp (gcc_version->devphase, plugin_version->devphase)) return false; - if (strcmp (version->revision, plugin_gcc_version.revision)) + if (strcmp (gcc_version->revision, plugin_version->revision)) return false; - if (strcmp (version->configuration_arguments, - plugin_gcc_version.configuration_arguments)) + if (strcmp (gcc_version->configuration_arguments, + plugin_version->configuration_arguments)) return false; return true; } |