Re: [rfc/rfa] Use ARM exception tables as GDB unwinder

Ulrich Weigand
2010-10-21T22:26:17Z

Dan Jacobowitz wrote:
> No, this is not the case. The linker is supposed to fix it up:
>
> /* Scan .ARM.exidx tables, and create a list describing edits which should be
> made to those tables, such that:
>
> 1. Regions without unwind data are marked with EXIDX_CANTUNWIND entries.
> 2. Duplicate entries are merged together (EXIDX_CANTUNWIND, or unwind
> codes which have been inlined into the index).
>
> If MERGE_EXIDX_ENTRIES is false, duplicate entries are not merged.
>
> The edits are applied when the tables are written
> (in elf32_arm_write_section).
> */
>
> If it's not doing that, we should figure out why - it can lead to
> crashes in libgcc, if the unwinder is invoked, rather than the correct
> failure to unwind.
>
> I think 2.19 didn't do this but 2.20 did.

Well, the function elf32_arm_fix_exidx_coverage you refer to above is
never called for a relocatable link ...

Unfortunately, the glibc link process works like this (abbreviated):
- build all the objects (some with exidx, some without)
- collect objects into an archive libc_pic.a
- do a relocatable link: -o libc_pic.os -r --whole-archive libc_pic.a
- build shared object: -o libc.so -shared ... libc_pic.os ...

The relocatable link step concatenates the text sections of objects
with exidx and those without, but does not call any special fixup
routine, so no EXIDX_CANTUNWIND entries are inserted.

The shared object final link step *does* run the fixup routine, but
since it now only sees a single big text section, it doesn't fix up
anything ...