Remove another use of section names. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 10 May 2017 14:12:02 +0000 (14:12 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 10 May 2017 14:12:02 +0000 (14:12 +0000)
llvm-svn: 302662

lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/Writer.cpp

index 78531dbc93e61ca88a13a02c91961cd15e0c765d..e0e8069bfea596aca71a711196c7530d68ef2ffd 100644 (file)
@@ -1057,10 +1057,10 @@ void LinkerScript::writeDataBytes(OutputSection *Sec, uint8_t *Buf) {
       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;
 }
index 5a464cef84921202c559ea59e85ecf8c26ccb0b7..75783fc748c52b59e00def365f04e68af48e5fe7 100644 (file)
@@ -263,7 +263,7 @@ public:
   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();
index 6c06fed1fa0cc0c03cf87a35180ba8cc69a7b139..5d810a79c52234c15110d2f98a749cbc07cf1f5c 100644 (file)
@@ -1335,7 +1335,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->Name) || Flags != NewFlags) {
+    if (Script->hasLMA(Sec) || Flags != NewFlags) {
       Load = AddHdr(PT_LOAD, NewFlags);
       Flags = NewFlags;
     }
@@ -1398,7 +1398,7 @@ template <class ELFT> std::vector<PhdrEntry> Writer<ELFT>::createPhdrs() {
   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 {