diff options
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 7 | ||||
-rw-r--r-- | lld/ELF/LinkerScript.h | 1 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 4 |
3 files changed, 2 insertions, 10 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 37928a12c0f..e1e8c1d6885 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -1076,13 +1076,6 @@ template <class ELFT> void OutputSectionCommand::writeTo(uint8_t *Buf) { writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size); } -bool LinkerScript::hasLMA(OutputSection *Sec) { - if (OutputSectionCommand *Cmd = getCmd(Sec)) - if (Cmd->LMAExpr) - return true; - return false; -} - ExprValue LinkerScript::getSymbolValue(const Twine &Loc, StringRef S) { if (S == ".") return {CurOutSec, Dot - CurOutSec->Addr, Loc}; diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index b7a13f45f98..890ffda946a 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -276,7 +276,6 @@ public: std::vector<PhdrEntry> createPhdrs(); bool ignoreInterpSection(); - bool hasLMA(OutputSection *Sec); bool shouldKeep(InputSectionBase *S); void assignOffsets(OutputSectionCommand *Cmd); void processNonSectionCommands(); diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index e4ad76df21d..a9363a0e13e 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1473,7 +1473,7 @@ template <class ELFT> std::vector<PhdrEntry> Writer<ELFT>::createPhdrs() { // different flags or is loaded at a discontiguous address using AT linker // script command. uint64_t NewFlags = computeFlags(Sec->getPhdrFlags()); - if (Script->hasLMA(Sec) || Flags != NewFlags) { + if (Cmd->LMAExpr || Flags != NewFlags) { Load = AddHdr(PT_LOAD, NewFlags); Flags = NewFlags; } @@ -1541,7 +1541,7 @@ template <class ELFT> std::vector<PhdrEntry> Writer<ELFT>::createPhdrs() { for (OutputSectionCommand *Cmd : OutputSectionCommands) { OutputSection *Sec = Cmd->Sec; if (Sec->Type == SHT_NOTE) { - if (!Note || Script->hasLMA(Sec)) + if (!Note || Cmd->LMAExpr) Note = AddHdr(PT_NOTE, PF_R); Note->add(Sec); } else { |