summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.h
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/LinkerScript.h')
-rw-r--r--lld/ELF/LinkerScript.h75
1 files changed, 38 insertions, 37 deletions
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index fa8b4ce4ebd..3180f9913f1 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -229,6 +229,24 @@ extern ScriptConfiguration *ScriptConfig;
class LinkerScriptBase {
protected:
~LinkerScriptBase() = default;
+
+ void assignSymbol(SymbolAssignment *Cmd, bool InSec = false);
+ void computeInputSections(InputSectionDescription *);
+ void setDot(Expr E, const Twine &Loc, bool InSec = false);
+
+ std::vector<InputSectionBase *>
+ createInputSectionList(OutputSectionCommand &Cmd);
+
+ std::vector<size_t> getPhdrIndices(StringRef SectionName);
+ size_t getPhdrIndex(const Twine &Loc, StringRef PhdrName);
+
+ MemoryRegion *findMemoryRegion(OutputSectionCommand *Cmd, OutputSection *Sec);
+
+ void switchTo(OutputSection *Sec);
+ void flush();
+ void output(InputSection *Sec);
+ void process(BaseCommand &Base);
+
OutputSection *Aether;
// "ScriptConfig" is a bit too long, so define a short name for it.
@@ -237,6 +255,13 @@ protected:
uint64_t Dot;
uint64_t ThreadBssOffset = 0;
+ std::function<uint64_t()> LMAOffset;
+ OutputSection *CurOutSec = nullptr;
+ MemoryRegion *CurMemRegion = nullptr;
+
+ llvm::DenseSet<OutputSection *> AlreadyOutputOS;
+ llvm::DenseSet<InputSectionBase *> AlreadyOutputIS;
+
public:
bool hasPhdrsCommands() { return !Opt.PhdrsCommands.empty(); }
uint64_t getDot() { return Dot; }
@@ -249,15 +274,6 @@ public:
virtual OutputSection *getSymbolSection(StringRef S) = 0;
std::vector<OutputSection *> *OutputSections;
-};
-
-// This is a runner of the linker script.
-template <class ELFT> class LinkerScript final : public LinkerScriptBase {
-public:
- LinkerScript();
- ~LinkerScript();
-
- void processCommands(OutputSectionFactory &Factory);
void addOrphanSections(OutputSectionFactory &Factory);
void removeEmptyCommands();
void adjustSectionsBeforeSorting();
@@ -267,44 +283,29 @@ public:
bool ignoreInterpSection();
uint32_t getFiller(StringRef Name);
- void writeDataBytes(StringRef Name, uint8_t *Buf);
bool hasLMA(StringRef Name);
bool shouldKeep(InputSectionBase *S);
void assignOffsets(OutputSectionCommand *Cmd);
void placeOrphanSections();
void assignAddresses(std::vector<PhdrEntry> &Phdrs);
- uint64_t getSymbolValue(const Twine &Loc, StringRef S) override;
- bool isDefined(StringRef S) override;
- bool isAbsolute(StringRef S) override;
- OutputSection *getSymbolSection(StringRef S) override;
-
int getSectionIndex(StringRef Name);
+};
-private:
- void assignSymbol(SymbolAssignment *Cmd, bool InSec = false);
- void addSymbol(SymbolAssignment *Cmd);
- void computeInputSections(InputSectionDescription *);
- void setDot(Expr E, const Twine &Loc, bool InSec = false);
+// This is a runner of the linker script.
+template <class ELFT> class LinkerScript final : public LinkerScriptBase {
+public:
+ LinkerScript();
+ ~LinkerScript();
+ void writeDataBytes(StringRef Name, uint8_t *Buf);
+ void addSymbol(SymbolAssignment *Cmd);
void discard(ArrayRef<InputSectionBase *> V);
+ void processCommands(OutputSectionFactory &Factory);
- std::vector<InputSectionBase *>
- createInputSectionList(OutputSectionCommand &Cmd);
-
- std::vector<size_t> getPhdrIndices(StringRef SectionName);
- size_t getPhdrIndex(const Twine &Loc, StringRef PhdrName);
-
- MemoryRegion *findMemoryRegion(OutputSectionCommand *Cmd, OutputSection *Sec);
-
- std::function<uint64_t()> LMAOffset;
- OutputSection *CurOutSec = nullptr;
- MemoryRegion *CurMemRegion = nullptr;
- void switchTo(OutputSection *Sec);
- void flush();
- void output(InputSection *Sec);
- void process(BaseCommand &Base);
- llvm::DenseSet<OutputSection *> AlreadyOutputOS;
- llvm::DenseSet<InputSectionBase *> AlreadyOutputIS;
+ uint64_t getSymbolValue(const Twine &Loc, StringRef S) override;
+ bool isDefined(StringRef S) override;
+ bool isAbsolute(StringRef S) override;
+ OutputSection *getSymbolSection(StringRef S) override;
};
// Variable template is a C++14 feature, so we can't template
OpenPOWER on IntegriCloud