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 crtbegin*.o to get the
start address of the output .eh_frame. The relocation has an offset of 0 or
(x86-64 PC-relative leaq) -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 and -r). .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.
Original patch by Ayrton Muñoz
Only one overload is used. Remove the other one.