[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
Fri May 26 03:53:45 PDT 2017
peter.smith updated this revision to Diff 100383.
peter.smith added a comment.
Updated patch to use Script->getCmd(OS) as suggested.
I removed the comment "This function adds linker-created Out::* sections." as it seemed to be out of date as we don't have Out:: sections any more. I'm happy to put it back in or change it to something more specific like: " // Add any linker dependent sections that are dependent on the OutputSections"
https://reviews.llvm.org/D33496
Files:
ELF/Writer.cpp
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -1189,8 +1189,6 @@
if (ErrorCount)
return;
- // So far we have added sections from input object files.
- // This function adds linker-created Out::* sections.
addPredefinedSections();
removeUnusedSyntheticSections(OutputSections);
@@ -1258,8 +1256,17 @@
// 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 these too.
+ if (OutputSectionCommand *C = Script->getCmd(OS)) {
+ auto *ISD = make<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.100383.patch
Type: text/x-patch
Size: 1229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/35c2d04c/attachment.bin>
More information about the llvm-commits
mailing list