Bug 537857 part 1 - Remove dead symbols in linker (original patch from tglek). r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 28 Jun 2011 08:25:48 +0200
changeset 71905 f2a0b73c0befb9f33b7785b75034a512f250a937
parent 71904 ceeced55a4db5d9237e5094a51321f7035136cca
child 71906 fed64efb8f82dd9946fb8e567afd9b3baecde5bd
push id281
push usermh@glandium.org
push dateTue, 28 Jun 2011 12:04:53 +0000
treeherdermozilla-inbound@f2a0b73c0bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs537857
milestone7.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 537857 part 1 - Remove dead symbols in linker (original patch from tglek). r=ted
configure.in
--- a/configure.in
+++ b/configure.in
@@ -1539,18 +1539,20 @@ dnl GNU specific defaults
 dnl ========================================================
 if test "$GNU_CC"; then
     # FIXME: Let us build with strict aliasing. bug 414641.
     CFLAGS="$CFLAGS -fno-strict-aliasing"
     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
     DSO_LDOPTS='-shared'
     if test "$GCC_USE_GNU_LD"; then
-        # Don't allow undefined symbols in libraries
-        DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
+        # Don't allow undefined symbols in libraries, and remove dead symbols
+        DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs -Wl,--gc-sections"
+        CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
+        CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
     fi
     WARNINGS_AS_ERRORS='-Werror'
     DSO_CFLAGS=''
     DSO_PIC_CFLAGS='-fPIC'
     ASFLAGS="$ASFLAGS -fPIC"
     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
     _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'