Make OutputSections and OutputSectionCommands globals.
This is similar to what we do for InputSections and makes them easier
to access.
llvm-svn: 305337
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 8624c5d..fff1242 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -458,7 +458,7 @@
// For each OutputSection that needs a VA fabricate an OutputSectionCommand
// with an InputSectionDescription describing the InputSections
- for (OutputSection *Sec : *OutputSections) {
+ for (OutputSection *Sec : OutputSections) {
auto *OSCmd = createOutputSectionCommand(Sec->Name, "<internal>");
OSCmd->Sec = Sec;
SecToCommand[Sec] = OSCmd;
@@ -680,8 +680,8 @@
auto Pos = std::remove_if(
Opt.Commands.begin(), Opt.Commands.end(), [&](BaseCommand *Base) {
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
- return std::find(OutputSections->begin(), OutputSections->end(),
- Cmd->Sec) == OutputSections->end();
+ return std::find(OutputSections.begin(), OutputSections.end(),
+ Cmd->Sec) == OutputSections.end();
return false;
});
Opt.Commands.erase(Pos, Opt.Commands.end());
@@ -715,7 +715,7 @@
auto *OutSec = make<OutputSection>(Cmd->Name, SHT_PROGBITS, Flags);
OutSec->SectionIndex = I;
- OutputSections->push_back(OutSec);
+ OutputSections.push_back(OutSec);
Cmd->Sec = OutSec;
SecToCommand[OutSec] = Cmd;
}
@@ -826,7 +826,7 @@
++CmdIndex;
}
- for (OutputSection *Sec : *OutputSections) {
+ for (OutputSection *Sec : OutputSections) {
StringRef Name = Sec->Name;
// Find the last spot where we can insert a command and still get the
@@ -921,9 +921,7 @@
return false;
}
-void LinkerScript::assignAddresses(
- std::vector<PhdrEntry> &Phdrs,
- ArrayRef<OutputSectionCommand *> OutputSectionCommands) {
+void LinkerScript::assignAddresses(std::vector<PhdrEntry> &Phdrs) {
// Assign addresses as instructed by linker script SECTIONS sub-commands.
Dot = 0;
ErrorOnMissingSection = true;
@@ -955,8 +953,7 @@
}
// Creates program headers as instructed by PHDRS linker script command.
-std::vector<PhdrEntry> LinkerScript::createPhdrs(
- ArrayRef<OutputSectionCommand *> OutputSectionCommands) {
+std::vector<PhdrEntry> LinkerScript::createPhdrs() {
std::vector<PhdrEntry> Ret;
// Process PHDRS and FILEHDR keywords because they are not