[llvm-commits] [dragonegg] r103401 - in /dragonegg/trunk: Makefile exports.map llvm-backend.cpp

Duncan Sands baldrick at free.fr
Mon May 10 07:04:42 PDT 2010


Author: baldrick
Date: Mon May 10 09:04:42 2010
New Revision: 103401

URL: http://llvm.org/viewvc/llvm-project?rev=103401&view=rev
Log:
Reduce the number of relocations when loading the plugin from more than
40000 to less than 2500.  First of all, change the default visibility to
hidden.  However this still leaves gazillions of visible LLVM symbols.
The LLVM header inclusions cannot simply be placed in a "visibility hidden"
scope, since they include system headers (declaring system symbols hidden
causes the plugin to not link), so use a linker script instead.

Added:
    dragonegg/trunk/exports.map
Modified:
    dragonegg/trunk/Makefile
    dragonegg/trunk/llvm-backend.cpp

Modified: dragonegg/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Makefile?rev=103401&r1=103400&r2=103401&view=diff
==============================================================================
--- dragonegg/trunk/Makefile (original)
+++ dragonegg/trunk/Makefile Mon May 10 09:04:42 2010
@@ -17,13 +17,13 @@
 	QUIET:=@
 endif
 
-CFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cflags)
-CXXFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cxxflags)
+CFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cflags) -fvisibility=hidden
+CXXFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cxxflags) -fvisibility=hidden
 
 ifeq ($(shell uname),Darwin)
 LOADABLE_MODULE_OPTIONS=-bundle -undefined dynamic_lookup
 else
-LOADABLE_MODULE_OPTIONS=-shared
+LOADABLE_MODULE_OPTIONS=-shared -Wl,--version-script=exports.map
 endif
 
 GCC_PLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin)

Added: dragonegg/trunk/exports.map
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/exports.map?rev=103401&view=auto
==============================================================================
--- dragonegg/trunk/exports.map (added)
+++ dragonegg/trunk/exports.map Mon May 10 09:04:42 2010
@@ -0,0 +1,7 @@
+{
+  global:
+    plugin_is_GPL_compatible;
+    plugin_init;
+  local:
+    *;
+};

Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=103401&r1=103400&r2=103401&view=diff
==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Mon May 10 09:04:42 2010
@@ -1564,7 +1564,9 @@
 
 // This plugin's code is licensed under the GPLv2 or later.  The LLVM libraries
 // use the GPL compatible University of Illinois/NCSA Open Source License.
+#pragma GCC visibility push(default)
 int plugin_is_GPL_compatible; // This plugin is GPL compatible.
+#pragma GCC visibility pop
 
 
 /// llvm_start_unit - Perform late initialization.  This is called by GCC just
@@ -2357,8 +2359,9 @@
 /// plugin_init - Plugin initialization routine, called by GCC.  This is the
 /// first code executed in the plugin (except for constructors).  Configure
 /// the plugin and setup GCC, taking over optimization and code generation.
-int plugin_init (struct plugin_name_args *plugin_info,
-                 struct plugin_gcc_version *version) {
+#pragma GCC visibility push(default)
+int plugin_init(struct plugin_name_args *plugin_info,
+                struct plugin_gcc_version *version) {
   const char *plugin_name = plugin_info->base_name;
   struct register_pass_info pass_info;
 
@@ -2649,3 +2652,4 @@
 
   return 0;
 }
+#pragma GCC visibility pop





More information about the llvm-commits mailing list