Make elf::ScriptConfig a LinkerScript class member variable.
LinkerScript used to be a template class, so we couldn't instantiate
that class in elf::link. We instantiated ScriptConfig class earlier
instead so that the linker script parser can store configurations to
the object.
Now that LinkerScript is not a template, it doesn't make sense to
separate ScriptConfig from LinkerScript. This patch merges them.
llvm-svn: 298457
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index 38c89ec..00e4f9e 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -219,8 +219,6 @@
llvm::DenseMap<llvm::StringRef, MemoryRegion> MemoryRegions;
};
-extern ScriptConfiguration *ScriptConfig;
-
class LinkerScript {
protected:
void assignSymbol(SymbolAssignment *Cmd, bool InSec = false);
@@ -243,9 +241,6 @@
OutputSection *Aether;
bool ErrorOnMissingSection = false;
- // "ScriptConfig" is a bit too long, so define a short name for it.
- ScriptConfiguration &Opt = *ScriptConfig;
-
uint64_t Dot;
uint64_t ThreadBssOffset = 0;
@@ -287,6 +282,9 @@
void writeDataBytes(StringRef Name, uint8_t *Buf);
void addSymbol(SymbolAssignment *Cmd);
void processCommands(OutputSectionFactory &Factory);
+
+ // Parsed linker script configurations are set to this struct.
+ ScriptConfiguration Opt;
};
extern LinkerScript *Script;