aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.rules4
-rw-r--r--tools/gold/Makefile4
2 files changed, 7 insertions, 1 deletions
diff --git a/Makefile.rules b/Makefile.rules
index a3ffbd41e4..f44d2c5884 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1239,8 +1239,10 @@ endif
$(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
$(notdir $@)
+ # @LOCALMOD: the EXTRA_LIBS hack is necessary for LLVMgold.so
+ # c.f. llvm/tools/gold/Makefile
$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
- $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
+ $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS) $(EXTRA_LIBS)
else
$(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
$(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
diff --git a/tools/gold/Makefile b/tools/gold/Makefile
index 02f66d73ee..79f86a85c3 100644
--- a/tools/gold/Makefile
+++ b/tools/gold/Makefile
@@ -14,6 +14,10 @@ LINK_LIBS_IN_SHARED := 1
SHARED_LIBRARY := 1
LOADABLE_MODULE := 1
+# @LOCALMOD: this forces to appear -lLTO *after* the object file
+# on the linkline. This is necessary for linking on ubuntu precise.
+# Otherwise LLVMgold.so will not have a dt_needed entry for LTO
+EXTRA_LIBS := -lLTO
EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/gold.exports
# Include this here so we can get the configuration of the targets