aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2023-06-22 10:03:17 -0700
committerFangrui Song <i@maskray.me>2023-06-22 10:03:17 -0700
commitbef8294650f0119238830d73a7527023c7c8a97f (patch)
tree75478b04364bc38e4a724225b7cf011d68ec28c0 /clang/lib/Basic/IdentifierTable.cpp
parentd2fafa79ef08f9ef9cd0108a6caa7fc61a31bdeb (diff)
downloadllvm-bef8294650f0119238830d73a7527023c7c8a97f.zip
llvm-bef8294650f0119238830d73a7527023c7c8a97f.tar.gz
llvm-bef8294650f0119238830d73a7527023c7c8a97f.tar.bz2
[XRay] Make xray_instr_map compatible with Mach-O
The `__DATA,xray_instr_map` section has label differences like `.quad Lxray_sled_0-Ltmp0` that is represented as a pair of UNSIGNED and SUBTRACTOR relocations. LLVM integrated assembler attempts to rewrite A-B into A-B'+offset where B' can be included in the symbol table. B' is called an atom and should be a non-temporary symbol in the same section. However, since `xray_instr_map` does not define a non-temporary symbol, the SUBTRACTOR relocation will have no associated symbol, and its `r_extern` value will be 0. Therefore, we will see linker errors like: error: SUBTRACTOR relocation must be extern at offset 0 of __DATA,xray_instr_map in a.o To fix this issue, we need to define a non-temporary symbol in the section. We can accomplish this by renaming `Lxray_sleds_start0` to `lxray_sleds_start0` ("L" to "l"). `lxray_sleds_start0` serves as the atom for this dead-strippable subsection. With the `S_ATTR_LIVE_SUPPORT` attribute, `ld -dead_strip` will retain subsections that reference live functions. Special thanks to Oleksii Lozovskyi for reporting the issue and providing initial analysis. Differential Revision: https://reviews.llvm.org/D153239
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
0 files changed, 0 insertions, 0 deletions