-
Notifications
You must be signed in to change notification settings - Fork 15.7k
Open
Labels
Description
trying the large code model on some binaries, we're running into lld complaining about eh_frame_hdr values not fitting in 32 bits:
$ cat /tmp/a.c
int main() {}
$ cat /tmp/bigtext.lds
SECTIONS
{
.ltext :
{
*(.ltext)
*(.ltext.*)
. = ALIGN(4);
. = MAX(., 0x100000000);
}
}
$ clang -fuse-ld=lld -mcmodel=large -T /tmp/bigtext.lds /tmp/a.c -o /tmp/a
ld.lld: error: /tmp/a-bdc8cb.o:(.eh_frame): PC offset is too large: 0xffffffff000002ac
according to https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html, 64 bit values are allowed by specifying DW_EH_PE_sdata8
lld code that assumes 32 bit eh_frame_hdr values:
llvm-project/lld/ELF/SyntheticSections.cpp
Line 616 in 796fafe
| if (!isInt<32>(pc - va)) { |
llvm-project/lld/ELF/SyntheticSections.cpp
Line 638 in 796fafe
| hdrBuf[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; // eh_frame_ptr_enc |
would lld be ok with going to 64 bit values in eh_frame_hdr when any value doesn't fit in 32 bits?