bug 1032055 - prevent lto from reordering static xul component constants r=glandium
authorTrevor Saunders <trev.saunders@gmail.com>
Thu, 28 Aug 2014 16:41:18 -0400
changeset 223897 b9de6514b9940f66ae6b07157216f6222cb91bca
parent 223896 5f61c734e372c438b4660fb1a0ada397ef9d2365
child 223898 a7840102579bb11fa60237349236118d38adb7c2
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersglandium
bugs1032055
milestone34.0a1
bug 1032055 - prevent lto from reordering static xul component constants r=glandium
toolkit/library/StaticXULComponentsEnd/moz.build
toolkit/library/moz.build
--- a/toolkit/library/StaticXULComponentsEnd/moz.build
+++ b/toolkit/library/StaticXULComponentsEnd/moz.build
@@ -1,11 +1,15 @@
 # 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/.
 
 SOURCES += [
     'StaticXULComponentsEnd.cpp',
 ]
 
+# Don't let LTO reorder StaticXULComponentsStart.o.
+if '-flto' in CONFIG['OS_CXXFLAGS']:
+    SOURCES['StaticXULComponentsEnd.cpp'].flags += ['-fno-lto']
+
 LIBRARY_NAME = 'StaticXULComponentsEnd'
 
 DEFINES['MOZILLA_INTERNAL_API'] = True
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -17,16 +17,20 @@ SOURCES += [
 ]
 
 MSVC_ENABLE_PGO = True
 
 # This, combined with the fact the file is first, makes the start pointer
 # it contains first in Windows PGO builds.
 SOURCES['StaticXULComponentsStart.cpp'].no_pgo = True
 
+# Don't let LTO reorder StaticXULComponentsStart.o.
+if '-flto' in CONFIG['OS_CXXFLAGS']:
+    SOURCES['StaticXULComponentsStart.cpp'].flags += ['-fno-lto']
+
 if CONFIG['OS_ARCH'] == 'WINNT':
     SOURCES += [
         'nsDllMain.cpp',
     ]
 
 LOCAL_INCLUDES += [
     '/config',
     # need widget/windows for resource.h (included from widget.rc)