diff options
author | Fangrui Song <i@maskray.me> | 2022-03-29 09:51:41 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-03-29 09:51:41 -0700 |
commit | 464531193353584cef7003c11ceffee61a7dc38a (patch) | |
tree | d6402090e1011549df7351a18729dc778a42650e /clang/lib/ExtractAPI/DeclarationFragments.cpp | |
parent | 43b34c981ad303e5e030c7c619cb54997c2fc341 (diff) | |
download | llvm-464531193353584cef7003c11ceffee61a7dc38a.zip llvm-464531193353584cef7003c11ceffee61a7dc38a.tar.gz llvm-464531193353584cef7003c11ceffee61a7dc38a.tar.bz2 |
[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations
Two code paths may reach the EHFrame case in SectionBase::getOffset:
* .eh_frame reference
* relocation copy for --emit-relocs
The first may be used by clang_rt.crtbegin.o and GCC crtbeginT.o to get the
start address of the output .eh_frame. The relocation has an offset of 0 or
(x86-64 PC-relative leaq for clang_rt.crtbegin.o) -4. The current code just
returns `offset`, which handles this case well.
The second is related to InputSection::copyRelocations on .eh_frame (used by
--emit-relocs). .eh_frame pieces may be dropped due to GC/ICF, so we should
convert the input offset to the output offset. Use the same way as
MergeInputSection with a special case handling outSecOff==-1 for an invalid
piece (see eh-frame-marker.s).
This exposes an issue in mips64-eh-abs-reloc.s that we don't reliably
handle anyway. Just add --no-check-dynamic-relocations to paper over it.
Differential Revision: https://reviews.llvm.org/D122459
Diffstat (limited to 'clang/lib/ExtractAPI/DeclarationFragments.cpp')
0 files changed, 0 insertions, 0 deletions