Bug 818903 - Also link NSPR and NSS with --build-id when available. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 10 Dec 2012 19:00:38 +0100
changeset 124646 3cb1250425c05448e0ded6d3946f4827160467ba
parent 124645 8ebc6c8ff612459124d6c51a25059629c1b1945d
child 124647 508d1f5c60b050dbd72330204db528a796973229
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs818903
milestone20.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 818903 - Also link NSPR and NSS with --build-id when available. r=ted
configure.in
security/build/Makefile.in
--- a/configure.in
+++ b/configure.in
@@ -1424,17 +1424,18 @@ if test "$GNU_CC"; then
     _SAVE_LDFLAGS=$LDFLAGS
     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
                   AC_MSG_RESULT([no])
                   LDFLAGS=$_SAVE_LDFLAGS)
     AC_MSG_CHECKING([for --build-id option to ld])
     _SAVE_LDFLAGS=$LDFLAGS
     LDFLAGS="$LDFLAGS -Wl,--build-id"
-    AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
+    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
+                  NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id",
                   AC_MSG_RESULT([no])
                   LDFLAGS=$_SAVE_LDFLAGS)
 
 
     # Check for -mssse3 on $CC
     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
     _SAVE_CFLAGS=$CFLAGS
@@ -3758,17 +3759,17 @@ if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD
   if test "$ac_cv_crt_has_text_relocations" = yes; then
     dnl While we want libraries to skip the CRT files, we don't want
     dnl executables to be treated the same way. We thus set the flag
     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
     dnl Using LDFLAGS in nspr is safe, since we only really build
     dnl libraries there.
     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
-    NSPR_LDFLAGS=-nostartfiles
+    NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
   fi
 fi
 
 dnl Check for the existence of various allocation headers/functions
 
 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
 MALLOC_H=
 
--- a/security/build/Makefile.in
+++ b/security/build/Makefile.in
@@ -280,20 +280,24 @@ NSS_DIRS += \
 ifdef ENABLE_TESTS
 NSS_DIRS += \
   nss/cmd/certutil \
   nss/cmd/pk12util \
   nss/cmd/modutil \
   $(NULL)
 endif
 
+ifneq (,$(filter %--build-id,$(LDFLAGS)))
+DEFAULT_GMAKE_ENV = LDFLAGS=-Wl,--build-id
+endif
+
 ifndef MOZ_NATIVE_NSS
 define build_rules
 libs::
-	$$(MAKE) -C $$(NSS_SRCDIR)/security/$(1) $$(DEFAULT_GMAKE_FLAGS)
+	$$(DEFAULT_GMAKE_ENV) $$(MAKE) -C $$(NSS_SRCDIR)/security/$(1) $$(DEFAULT_GMAKE_FLAGS)
 
 clean clobber clobber_all realclean distclean depend::
 	$$(MAKE) -C $$(NSS_SRCDIR)/security/$(1) $$(DEFAULT_GMAKE_FLAGS) clean
 endef
 $(foreach dir,$(NSS_DIRS),$(eval $(call build_rules,$(dir))))
 
 NSS_LIBS = \
   $(LOADABLE_ROOT_MODULE) \