diff options
author | Fangrui Song <maskray@google.com> | 2020-02-15 17:23:18 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-04-07 15:46:01 -0700 |
commit | d2ef8c1f2ca33457247be26374852573098553c7 (patch) | |
tree | 00728c3ccc87a749c32dd9ad87e9bbfeb88cdcc2 /llvm/lib/CodeGen/CodeGen.cpp | |
parent | 2f8fb4d1cde803aee60171ce73a7f5a95868ff84 (diff) | |
download | llvm-d2ef8c1f2ca33457247be26374852573098553c7.zip llvm-d2ef8c1f2ca33457247be26374852573098553c7.tar.gz llvm-d2ef8c1f2ca33457247be26374852573098553c7.tar.bz2 |
[ThinLTO] Drop dso_local if a GlobalVariable satisfies isDeclarationForLinker()
dso_local leads to direct access even if the definition is not within this compilation unit (it is
still in the same linkage unit). On ELF, such a relocation (e.g. R_X86_64_PC32) referencing a
STB_GLOBAL STV_DEFAULT object can cause a linker error in a -shared link.
If the linkage is changed to available_externally, the dso_local flag should be dropped, so that no
direct access will be generated.
The current behavior is benign, because -fpic does not assume dso_local
(clang/lib/CodeGen/CodeGenModule.cpp:shouldAssumeDSOLocal).
If we do that for -fno-semantic-interposition (D73865), there will be an
R_X86_64_PC32 linker error without this patch.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D74751
Diffstat (limited to 'llvm/lib/CodeGen/CodeGen.cpp')
0 files changed, 0 insertions, 0 deletions