[PATCH] D27131: [ELF] - Add support of proccessing of the rest allocatable synthetic sections from linkerscript.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 28 17:17:43 PST 2016
ruiu added inline comments.
================
Comment at: ELF/LinkerScript.cpp:484-485
auto *IB = static_cast<InputSectionBase<ELFT> *>(ID);
+ // OutSec can be null when synthetic section listed under
+ // output section command was removed because was not needed.
+ if (!IB->OutSec)
----------------
More explicit code would be easier to understand.
// We tentatively added all synthetic sections at the beginning and removed
// empty ones afterwards (because there is no way to know whether they were
// going be empty or not other than actually running linker scripts.)
// We need to ignore remains of empty sections.
if (auto *Sec = SyntheticSection<ELFT>(ID))
if (Sec->empty())
continue;
================
Comment at: ELF/Writer.cpp:256
- if (Config->EhFrameHdr)
- In<ELFT>::EhFrameHdr = make<EhFrameHeader<ELFT>>();
-
- if (Config->GdbIndex)
- In<ELFT>::GdbIndex = make<GdbIndexSection<ELFT>>();
+ // Initialize linker generated sections
+ if (!Config->Relocatable)
----------------
Remove this comment because throughout this function we initialize linker generated sections.
================
Comment at: ELF/Writer.cpp:340
+ // We always need to add rel[a].plt to output if it has entries.
+ // Even during static linking it can contain R_[*]_IRELATIVE relocations.
+ In<ELFT>::RelaPlt = make<RelocationSection<ELFT>>(
----------------
Even for ...
================
Comment at: ELF/Writer.cpp:922-923
std::find(OutSec->Sections.begin(), OutSec->Sections.end(), SS));
+ // Mark section as unused to stop finalizing it and proccessing from script.
+ SS->OutSec = nullptr;
// If there is no other sections in output section, remove it from output.
----------------
I don't think using this as a marker is a good idea. Please read the above comment.
================
Comment at: ELF/Writer.cpp:1025-1027
+ addInputSec(In<ELFT>::SymTab);
+ addInputSec(In<ELFT>::ShStrTab);
+ addInputSec(In<ELFT>::StrTab);
----------------
I do not understand why only these sections are handled in this function. Is there any reason you can't add them in createSyntheticSections?
https://reviews.llvm.org/D27131
More information about the llvm-commits
mailing list