Bug 1651675 - explicitly use some useful linker options when building clang; r=dmajor

clang/LLVM's build scripts can turn these on on their own, but explicitly
setting what we want is better than guessing.  The change is not huge, maybe
~2-3% on the major shared libraries (`libclang`, `libclang-cpp`, `libLLVM`),
about 1% on the overall `.tar.zst` size, but every little bit counts, right?

Differential Revision: https://phabricator.services.mozilla.com/D82896
This commit is contained in:
Nathan Froyd 2020-07-10 12:51:36 +00:00
Родитель df458c1e95
Коммит 304b57adbc
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -765,6 +765,12 @@ if __name__ == "__main__":
extra_asmflags = [] extra_asmflags = []
# Avoid libLLVM internal function calls going through the PLT. # Avoid libLLVM internal function calls going through the PLT.
extra_ldflags = ['-Wl,-Bsymbolic-functions'] extra_ldflags = ['-Wl,-Bsymbolic-functions']
# For whatever reason, LLVM's build system will set things up to turn
# on -ffunction-sections and -fdata-sections, but won't turn on the
# corresponding option to strip unused sections. We do it explicitly
# here. LLVM's build system is also picky about turning on ICF, so
# we do that explicitly here, too.
extra_ldflags += ['-fuse-ld=gold', '-Wl,--gc-sections', '-Wl,--icf=safe']
if 'LD_LIBRARY_PATH' in os.environ: if 'LD_LIBRARY_PATH' in os.environ:
os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' % os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' %