For the xpcom plugin, detect if the system linker is GNU gold. If so, try to use compat-ld instead
Review at http://gwt-code-reviews.appspot.com/1008801
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9132 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/plugins/xpcom/Makefile b/plugins/xpcom/Makefile
index 6472621..341a43e 100644
--- a/plugins/xpcom/Makefile
+++ b/plugins/xpcom/Makefile
@@ -24,7 +24,7 @@
DEFAULT_FIREFOX_LIBS ?= /Applications/Firefox.app/Contents/MacOS
RUN_PATH_FLAG = -executable_path
DLL_SUFFIX = .dylib
-DLLFLAGS = -bundle $(ALLARCHCFLAGS)
+DLLFLAGS += -bundle $(ALLARCHCFLAGS)
CFLAGS += $(ALLARCHCFLAGS)
CXXFLAGS += $(ALLARCHCFLAGS)
TARGET_PLATFORM = Darwin-gcc3
@@ -35,13 +35,13 @@
DEFAULT_FIREFOX_LIBS ?= /usr/lib/firefox
RUN_PATH_FLAG = -rpath-link
DLL_SUFFIX = .so
-DLLFLAGS = -shared -m$(FLAG32BIT)
+DLLFLAGS += -shared -m$(FLAG32BIT)
TARGET_PLATFORM = Linux_$(ARCH)-gcc3
else
ifeq ($(OS),sun)
TARGET_PLATFORM = SunOS_$(ARCH)-sunc
RUN_PATH_FLAG = -rpath-link
-DLLFLAGS=
+DLLFLAGS ?= ""
endif
endif
endif
@@ -53,6 +53,18 @@
BROWSER=ff3
endif
+# Gold doesn't play nice with xpcom libs
+LINKER=$(shell ld -v | awk '{print $$2}')
+ifeq ($(LINKER), gold)
+ifeq ($(wildcard /usr/lib/compat-ld),)
+$(error cannot link with gold, use the BFD ld instead)
+else
+CFLAGS += -B/usr/lib/compat-ld/
+CXXFLAGS += -B/usr/lib/compat-ld/
+DLLFLAGS += -B/usr/lib/compat-ld/
+endif
+endif
+
CFLAGS += -DBROWSER=$(BROWSER)
GECKO_MINOR_VERSION=
ifeq ($(BROWSER),ff2)