This is not technically required, but glibc unwind-dw2-fde.c classify_object_over_fdes expects there is a CIE record length 0 as a terminator.
Details
Diff Detail
- Repository
- rLLD LLVM Linker
Event Timeline
I would like tounderstand why this is needed.
You wrote: "This is not technically required, but glibc unwind-dw2-fde.c classify_object_over_fdes expects there is a CIE record length 0 as a terminator.".
Can you please point me on a line of code in glibc that needs this change in the linker? What is the current behavior of LLD linked binaries?
ELF/SyntheticSections.cpp | ||
---|---|---|
502 | I think would be nice for that comment to contain some additional information, like:
|
https://code.woboq.org/userspace/glibc/sysdeps/generic/unwind-dw2-fde.c.html#645
for (; ! last_fde (ob, this_fde); this_fde = next_fde (this_fde))
last_fde is defined at https://code.woboq.org/userspace/glibc/sysdeps/generic/unwind-dw2-fde.h.html#162 . It does not check whether it reaches the end of .eh_frame (DWARF2_OBJECT_END_PTR_EXTENSION seems not defined). If there is no length=0 terminator, the pointer will run beyond the end of .eh_frame and run into successive sections (out-of-bound read), segfault or stop somewhere. This issue is usually latent/benign and I can only catch this in some internal statically-linked configuration. I don't have time to read the whole source code of how glibc/libgcc_s libunwind to understand why this routine is sometimes called but sometimes not.
This is not a bug in glibc if we don't take behavior difference as a bug. bfd/gold seem to add a CIE of length=0 anyway so this piece of glibc/libgcc_s libunwind code won't go wrong.
one -> a terminator