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

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 09:07:06 PDT 2016


peter.smith created this revision.
peter.smith added reviewers: ruiu, rafael, grimar.
peter.smith added subscribers: llvm-commits, rengolin.
Herald added subscribers: samparker, aemerson.

This is a rewrite of the abandoned revision https://reviews.llvm.org/D24032 Add support for SHF_LINK_ORDER flag to ARM Target.

Instead of introducing SHF_LINK_ORDER as a general feature we just implement support for .ARM.exidx  sections.  This is done by creating a subclass of InputSectionBase and OutputSectionBase to handle the special case code.

I've taken the opportunity to add support for the PT_ARM_EXIDX program header as it is much simpler with this design. The PT_ARM_EXIDX program header is similar to the PT_GNU_EH_FRAME. This can easily be added as a separate patch, but it would mean updating the offsets in the test.  

With .ARM.exidx support implemented all that should be needed for ARM exceptions support is to add support for the R_ARM_TARGET2 relocation, which should be straightforward.

References:
ARM exception handling ABI http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
ELF for the ARM Architecture http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf

Limitations that can be addressed in the future:
- Garbage collection can be optimized with a similar special case to the .eh_frame section. A .ARM.exidx section should be live only when the executable section it links to is live.
- Linker scripts assume that all InputSections assigned to an OutputSection are the same class. A contrived linker script such as  
SECTIONS {
    .text : { *(.text) *(.eh_frame*) }
}
Will give an internal fault rather than an error. This also affects .ARM.exidx sections mixed with regular OutputSections
- Table compression is not implemented. The EHABI permits adjacent table entries to be folded if they have the same unwinding instructions. Compressing the table will alter the size of the OutputSection which can't be done safely in writeTo().

https://reviews.llvm.org/D24258

Files:
  ELF/InputFiles.cpp
  ELF/InputSection.cpp
  ELF/InputSection.h
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/Writer.cpp
  test/ELF/Inputs/arm-exidx-cantunwind.s
  test/ELF/arm-exidx-order.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24258.70407.patch
Type: text/x-patch
Size: 24459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160906/33ff7677/attachment.bin>


More information about the llvm-commits mailing list