[all-commits] [llvm/llvm-project] daaaed: [lld-macho] Fix TLV data initialization
Jez Ng via All-commits
all-commits at lists.llvm.org
Fri Jan 8 15:48:33 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: daaaed6bb89044ac58a23f1bb1ccdd12342a5a58
https://github.com/llvm/llvm-project/commit/daaaed6bb89044ac58a23f1bb1ccdd12342a5a58
Author: Jez Ng <jezng at fb.com>
Date: 2021-01-08 (Fri, 08 Jan 2021)
Changed paths:
M lld/MachO/InputSection.cpp
M lld/MachO/InputSection.h
M lld/MachO/Writer.cpp
M lld/MachO/Writer.h
M lld/test/MachO/bss.s
M lld/test/MachO/tlv.s
Log Message:
-----------
[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
More information about the All-commits
mailing list