diff options
author | Fangrui Song <i@maskray.me> | 2023-02-03 10:27:33 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2023-02-03 10:27:33 -0800 |
commit | 08c915fa76ef91efa16df0676ed69e4fb360989f (patch) | |
tree | 2e9085561da5e03a3ed0c6769d6d963c54fd6e98 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 98f0e4f611b40c902cb0df3ef080ae2c00e862d4 (diff) | |
download | llvm-08c915fa76ef91efa16df0676ed69e4fb360989f.zip llvm-08c915fa76ef91efa16df0676ed69e4fb360989f.tar.gz llvm-08c915fa76ef91efa16df0676ed69e4fb360989f.tar.bz2 |
[ELF] -z notext: avoid dynamic relocations in .eh_frame
Fix https://github.com/llvm/llvm-project/issues/60392
```
// a.cc
void raise() { throw 42; }
bool foo() {
try { raise(); } catch (int) { return true; }
return false;
}
int main() { foo(); }
```
```
clang++ --target=x86_64-linux-gnu -fno-pic -mcmodel=large -no-pie -fuse-ld=lld -z notext a.cc -o a && ./a
clang++ --target=aarch64-linux-gnu -fno-pic -no-pie -fuse-ld=lld -Wl,--dynamic-linker=/usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 -Wl,-rpath=/usr/aarch64-linux-gnu/lib -z notext a.cc -o a && ./a
```
Both commands fail because we produce a dynamic relocation for
R_X86_64_64/R_AARCH64_ABS64 in .eh_frame which will be adjusted to a wrong
offset by `SectionBase::getOffset` after D122459.
Since GNU ld uses a canonical PLT entry instead of a dynamic relocation for
.eh_frame, we follow suit as well to avoid the issue.
Mips has an ABI issue (https://github.com/llvm/llvm-project/issues/5837) and we
don't implement GNU ld's DW_EH_PE_absptr conversion. mips64-eh-abs-reloc.s wants
a dynamic relocation, so keep the original behavior for EM_MIPS.
Differential Revision: https://reviews.llvm.org/D143136
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions