Bug 1411712 - Move symbol version script ldflags for libxul to moz.build r=mshal
authorChris Manchester <cmanchester@mozilla.com>
Thu, 02 Nov 2017 11:47:48 -0700
changeset 443191 e173810afc6e201b4d109000dcc65c8b8bdd4bdc
parent 443190 60190c4417108c2638b61ad9744edb48b44eeb33
child 443192 e2910375ccd8a7f64fb30ae30562c5102905309a
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1411712
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1411712 - Move symbol version script ldflags for libxul to moz.build r=mshal MozReview-Commit-ID: JDAIC6yzkx7
toolkit/library/libxul.mk
toolkit/library/moz.build
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -1,17 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk
 
 ifeq (Linux,$(OS_ARCH))
 ifneq (Android,$(OS_TARGET))
-OS_LDFLAGS += -Wl,-version-script,symverscript
 
 symverscript: $(topsrcdir)/toolkit/library/symverscript.in
 	$(call py_action,preprocessor, \
 		-DVERSION='xul$(MOZILLA_SYMBOLVERSION)' $< -o $@)
 
 EXTRA_DEPS += symverscript
 endif
 endif
@@ -22,31 +21,16 @@ endif
 ifeq (Linux,$(OS_ARCH))
 # Create a GDB Python auto-load file alongside the libxul shared library in
 # the build directory.
 PP_TARGETS += LIBXUL_AUTOLOAD
 LIBXUL_AUTOLOAD = $(topsrcdir)/toolkit/library/libxul.so-gdb.py.in
 LIBXUL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
 endif
 
-# BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
-# exists. Using an implicit linker script to make it fold that section in
-# .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
-# script however makes gold misbehave, first because it doesn't like that
-# the linker script is given after crtbegin.o, and even past that, replaces
-# the default section rules with those from the script instead of
-# supplementing them. Which leads to a lib with a huge load of sections.
-ifneq (OpenBSD,$(OS_TARGET))
-ifneq (WINNT,$(OS_TARGET))
-ifdef LD_IS_BFD
-OS_LDFLAGS += $(topsrcdir)/toolkit/library/StaticXULComponents.ld
-endif
-endif
-endif
-
 ifdef _MSC_VER
 get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
 else
 get_first_and_last = $(TOOLCHAIN_PREFIX)nm -g $1 | grep _NSModule$$ | grep -vw refptr | sort | sed -n 's/^.* _*\([^ ]*\)$$/\1/;1p;$$p'
 endif
 
 LOCAL_CHECKS = test "$$($(get_first_and_last) | xargs echo)" != "start_kPStaticModules_NSModule end_kPStaticModules_NSModule" && echo "NSModules are not ordered appropriately" && exit 1 || exit 0
 
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -51,16 +51,29 @@ def Libxul(name):
             '/xpcom/base',
         ]
         # config/version.mk says $(srcdir)/$(RCINCLUDE), and this needs to
         # be valid in both toolkit/library and toolkit/library/gtest.
         # Eventually, the make backend would do its own path canonicalization
         # and config/version.mk would lift the $(srcdir)
         RCINCLUDE = '$(DEPTH)/toolkit/library/xulrunner.rc'
 
+    if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
+        LDFLAGS += ['-Wl,-version-script,symverscript']
+
+    # BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
+    # exists. Using an implicit linker script to make it fold that section in
+    # .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
+    # script however makes gold misbehave, first because it doesn't like that
+    # the linker script is given after crtbegin.o, and even past that, replaces
+    # the default section rules with those from the script instead of
+    # supplementing them. Which leads to a lib with a huge load of sections.
+    if CONFIG['OS_TARGET'] not in ('OpenBSD', 'WINNT') and CONFIG['LD_IS_BFD']:
+        LDFLAGS += [TOPSRCDIR + '/toolkit/library/StaticXULComponents.ld']
+
     Libxul_defines()
 
     if CONFIG['MOZ_NEEDS_LIBATOMIC']:
         OS_LIBS += ['atomic']
 
     # This option should go away in bug 1290972, but we need to wait until
     # Rust 1.12 has been released.
     # We're also linking against libresolv to solve bug 1367932.