[PATCH] D78422: [LLD][ELF][ARM] Fix ARM Exidx order for non monotonic section order

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 03:46:04 PDT 2020


psmith created this revision.
psmith added reviewers: MaskRay, grimar, ruiu.
Herald added subscribers: danielkiss, kristof.beyls, arichardson, emaste.
Herald added a reviewer: espindola.

The contents of the .ARM.exidx section must be ordered by SHF_LINK_ORDER rules. We don't need to know the precise address for this order, but we do need to know the relative order of sections. We have been using the sectionIndex for this purpose, this works when the OutputSection order has a monotonically increasing virtual address, but it is possible to write a linker script with non-monotonically increasing virtual address. For these cases we need to evaluate the base address of the OutputSection so that we can order the .ARM.exidx sections properly.

This change moves the finalisation of .ARM.exidx till after the first call to AssignAddresses. This permits us to sort on virtual address which is linker script safe. It also permits a fix for part of pr44824 where we generate .ARM.exidx section for the vector table when that table is so far away it is out of range of the .ARM.exidx section. This fix will come in a follow up patch.

I think that this also affects the standard SHF_LINK_ORDER, I think resolveSHFLinkOrder() probably needs to be moved to a similar place.


https://reviews.llvm.org/D78422

Files:
  lld/ELF/SyntheticSections.cpp
  lld/ELF/Writer.cpp
  lld/test/ELF/arm-exidx-script-order.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78422.258505.patch
Type: text/x-patch
Size: 4328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200418/4c96c46f/attachment.bin>


More information about the llvm-commits mailing list