Issue 172777
Summary [lld/ELF] eh_frame_hdr generation only supports 32-bit values
Labels lld:ELF
Assignees
Reporter aeubanks
    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:

https://github.com/llvm/llvm-project/blob/796fafeff92fe5d2d20594859e92607116e30a16/lld/ELF/SyntheticSections.cpp#L616

https://github.com/llvm/llvm-project/blob/796fafeff92fe5d2d20594859e92607116e30a16/lld/ELF/SyntheticSections.cpp#L638

would lld be ok with going to 64 bit values in eh_frame_hdr when any value doesn't fit in 32 bits?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to