From 55b169bf5dd84246f9d71ed6cd2b05d65e10d1fc Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 24 May 2017 18:08:04 +0000 Subject: Move writeTo to OutputSectionCommand. This reduces how many times we have to map from OutputSection to OutputSectionCommand. It is a required step to moving clearOutputSections earlier. In order to always use writeTo in OutputSectionCommand we have to call fabricateDefaultCommands for -r links and move section compression after it. llvm-svn: 303784 --- lld/ELF/LinkerScript.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lld/ELF/LinkerScript.h') diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index e85a279ca7a..e56e569d4e7 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -130,6 +130,9 @@ struct OutputSectionCommand : BaseCommand { ConstraintKind Constraint = ConstraintKind::NoConstraint; std::string Location; std::string MemoryRegionName; + + template void writeTo(uint8_t *Buf); + uint32_t getFiller(); }; // This struct represents one section match pattern in SECTIONS() command. @@ -213,7 +216,6 @@ struct ScriptConfiguration { class LinkerScript final { llvm::DenseMap SecToCommand; - OutputSectionCommand *getCmd(OutputSection *Sec) const; void assignSymbol(SymbolAssignment *Cmd, bool InSec); void setDot(Expr E, const Twine &Loc, bool InSec); @@ -244,6 +246,7 @@ class LinkerScript final { MemoryRegion *CurMemRegion = nullptr; public: + OutputSectionCommand *getCmd(OutputSection *Sec) const; bool hasPhdrsCommands() { return !Opt.PhdrsCommands.empty(); } uint64_t getDot() { return Dot; } OutputSection *getOutputSection(const Twine &Loc, StringRef S); @@ -263,7 +266,6 @@ public: std::vector createPhdrs(); bool ignoreInterpSection(); - llvm::Optional getFiller(OutputSection *Sec); bool hasLMA(OutputSection *Sec); bool shouldKeep(InputSectionBase *S); void assignOffsets(OutputSectionCommand *Cmd); @@ -272,7 +274,6 @@ public: void synchronize(); void assignAddresses(std::vector &Phdrs); - void writeDataBytes(OutputSection *Sec, uint8_t *Buf); void addSymbol(SymbolAssignment *Cmd); void processCommands(OutputSectionFactory &Factory); -- cgit v1.2.3