[PATCH] D14140: [ELF2] SECTIONS command basic support
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 3 11:13:07 PST 2015
ruiu added inline comments.
================
Comment at: ELF/Writer.cpp:550-557
@@ -515,8 +549,10 @@
// we can correctly decide if a dynamic relocation is needed.
- for (const std::unique_ptr<ObjectFile<ELFT>> &F : Symtab.getObjectFiles())
- for (InputSectionBase<ELFT> *B : F->getSections())
- if (auto *S = dyn_cast_or_null<InputSection<ELFT>>(B))
- if (S != &InputSection<ELFT>::Discarded)
- if (S->isLive())
- scanRelocs(*S);
+ for (const std::unique_ptr<ObjectFile<ELFT>> &F : Symtab.getObjectFiles()) {
+ for (InputSectionBase<ELFT> *C : F->getSections()) {
+ if (isDiscarded(C))
+ continue;
+ if (auto *S = dyn_cast<InputSection<ELFT>>(C))
+ scanRelocs(*S);
+ }
+ }
----------------
for (const std::unique_ptr<ObjectFile<ELFT>> &F : Symtab.getObjectFiles())
for (InputSectionBase<ELFT> *C : F->getSections())
if (!isDiscarded(C))
if (auto *S = dyn_cast<InputSection<ELFT>>(C))
scanRelocs(*S);
================
Comment at: ELF/Writer.cpp:906-911
@@ -869,1 +905,8 @@
+template <class ELFT> void Writer<ELFT>::parseSectionDescriptions() {
+ for (const std::pair<StringRef, OutputSectionDescription> &OutSec :
+ Config->OutputSections)
+ for (StringRef Name : OutSec.second.InputSectionNames)
+ InputToOutputSection[Name] = OutSec.second.Name;
+}
+
----------------
Looks like OutputSectionDescription doesn't have to be a struct. We can make Config->OutputSections of type StringMap<StringRef> which maps input section names to output section names.
http://reviews.llvm.org/D14140
More information about the llvm-commits
mailing list