[llvm-commits] [dragonegg] r148397 - in /dragonegg/trunk: Makefile src/Backend.cpp

Duncan Sands baldrick at free.fr
Wed Jan 18 08:45:38 PST 2012


Author: baldrick
Date: Wed Jan 18 10:45:37 2012
New Revision: 148397

URL: http://llvm.org/viewvc/llvm-project?rev=148397&view=rev
Log:
Add a way of not compiling in version checking code at all.  The
problem is that it results in the gcc configure line being embedded
in Backend.o, which can be a pain when bootstrapping since you can
get different object files at different stages due to this.

Modified:
    dragonegg/trunk/Makefile
    dragonegg/trunk/src/Backend.cpp

Modified: dragonegg/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Makefile?rev=148397&r1=148396&r2=148397&view=diff
==============================================================================
--- dragonegg/trunk/Makefile (original)
+++ dragonegg/trunk/Makefile Wed Jan 18 10:45:37 2012
@@ -13,6 +13,11 @@
 # directories.
 TOP_DIR?=$(PWD)
 
+# Normally the plugin will refuse to load into a different gcc to the one it was
+# built against.  Uncomment this (or pass DISABLE_VERSION_CHECK=1 on the 'make'
+# command line) to disable the check.
+#DISABLE_VERSION_CHECK=1
+
 INCLUDE_DIR=$(TOP_DIR)/include
 SRC_DIR=$(TOP_DIR)/src
 
@@ -58,6 +63,9 @@
 	     -DGCC_MAJOR=$(GCC_MAJOR) -DGCC_MINOR=$(GCC_MINOR) \
 	     -DGCC_MICRO=$(GCC_MICRO) \
 	     -I$(INCLUDE_DIR) -I$(GCC_PLUGIN_DIR)/include
+ifdef DISABLE_VERSION_CHECK
+CPP_OPTIONS+=-DDISABLE_VERSION_CHECK
+endif
 
 LD_OPTIONS+=$(shell $(LLVM_CONFIG) --ldflags) $(LDFLAGS)
 

Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=148397&r1=148396&r2=148397&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Wed Jan 18 10:45:37 2012
@@ -68,7 +68,9 @@
 #include "langhooks.h"
 #include "output.h"
 #include "params.h"
+#ifndef DISABLE_VERSION_CHECK
 #include "plugin-version.h"
+#endif
 #include "toplev.h"
 #include "tree-flow.h"
 #include "tree-pass.h"
@@ -1988,6 +1990,7 @@
   NULL		// help
 };
 
+#ifndef DISABLE_VERSION_CHECK
 static bool version_check(struct plugin_gcc_version *gcc_version,
                           struct plugin_gcc_version *plugin_version) {
   // Make it possible to turn off the version check - useful for testing gcc
@@ -2000,6 +2003,7 @@
   // moving gcc tree.  TODO: Use a milder check if doing a "release build".
   return plugin_default_version_check (gcc_version, plugin_version);
 }
+#endif
 
 
 /// plugin_init - Plugin initialization routine, called by GCC.  This is the
@@ -2007,15 +2011,21 @@
 /// the plugin and setup GCC, taking over optimization and code generation.
 int __attribute__ ((visibility("default")))
 plugin_init(struct plugin_name_args *plugin_info,
-            struct plugin_gcc_version *version) {
+            struct plugin_gcc_version *
+#ifndef DISABLE_VERSION_CHECK
+            version
+#endif
+            ) {
   const char *plugin_name = plugin_info->base_name;
   struct register_pass_info pass_info;
 
+#ifndef DISABLE_VERSION_CHECK
   // Check that the plugin is compatible with the running gcc.
   if (!version_check (&gcc_version, version)) {
     errs() << "Incompatible plugin version\n";
     return 1;
   }
+#endif
 
   // Provide GCC with our version and help information.
   register_callback(plugin_name, PLUGIN_INFO, NULL, &llvm_plugin_info);





More information about the llvm-commits mailing list