summaryrefslogtreecommitdiff
path: root/binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch
diff options
context:
space:
mode:
Diffstat (limited to 'binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch')
-rw-r--r--binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch150
1 files changed, 150 insertions, 0 deletions
diff --git a/binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch b/binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch
new file mode 100644
index 0000000..4230d5f
--- /dev/null
+++ b/binary/mingw-w64/patches/gcc-4.9-20150204-static-plugin.patch
@@ -0,0 +1,150 @@
+diff -ru gcc-4.9-20150204/gcc/config.in gcc/gcc/config.in
+--- gcc-4.9-20150204/gcc/config.in 2015-02-05 00:32:56.000000000 +0200
++++ gcc/gcc/config.in 2015-02-08 19:58:45.215372260 +0200
+@@ -137,6 +137,10 @@
+ #undef ENABLE_PLUGIN
+ #endif
+
++/* Define to enable static plugin support. */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_STATIC_PLUGIN
++#endif
+
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+diff -ru gcc-4.9-20150204/gcc/configure.ac gcc/gcc/configure.ac
+--- gcc-4.9-20150204/gcc/configure.ac 2014-12-04 20:25:37.000000000 +0200
++++ gcc/gcc/configure.ac 2015-02-08 19:58:45.219372260 +0200
+@@ -5519,6 +5519,14 @@
+ fi
+ fi
+
++AC_ARG_ENABLE(static-plugin,
++[ --enable-static-plugin enable static plugin support],
++enable_static_plugin=$enableval,
++enable_static_plugin==no)
++
++if test x"$enable_static_plugin" = x"yes"; then
++ AC_DEFINE(ENABLE_STATIC_PLUGIN, 1, [Define to enable static plugin support.])
++fi
+
+ # Check for plugin support
+ AC_ARG_ENABLE(plugin,
+diff -ru gcc-4.9-20150204/gcc/cp/Make-lang.in gcc/gcc/cp/Make-lang.in
+--- gcc-4.9-20150204/gcc/cp/Make-lang.in 2014-04-15 10:04:17.000000000 +0200
++++ gcc/gcc/cp/Make-lang.in 2015-02-08 20:01:21.479374174 +0200
+@@ -90,14 +90,14 @@
+
+ # compute checksum over all object files and the options
+ cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \
+- $(CXX_OBJS) $(BACKEND) $(LIBDEPS)
++ $(CXX_OBJS) $(BACKEND) $(LIBDEPS)
+ build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(LIBDEPS) \
+ checksum-options > cc1plus-checksum.c.tmp && \
+ $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c
+
+ cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+ +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
+- $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
++ $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(STATIC_PLUGIN_LIBS) $(LIBS) $(BACKENDLIBS)
+
+ ifeq ($(ENABLE_MAINTAINER_RULES), true)
+ # Special build rule. This is a maintainer rule, that is only
+diff -ru gcc-4.9-20150204/gcc/opts-global.c gcc/gcc/opts-global.c
+--- gcc-4.9-20150204/gcc/opts-global.c 2014-01-03 00:23:26.000000000 +0200
++++ gcc/gcc/opts-global.c 2015-02-08 19:58:45.223372260 +0200
+@@ -381,7 +381,7 @@
+ break;
+
+ case OPT_fplugin_:
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ add_new_plugin (opt->arg);
+ #else
+ error ("plugin support is disabled; configure with --enable-plugin");
+@@ -389,7 +389,7 @@
+ break;
+
+ case OPT_fplugin_arg_:
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ parse_plugin_arg_opt (opt->arg);
+ #else
+ error ("plugin support is disabled; configure with --enable-plugin");
+diff -ru gcc-4.9-20150204/gcc/plugin.c gcc/gcc/plugin.c
+--- gcc-4.9-20150204/gcc/plugin.c 2014-01-03 00:23:26.000000000 +0200
++++ gcc/gcc/plugin.c 2015-02-09 12:40:04.956108359 +0200
+@@ -31,7 +31,7 @@
+ #include "plugin.h"
+ #include "ggc.h"
+
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ #include "plugin-version.h"
+ #endif
+
+@@ -159,6 +159,7 @@
+
+ flag_plugin_added = true;
+
++#ifdef ENABLE_PLUGIN
+ /* Replace short names by their full path when relevant. */
+ name_is_short = !IS_ABSOLUTE_PATH (plugin_name);
+ for (pc = plugin_name; name_is_short && *pc; pc++)
+@@ -180,6 +181,7 @@
+ plugin_name, base_name);
+ }
+ else
++#endif
+ base_name = get_plugin_base_name (plugin_name);
+
+ /* If this is the first -fplugin= option we encounter, create
+@@ -634,6 +636,26 @@
+ return 1;
+ }
+
++#elif defined(ENABLE_STATIC_PLUGIN)
++
++extern "C" int
++plugin_init (struct plugin_name_args*, struct plugin_gcc_version*);
++
++static int
++init_one_plugin (void **slot, void * ARG_UNUSED (info))
++{
++ struct plugin_name_args *plugin = (struct plugin_name_args *) *slot;
++
++ /* Call the plugin-provided initialization routine with the arguments. */
++ if (plugin_init (plugin, &gcc_version))
++ {
++ error ("Fail to initialize plugin %s", plugin->full_name);
++ htab_remove_elt (plugin_name_args_tab, plugin->base_name);
++ XDELETE (plugin);
++ }
++ return 1;
++}
++
+ #endif /* ENABLE_PLUGIN */
+
+ /* Main plugin initialization function. Called from compile_file() in
+@@ -648,7 +670,7 @@
+
+ timevar_push (TV_PLUGIN_INIT);
+
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ /* Traverse and initialize each plugin specified in the command-line. */
+ htab_traverse_noresize (plugin_name_args_tab, init_one_plugin, NULL);
+ #endif
+diff -ru gcc-4.9-20150204/gcc/plugin.h gcc/gcc/plugin.h
+--- gcc-4.9-20150204/gcc/plugin.h 2014-01-03 00:23:26.000000000 +0200
++++ gcc/gcc/plugin.h 2015-02-08 19:58:45.227372260 +0200
+@@ -53,7 +53,7 @@
+ invoke_plugin_callbacks (int event ATTRIBUTE_UNUSED,
+ void *gcc_data ATTRIBUTE_UNUSED)
+ {
+-#ifdef ENABLE_PLUGIN
++#if defined(ENABLE_PLUGIN) || defined(ENABLE_STATIC_PLUGIN)
+ /* True iff at least one plugin has been added. */
+ if (flag_plugin_added)
+ return invoke_plugin_callbacks_full (event, gcc_data);
+