[lld] r294054 - Don't worry about dropping SHF_MERGE.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 13:50:40 PST 2017


Author: rafael
Date: Fri Feb  3 15:50:40 2017
New Revision: 294054

URL: http://llvm.org/viewvc/llvm-project?rev=294054&view=rev
Log:
Don't worry about dropping SHF_MERGE.

Now that it doesn't impact which sections are merged, this is not a
problem.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/test/ELF/merge-string.s

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=294054&r1=294053&r2=294054&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Feb  3 15:50:40 2017
@@ -76,13 +76,6 @@ InputSectionBase<ELFT>::InputSectionBase
   if (V > UINT32_MAX)
     fatal(toString(File) + ": section sh_addralign is too large");
   Alignment = V;
-
-  // If it is not a mergeable section, overwrite the flag so that the flag
-  // is consistent with the class. This inconsistency could occur when
-  // string merging is disabled using -O0 flag.
-  if (!Config->Relocatable && !isa<MergeInputSection<ELFT>>(this) &&
-      !isa<SyntheticSection<ELFT>>(this))
-    this->Flags &= ~(SHF_MERGE | SHF_STRINGS);
 }
 
 template <class ELFT>

Modified: lld/trunk/test/ELF/merge-string.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-string.s?rev=294054&r1=294053&r2=294054&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge-string.s (original)
+++ lld/trunk/test/ELF/merge-string.s Fri Feb  3 15:50:40 2017
@@ -61,6 +61,8 @@ zed:
 // NOMERGE-NEXT: Type:    SHT_PROGBITS
 // NOMERGE-NEXT: Flags [
 // NOMERGE-NEXT:   SHF_ALLOC
+// NOMERGE-NEXT:   SHF_MERGE
+// NOMERGE-NEXT:   SHF_STRINGS
 // NOMERGE-NEXT: ]
 // NOMERGE-NEXT: Address:         0x1C8
 // NOMERGE-NEXT: Offset:  0x1C8




More information about the llvm-commits mailing list