aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Basic/VirtualFileSystemTest.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-08-06 19:09:40 +0000
committerFangrui Song <maskray@google.com>2018-08-06 19:09:40 +0000
commit96e6ed645d0dd8c105c70b10413f60f5ecbf435d (patch)
tree39d469579d7cac5919b9c464f33751cb3d5eebe0 /clang/unittests/Basic/VirtualFileSystemTest.cpp
parent0076477a4c15992c85627d6a82045aaacf40803f (diff)
downloadllvm-96e6ed645d0dd8c105c70b10413f60f5ecbf435d.zip
llvm-96e6ed645d0dd8c105c70b10413f60f5ecbf435d.tar.gz
llvm-96e6ed645d0dd8c105c70b10413f60f5ecbf435d.tar.bz2
[ELF] Don't copy STT_TLS in copy relocation
During copy relocation of a variable defined in a DSO, if a TLS variable in that DSO happens to have the same st_value, it would also be copied. This was unnecessary because the addresses of TLS variables are relative to TLS segment. They don't interfere with non-TLS variables. This copying behavior can be harmful in the following scenario: For function-scope thread-local variables with non-trivial constructors, they have guard variables. In the case of x86_64 general-dynamic model: template <int N> void foo() { thread_local std::string a; } GOT[n] R_X86_64_DTPMOD64 guard variable for a GOT[n+1] R_X86_64_DTPOFF64 guard variable for a GOT[n+2] R_X86_64_DTPMOD64 a GOT[n+3] R_X86_64_DTPOFF64 a a and its guard variable are both represented as TLS variables, which should be within the same module. If one is copy relocated to the main module while the other is not, their module ID will mismatch and can cause access without prior construction. Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D50289 llvm-svn: 339042
Diffstat (limited to 'clang/unittests/Basic/VirtualFileSystemTest.cpp')
0 files changed, 0 insertions, 0 deletions