Remove another use of section names. NFC.
llvm-svn: 302662
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 78531db..e0e8069 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1057,10 +1057,10 @@
writeInt(Buf + Data->Offset, Data->Expression().getValue(), Data->Size);
}
-bool LinkerScript::hasLMA(StringRef Name) {
+bool LinkerScript::hasLMA(OutputSection *Sec) {
for (BaseCommand *Base : Opt.Commands)
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
- if (Cmd->LMAExpr && Cmd->Name == Name)
+ if (Cmd->LMAExpr && Cmd->Sec == Sec)
return true;
return false;
}
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index 5a464ce..75783fc 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -263,7 +263,7 @@
bool ignoreInterpSection();
llvm::Optional<uint32_t> getFiller(OutputSection *Sec);
- bool hasLMA(StringRef Name);
+ bool hasLMA(OutputSection *Sec);
bool shouldKeep(InputSectionBase *S);
void assignOffsets(OutputSectionCommand *Cmd);
void placeOrphanSections();
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 6c06fed..5d810a7 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1335,7 +1335,7 @@
// different flags or is loaded at a discontiguous address using AT linker
// script command.
uint64_t NewFlags = computeFlags(Sec->getPhdrFlags());
- if (Script->hasLMA(Sec->Name) || Flags != NewFlags) {
+ if (Script->hasLMA(Sec) || Flags != NewFlags) {
Load = AddHdr(PT_LOAD, NewFlags);
Flags = NewFlags;
}
@@ -1398,7 +1398,7 @@
PhdrEntry *Note = nullptr;
for (OutputSection *Sec : OutputSections) {
if (Sec->Type == SHT_NOTE) {
- if (!Note || Script->hasLMA(Sec->Name))
+ if (!Note || Script->hasLMA(Sec))
Note = AddHdr(PT_NOTE, PF_R);
Note->add(Sec);
} else {