[PATCH] D33496: [LLD][ELF] Move creation of .ARM.exidx sentinel before LinkerScript creation
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 04:51:45 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304206: [ELF] Add .ARM.exidx sentinel section to an OutputSectionDescription (authored by psmith).
Changed prior to commit:
https://reviews.llvm.org/D33496?vs=100383&id=100688#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33496
Files:
lld/trunk/ELF/Writer.cpp
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -1206,8 +1206,6 @@
if (ErrorCount)
return;
- // So far we have added sections from input object files.
- // This function adds linker-created Out::* sections.
addPredefinedSections();
removeUnusedSyntheticSections(OutputSections);
@@ -1275,8 +1273,20 @@
// ARM ABI requires .ARM.exidx to be terminated by some piece of data.
// We have the terminater synthetic section class. Add that at the end.
auto *OS = dyn_cast_or_null<OutputSection>(findSection(".ARM.exidx"));
- if (OS && !OS->Sections.empty() && !Config->Relocatable)
- OS->addSection(make<ARMExidxSentinelSection>());
+ if (!OS || OS->Sections.empty() || Config->Relocatable)
+ return;
+
+ auto *Sentinel = make<ARMExidxSentinelSection>();
+ OS->addSection(Sentinel);
+ // If there are linker script commands existing at this point then add the
+ // sentinel to the last of these too.
+ if (OutputSectionCommand *C = Script->getCmd(OS)) {
+ auto ISD = std::find_if(C->Commands.rbegin(), C->Commands.rend(),
+ [](const BaseCommand *Base) {
+ return isa<InputSectionDescription>(Base);
+ });
+ cast<InputSectionDescription>(*ISD)->Sections.push_back(Sentinel);
+ }
}
// The linker is expected to define SECNAME_start and SECNAME_end
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33496.100688.patch
Type: text/x-patch
Size: 1488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170530/ed48f8f8/attachment.bin>
More information about the llvm-commits
mailing list