[PATCH] D24258: [ARM][LLD] Add support for .ARM.exidx sections

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 04:07:35 PDT 2016


peter.smith added a comment.

I think the approach in https://reviews.llvm.org/D24277 will work for executables, but it won't be sufficient to produce relocatable object files with SHF_LINK_ORDER dependencies.

I'll state what I think a linker has to do to support exceptions:

Garbage collection:
There are no relocations to any .ARM.exidx section so at a minimum they must be marked live.

Output Sections:
For a full link there must be one .ARM.exidx OutputSection containing all input .ARM.exidx sections with table entries in the same order as the functions described by the table entries.

For a relocatable link (ABI compliant) the output object must have an .ARM.exidx OutputSection for each executable OutputSection that has exeception tables. The .ARM.exidx OutputSection has SHF_LINK_ORDER and a sh_link field to the OutputSection. The table entries must be in the same order as the functions in the executable OutputSection

For a relocatable link (Consumable by lld only if it sorts the individual table entries) the output object must preserve the .ARM.exidx OutputSection name.

Program Headers
In an executable and shared object, the linker generates a PT_ARM_EXIDX program header that has the same address and size as the .ARM.exidx section.

The part that requires most of the code for SHF_LINK_ORDER is the ABI compliant relocatable object. If this is implemented then executables/shared objects drop out for free.

I could do another rewrite with a sorting of each individual entry rather than section. The actual table entry is not set up to do this easily although it is possible (see comment in https://reviews.llvm.org/D24277). With the small parts for garbage collection and PT_ARM_EXIDX that would give executable support, and relocatable support for lld, however the relocatable objects wouldn't be consumable by other linkers.

Personally I'd like maintain ABI compatibility so that relocatable output can be consumed by other linkers such as ld and gold. In theory it should be possible to use a similar approach to https://reviews.llvm.org/D24277 and set the sh_link field. I'm not sure it will be much simpler than what I have now or in the previous review though.

I'll be out of the office till next Monday, I'll pick up any comments when I'm back.


https://reviews.llvm.org/D24258





More information about the llvm-commits mailing list