[PATCH] D84001: [ELF] Allow mixed SHF_LINK_ORDER & non-SHF_LINK_ORDER sections and sort within InputSectionDescription
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 18 13:52:20 PDT 2020
psmith added inline comments.
================
Comment at: lld/ELF/Writer.cpp:1632
+ // Link order may be distributed across several InputSectionDescriptions.
+ // Sorting is performed separately.
std::vector<InputSection **> scriptSections;
----------------
I think we need to be careful here. This is not a problem for .ARM.exidx as we handle it as a special case, but if we followed this pattern it could cause problems. For example a typical ld.bfd linker script has:
```
.ARM.exidx : { *(.arm.exidx) *(.arm.exidx.*) }
```
The intent is to form a single table with the sorting order considered all at once. The script above would create two InputSectionDescriptions and if sorted independently could be in the wrong order. There may be other similar cases that follow the .name and .name.suffix pattern.
A possible heuristic is that if all the input section descriptions have SHF_LINK_ORDER then consider them all at once. If there is a mix of SHF_LINK_ORDER and non SHF_LINK_ORDER then it is unlikely that the ordering requirements are being used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84001/new/
https://reviews.llvm.org/D84001
More information about the llvm-commits
mailing list