diff options
author | Jez Ng <jezng@fb.com> | 2021-01-08 18:47:40 -0500 |
---|---|---|
committer | Jez Ng <jezng@fb.com> | 2021-01-08 18:48:12 -0500 |
commit | daaaed6bb89044ac58a23f1bb1ccdd12342a5a58 (patch) | |
tree | b21d71c73d2e362f3b882ac2d8fa054b57cc0bd6 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 756dd707668ccc1ac22b88d5899984843a5a3262 (diff) | |
download | llvm-daaaed6bb89044ac58a23f1bb1ccdd12342a5a58.zip llvm-daaaed6bb89044ac58a23f1bb1ccdd12342a5a58.tar.gz llvm-daaaed6bb89044ac58a23f1bb1ccdd12342a5a58.tar.bz2 |
[lld-macho] Fix TLV data initialization
We were mishandling the case where both `__tbss` and `__thread_data` sections were
present.
TLVP relocations should be encoded as offsets from the start of `__thread_data`,
even if the symbol is actually located in `__thread_bss`. Previously, we were
writing the offset from the start of the containing section, which doesn't
really make sense since there's no way `tlv_get_addr()` can know which section a
given `tlv$init` symbol is in at runtime.
In addition, this patch ensures that we place `__thread_data` immediately before
`__thread_bss`. This is what ld64 does, likely for performance reasons. Zerofill
sections must also be at the end of their segments; we were already doing this,
but now we ensure that `__thread_bss` occurs before `__bss`, so that it's always
possible to have it contiguous with `__thread_data`.
Fixes llvm.org/PR48657.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D94329
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions