Bug 1494216 - Use the -Bsymbolic-functions linker flag to build clang. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 27 Sep 2018 08:19:41 +0900
changeset 494870 1ba04509b37ae69254e48227c155a4c6e876937c
parent 494869 77dfc06a7c782f3ffb14ddf139d885ab2dab43d6
child 494871 864b718cd7978d9daa418362220e12e2a9aac74d
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1494216
milestone64.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 1494216 - Use the -Bsymbolic-functions linker flag to build clang. r=froydnj With libLLVM being a shared library exporting many symbols, all internal calls using those symbols default to go through the PLT, which is unnecessary (and costly) overhead. Using -Bsymbolic-functions makes internal calls go directly to the right place without going through the PLT. Differential Revision: https://phabricator.services.mozilla.com/D7029
build/build-clang/build-clang.py
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -611,17 +611,18 @@ if __name__ == "__main__":
         extra_ldflags = []
     elif is_linux():
         extra_cflags = []
         extra_cxxflags = []
         extra_cflags2 = ["-fPIC"]
         # Silence clang's warnings about arguments not being used in compilation.
         extra_cxxflags2 = ["-fPIC", '-Qunused-arguments']
         extra_asmflags = []
-        extra_ldflags = []
+        # Avoid libLLVM internal function calls going through the PLT.
+        extra_ldflags = ['-Wl,-Bsymbolic-functions']
 
         if 'LD_LIBRARY_PATH' in os.environ:
             os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' %
                                              (gcc_dir, os.environ['LD_LIBRARY_PATH']))
         else:
             os.environ['LD_LIBRARY_PATH'] = '%s/lib64/' % gcc_dir
     elif is_windows():
         extra_cflags = []