void addStartStopSymbols(OutputSection *Sec);
uint64_t getEntryAddr();
OutputSection *findSection(StringRef Name);
- OutputSectionCommand *findSectionInScript(StringRef Name);
+ OutputSection *findSectionInScript(StringRef Name);
+ OutputSectionCommand *findSectionCommand(StringRef Name);
std::vector<PhdrEntry> Phdrs;
}
template <class ELFT>
-OutputSectionCommand *Writer<ELFT>::findSectionInScript(StringRef Name) {
+OutputSectionCommand *Writer<ELFT>::findSectionCommand(StringRef Name) {
for (BaseCommand *Base : Script->Opt.Commands)
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
if (Cmd->Name == Name)
return nullptr;
}
+template <class ELFT> OutputSection *Writer<ELFT>::findSectionInScript(StringRef Name) {
+ if (OutputSectionCommand *Cmd = findSectionCommand(Name))
+ return Cmd->Sec;
+ return nullptr;
+}
+
template <class ELFT> OutputSection *Writer<ELFT>::findSection(StringRef Name) {
for (OutputSection *Sec : OutputSections)
if (Sec->Name == Name)
return Addr;
// Case 4
- if (OutputSection *Sec = findSection(".text")) {
+ if (OutputSection *Sec = findSectionInScript(".text")) {
if (Config->WarnMissingEntry)
warn("cannot find entry symbol " + Config->Entry + "; defaulting to 0x" +
utohexstr(Sec->Addr));
}
if (ElfSym::Bss)
- ElfSym::Bss->Section = findSection(".bss");
+ ElfSym::Bss->Section = findSectionInScript(".bss");
// Setup MIPS _gp_disp/__gnu_local_gp symbols which should
// be equal to the _gp symbol's value.
// PPC64 needs to process relocations in the .opd section
// before processing relocations in code-containing sections.
- if (auto *OpdCmd = findSectionInScript(".opd")) {
+ if (auto *OpdCmd = findSectionCommand(".opd")) {
Out::Opd = OpdCmd->Sec;
Out::OpdBuf = Buf + Out::Opd->Offset;
OpdCmd->template writeTo<ELFT>(Buf + Out::Opd->Offset);