aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvmc
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-06-23 20:46:48 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-06-23 20:46:48 +0000
commitd80d8690af2ce54f7f624889b5628fa3dc61cc27 (patch)
treee136bb9eca617d20f273f938a30e9138976cfea6 /tools/llvmc
parent06509db63088f7e4aed4e47fc9c73317eff461ec (diff)
downloadexternal_llvm-d80d8690af2ce54f7f624889b5628fa3dc61cc27.zip
external_llvm-d80d8690af2ce54f7f624889b5628fa3dc61cc27.tar.gz
external_llvm-d80d8690af2ce54f7f624889b5628fa3dc61cc27.tar.bz2
Make llvmc work again.
Chris recently broke llvmc with his Makefile changes (r75379). That patch made the global change .o -> .a, which caused built-in llvmc plugins to stop working since plugin initialization in llvmc is based on static variables not referenced from the main executable. This patch implements auto-generated forced references to the plugin libraries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc')
-rw-r--r--tools/llvmc/driver/Makefile35
1 files changed, 33 insertions, 2 deletions
diff --git a/tools/llvmc/driver/Makefile b/tools/llvmc/driver/Makefile
index 5f5ec53..67fc996 100644
--- a/tools/llvmc/driver/Makefile
+++ b/tools/llvmc/driver/Makefile
@@ -8,15 +8,46 @@
##===----------------------------------------------------------------------===##
LEVEL = ../../..
+include $(LEVEL)/Makefile.config
TOOLNAME = $(LLVMC_BASED_DRIVER_NAME)
LLVMLIBS = CompilerDriver.a
+LINK_COMPONENTS = support system
+REQUIRES_EH := 1
+# Preprocessor magic that generates references to static variables in built-in
+# plugins.
+# TODO: Move this to Makefile.rules? (also used by examples/{Skeleton, mcc16})
ifneq ($(LLVMC_BUILTIN_PLUGINS),)
+
USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
+
+LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS))
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_1),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1)
endif
-LINK_COMPONENTS = support system
-REQUIRES_EH := 1
+ifneq ($(LLVMC_BUILTIN_PLUGIN_2),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2)
+endif
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_3),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3)
+endif
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_4),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4)
+endif
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_5),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5)
+endif
+
+endif
include $(LEVEL)/Makefile.common