<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 3, 2015 at 1:35 PM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Tue Nov  3 15:35:14 2015<br>
New Revision: 251980<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=251980&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=251980&view=rev</a><br>
Log:<br>
Create .bss only when needed.<br>
<br>
This is a small complication, but produces nicer output and is a step to<br>
handling zero size sections uniformly.<br>
<br>
Modified:<br>
    lld/trunk/ELF/OutputSections.h<br>
    lld/trunk/ELF/Writer.cpp<br>
    lld/trunk/test/elf2/basic-aarch64.s<br>
    lld/trunk/test/elf2/basic.s<br>
    lld/trunk/test/elf2/basic32.s<br>
    lld/trunk/test/elf2/basic64be.s<br>
    lld/trunk/test/elf2/merge-shared.s<br>
    lld/trunk/test/elf2/string-table.s<br>
    lld/trunk/test/elf2/tls.s<br>
<br>
Modified: lld/trunk/ELF/OutputSections.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/OutputSections.h (original)<br>
+++ lld/trunk/ELF/OutputSections.h Tue Nov  3 15:35:14 2015<br>
@@ -378,7 +378,7 @@ template <class ELFT> GotPltSection<ELFT<br>
 template <class ELFT> GotSection<ELFT> *Out<ELFT>::Got;<br>
 template <class ELFT> HashTableSection<ELFT> *Out<ELFT>::HashTab;<br>
 template <class ELFT> InterpSection<ELFT> *Out<ELFT>::Interp;<br>
-template <class ELFT> OutputSection<ELFT> *Out<ELFT>::Bss;<br>
+template <class ELFT> OutputSection<ELFT> *Out<ELFT>::Bss = nullptr;<br></blockquote><div><br></div><div>You can remove "= nullptr". We don't do that for other fields of Out class, expecting that global variables are initialized to zero.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::Opd;<br>
 template <class ELFT> uint8_t *Out<ELFT>::OpdBuf;<br>
 template <class ELFT> PltSection<ELFT> *Out<ELFT>::Plt;<br>
<br>
Modified: lld/trunk/ELF/Writer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Writer.cpp (original)<br>
+++ lld/trunk/ELF/Writer.cpp Tue Nov  3 15:35:14 2015<br>
@@ -60,6 +60,10 @@ private:<br>
   uintX_t getEntryAddr() const;<br>
   int getPhdrsNum() const;<br>
<br>
+  OutputSection<ELFT> *getBSS();<br>
+  void addCommonSymbols(std::vector<DefinedCommon<ELFT> *> &Syms);<br>
+  void addSharedCopySymbols(std::vector<SharedSymbol<ELFT> *> &Syms);<br>
+<br>
   std::unique_ptr<llvm::FileOutputBuffer> Buffer;<br>
<br>
   SpecificBumpPtrAllocator<OutputSection<ELFT>> SecAlloc;<br>
@@ -93,8 +97,6 @@ template <class ELFT> void lld::elf2::wr<br>
     Out<ELFT>::StrTab = &StrTab;<br>
   StringTableSection<ELFT> DynStrTab(".dynstr", true);<br>
   Out<ELFT>::DynStrTab = &DynStrTab;<br>
-  OutputSection<ELFT> Bss(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE);<br>
-  Out<ELFT>::Bss = &Bss;<br>
   GotSection<ELFT> Got;<br>
   Out<ELFT>::Got = &Got;<br>
   GotPltSection<ELFT> GotPlt;<br>
@@ -375,13 +377,25 @@ static bool compareOutputSections(Output<br>
   return false;<br>
 }<br>
<br>
+template <class ELFT> OutputSection<ELFT> *Writer<ELFT>::getBSS() {<br>
+  if (!Out<ELFT>::Bss) {<br>
+    Out<ELFT>::Bss = new (SecAlloc.Allocate())<br>
+        OutputSection<ELFT>(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE);<br>
+    OutputSections.push_back(Out<ELFT>::Bss);<br>
+  }<br>
+  return Out<ELFT>::Bss;<br>
+}<br>
+<br>
 // Until this function is called, common symbols do not belong to any section.<br>
 // This function adds them to end of BSS section.<br>
 template <class ELFT><br>
-static void addCommonSymbols(std::vector<DefinedCommon<ELFT> *> &Syms) {<br>
+void Writer<ELFT>::addCommonSymbols(std::vector<DefinedCommon<ELFT> *> &Syms) {<br>
   typedef typename ELFFile<ELFT>::uintX_t uintX_t;<br>
   typedef typename ELFFile<ELFT>::Elf_Sym Elf_Sym;<br>
<br>
+  if (Syms.empty())<br>
+    return;<br>
+<br>
   // Sort the common symbols by alignment as an heuristic to pack them better.<br>
   std::stable_sort(<br>
     Syms.begin(), Syms.end(),<br>
@@ -389,7 +403,7 @@ static void addCommonSymbols(std::vector<br>
       return A->MaxAlignment > B->MaxAlignment;<br>
     });<br>
<br>
-  uintX_t Off = Out<ELFT>::Bss->getSize();<br>
+  uintX_t Off = getBSS()->getSize();<br>
   for (DefinedCommon<ELFT> *C : Syms) {<br>
     const Elf_Sym &Sym = C->Sym;<br>
     uintX_t Align = C->MaxAlignment;<br>
@@ -402,12 +416,16 @@ static void addCommonSymbols(std::vector<br>
 }<br>
<br>
 template <class ELFT><br>
-static void addSharedCopySymbols(std::vector<SharedSymbol<ELFT> *> &Syms) {<br>
+void Writer<ELFT>::addSharedCopySymbols(<br>
+    std::vector<SharedSymbol<ELFT> *> &Syms) {<br>
   typedef typename ELFFile<ELFT>::uintX_t uintX_t;<br>
   typedef typename ELFFile<ELFT>::Elf_Sym Elf_Sym;<br>
   typedef typename ELFFile<ELFT>::Elf_Shdr Elf_Shdr;<br>
<br>
-  uintX_t Off = Out<ELFT>::Bss->getSize();<br>
+  if (Syms.empty())<br>
+    return;<br>
+<br>
+  uintX_t Off = getBSS()->getSize();<br>
   for (SharedSymbol<ELFT> *C : Syms) {<br>
     const Elf_Sym &Sym = C->Sym;<br>
     const Elf_Shdr *Sec = C->File->getSection(Sym);<br>
@@ -443,10 +461,6 @@ template <class ELFT> void Writer<ELFT>:<br>
<br>
   SmallDenseMap<SectionKey<ELFT::Is64Bits>, OutputSectionBase<ELFT> *> Map;<br>
<br>
-  OutputSections.push_back(Out<ELFT>::Bss);<br>
-  Map[{Out<ELFT>::Bss->getName(), Out<ELFT>::Bss->getType(),<br>
-       Out<ELFT>::Bss->getFlags(), 0}] = Out<ELFT>::Bss;<br>
-<br>
   std::vector<OutputSectionBase<ELFT> *> RegularSections;<br>
<br>
   for (const std::unique_ptr<ObjectFile<ELFT>> &F : Symtab.getObjectFiles()) {<br>
@@ -481,6 +495,9 @@ template <class ELFT> void Writer<ELFT>:<br>
     }<br>
   }<br>
<br>
+  Out<ELFT>::Bss = static_cast<OutputSection<ELFT> *>(<br>
+      Map[{".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE, 0}]);<br>
+<br>
   Out<ELFT>::Dynamic->PreInitArraySec = Map.lookup(<br>
       {".preinit_array", SHT_PREINIT_ARRAY, SHF_WRITE | SHF_ALLOC, 0});<br>
   Out<ELFT>::Dynamic->InitArraySec =<br>
<br>
Modified: lld/trunk/test/elf2/basic-aarch64.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic-aarch64.s?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic-aarch64.s?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf2/basic-aarch64.s (original)<br>
+++ lld/trunk/test/elf2/basic-aarch64.s Tue Nov  3 15:35:14 2015<br>
@@ -26,15 +26,15 @@ _start:<br>
 # CHECK-NEXT:   Version: 1<br>
 # CHECK-NEXT:   Entry: [[ENTRY:0x[0-9A-F]+]]<br>
 # CHECK-NEXT:   ProgramHeaderOffset: 0x40<br>
-# CHECK-NEXT:   SectionHeaderOffset: 0x1090<br>
+# CHECK-NEXT:   SectionHeaderOffset: 0x1088<br>
 # CHECK-NEXT:   Flags [ (0x0)<br>
 # CHECK-NEXT:   ]<br>
 # CHECK-NEXT:   HeaderSize: 64<br>
 # CHECK-NEXT:   ProgramHeaderEntrySize: 56<br>
 # CHECK-NEXT:   ProgramHeaderCount: 3<br>
 # CHECK-NEXT:   SectionHeaderEntrySize: 64<br>
-# CHECK-NEXT:   SectionHeaderCount: 6<br>
-# CHECK-NEXT:   StringTableSectionIndex: 4<br>
+# CHECK-NEXT:   SectionHeaderCount: 5<br>
+# CHECK-NEXT:   StringTableSectionIndex: 3<br>
 # CHECK-NEXT: }<br>
 # CHECK-NEXT: Sections [<br>
 # CHECK-NEXT:   Section {<br>
@@ -69,22 +69,6 @@ _start:<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
 # CHECK-NEXT:     Index: 2<br>
-# CHECK-NEXT:     Name: .bss<br>
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)<br>
-# CHECK-NEXT:     Flags [ (0x3)<br>
-# CHECK-NEXT:       SHF_ALLOC (0x2)<br>
-# CHECK-NEXT:       SHF_WRITE (0x1)<br>
-# CHECK-NEXT:     ]<br>
-# CHECK-NEXT:     Address: 0x1100C<br>
-# CHECK-NEXT:     Offset: 0x100C<br>
-# CHECK-NEXT:     Size: 0<br>
-# CHECK-NEXT:     Link: 0<br>
-# CHECK-NEXT:     Info: 0<br>
-# CHECK-NEXT:     AddressAlignment: 0<br>
-# CHECK-NEXT:     EntrySize: 0<br>
-# CHECK-NEXT:   }<br>
-# CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 3<br>
 # CHECK-NEXT:     Name: .symtab<br>
 # CHECK-NEXT:     Type: SHT_SYMTAB (0x2)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
@@ -92,33 +76,33 @@ _start:<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x1010<br>
 # CHECK-NEXT:     Size: 72<br>
-# CHECK-NEXT:     Link: 5<br>
+# CHECK-NEXT:     Link: 4<br>
 # CHECK-NEXT:     Info: 2<br>
 # CHECK-NEXT:     AddressAlignment: 8<br>
 # CHECK-NEXT:     EntrySize: 24<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 4<br>
+# CHECK-NEXT:     Index: 3<br>
 # CHECK-NEXT:     Name: .shstrtab<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x1058<br>
-# CHECK-NEXT:     Size: 38<br>
+# CHECK-NEXT:     Size: 33<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
 # CHECK-NEXT:     AddressAlignment: 1<br>
 # CHECK-NEXT:     EntrySize: 0<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 5<br>
-# CHECK-NEXT:     Name: .strtab (22)<br>
+# CHECK-NEXT:     Index: 4<br>
+# CHECK-NEXT:     Name: .strtab (17)<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
-# CHECK-NEXT:     Offset: 0x107E<br>
+# CHECK-NEXT:     Offset: 0x1079<br>
 # CHECK-NEXT:     Size: 13<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
<br>
Modified: lld/trunk/test/elf2/basic.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf2/basic.s (original)<br>
+++ lld/trunk/test/elf2/basic.s Tue Nov  3 15:35:14 2015<br>
@@ -34,8 +34,8 @@ _start:<br>
 # CHECK-NEXT:   ProgramHeaderEntrySize: 56<br>
 # CHECK-NEXT:   ProgramHeaderCount: 3<br>
 # CHECK-NEXT:   SectionHeaderEntrySize: 64<br>
-# CHECK-NEXT:   SectionHeaderCount: 6<br>
-# CHECK-NEXT:   StringTableSectionIndex: 4<br>
+# CHECK-NEXT:   SectionHeaderCount: 5<br>
+# CHECK-NEXT:   StringTableSectionIndex: 3<br>
 # CHECK-NEXT: }<br>
 # CHECK-NEXT: Sections [<br>
 # CHECK-NEXT:   Section {<br>
@@ -70,22 +70,6 @@ _start:<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
 # CHECK-NEXT:     Index: 2<br>
-# CHECK-NEXT:     Name: .bss<br>
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)<br>
-# CHECK-NEXT:     Flags [ (0x3)<br>
-# CHECK-NEXT:       SHF_ALLOC (0x2)<br>
-# CHECK-NEXT:       SHF_WRITE (0x1)<br>
-# CHECK-NEXT:     ]<br>
-# CHECK-NEXT:     Address: 0x11010<br>
-# CHECK-NEXT:     Offset: 0x1010<br>
-# CHECK-NEXT:     Size: 0<br>
-# CHECK-NEXT:     Link: 0<br>
-# CHECK-NEXT:     Info: 0<br>
-# CHECK-NEXT:     AddressAlignment: 0<br>
-# CHECK-NEXT:     EntrySize: 0<br>
-# CHECK-NEXT:   }<br>
-# CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 3<br>
 # CHECK-NEXT:     Name: .symtab<br>
 # CHECK-NEXT:     Type: SHT_SYMTAB (0x2)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
@@ -93,33 +77,33 @@ _start:<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x1010<br>
 # CHECK-NEXT:     Size: 48<br>
-# CHECK-NEXT:     Link: 5<br>
+# CHECK-NEXT:     Link: 4<br>
 # CHECK-NEXT:     Info: 1<br>
 # CHECK-NEXT:     AddressAlignment: 8<br>
 # CHECK-NEXT:     EntrySize: 24<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 4<br>
+# CHECK-NEXT:     Index: 3<br>
 # CHECK-NEXT:     Name: .shstrtab<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x1040<br>
-# CHECK-NEXT:     Size: 38<br>
+# CHECK-NEXT:     Size: 33<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
 # CHECK-NEXT:     AddressAlignment: 1<br>
 # CHECK-NEXT:     EntrySize: 0<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 5<br>
-# CHECK-NEXT:     Name: .strtab (22)<br>
+# CHECK-NEXT:     Index: 4<br>
+# CHECK-NEXT:     Name: .strtab (17)<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
-# CHECK-NEXT:     Offset: 0x1066<br>
+# CHECK-NEXT:     Offset: 0x1061<br>
 # CHECK-NEXT:     Size: 8<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
<br>
Modified: lld/trunk/test/elf2/basic32.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf2/basic32.s (original)<br>
+++ lld/trunk/test/elf2/basic32.s Tue Nov  3 15:35:14 2015<br>
@@ -25,15 +25,15 @@ _start:<br>
 # CHECK-NEXT:   Version: 1<br>
 # CHECK-NEXT:   Entry: 0x11000<br>
 # CHECK-NEXT:   ProgramHeaderOffset: 0x34<br>
-# CHECK-NEXT:   SectionHeaderOffset: 0x105C<br>
+# CHECK-NEXT:   SectionHeaderOffset: 0x1058<br>
 # CHECK-NEXT:   Flags [ (0x0)<br>
 # CHECK-NEXT:   ]<br>
 # CHECK-NEXT:   HeaderSize: 52<br>
 # CHECK-NEXT:   ProgramHeaderEntrySize: 32<br>
 # CHECK-NEXT:   ProgramHeaderCount: 3<br>
 # CHECK-NEXT:   SectionHeaderEntrySize: 40<br>
-# CHECK-NEXT:   SectionHeaderCount: 6<br>
-# CHECK-NEXT:   StringTableSectionIndex: 4<br>
+# CHECK-NEXT:   SectionHeaderCount: 5<br>
+# CHECK-NEXT:   StringTableSectionIndex: 3<br>
 # CHECK-NEXT: }<br>
 # CHECK-NEXT: Sections [<br>
 # CHECK-NEXT:   Section {<br>
@@ -68,22 +68,6 @@ _start:<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
 # CHECK-NEXT:     Index: 2<br>
-# CHECK-NEXT:     Name: .bss<br>
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)<br>
-# CHECK-NEXT:     Flags [ (0x3)<br>
-# CHECK-NEXT:       SHF_ALLOC (0x2)<br>
-# CHECK-NEXT:       SHF_WRITE (0x1)<br>
-# CHECK-NEXT:     ]<br>
-# CHECK-NEXT:     Address: 0x1100C<br>
-# CHECK-NEXT:     Offset: 0x100C<br>
-# CHECK-NEXT:     Size: 0<br>
-# CHECK-NEXT:     Link: 0<br>
-# CHECK-NEXT:     Info: 0<br>
-# CHECK-NEXT:     AddressAlignment: 0<br>
-# CHECK-NEXT:     EntrySize: 0<br>
-# CHECK-NEXT:   }<br>
-# CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 3<br>
 # CHECK-NEXT:     Name: .symtab<br>
 # CHECK-NEXT:     Type: SHT_SYMTAB<br>
 # CHECK-NEXT:     Flags [<br>
@@ -91,33 +75,33 @@ _start:<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x100C<br>
 # CHECK-NEXT:     Size: 32<br>
-# CHECK-NEXT:     Link: 5<br>
+# CHECK-NEXT:     Link: 4<br>
 # CHECK-NEXT:     Info: 1<br>
 # CHECK-NEXT:     AddressAlignment: 4<br>
 # CHECK-NEXT:     EntrySize: 16<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 4<br>
+# CHECK-NEXT:     Index: 3<br>
 # CHECK-NEXT:     Name: .shstrtab<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x102C<br>
-# CHECK-NEXT:     Size: 38<br>
+# CHECK-NEXT:     Size: 33<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
 # CHECK-NEXT:     AddressAlignment: 1<br>
 # CHECK-NEXT:     EntrySize: 0<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 5<br>
-# CHECK-NEXT:     Name: .strtab (22)<br>
+# CHECK-NEXT:     Index: 4<br>
+# CHECK-NEXT:     Name: .strtab (17)<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
-# CHECK-NEXT:     Offset: 0x1052<br>
+# CHECK-NEXT:     Offset: 0x104D<br>
 # CHECK-NEXT:     Size: 8<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
<br>
Modified: lld/trunk/test/elf2/basic64be.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic64be.s?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic64be.s?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf2/basic64be.s (original)<br>
+++ lld/trunk/test/elf2/basic64be.s Tue Nov  3 15:35:14 2015<br>
@@ -45,8 +45,8 @@ _start:<br>
 # CHECK-NEXT:   ProgramHeaderEntrySize: 56<br>
 # CHECK-NEXT:   ProgramHeaderCount: 4<br>
 # CHECK-NEXT:   SectionHeaderEntrySize: 64<br>
-# CHECK-NEXT:   SectionHeaderCount: 9<br>
-# CHECK-NEXT:   StringTableSectionIndex: 7<br>
+# CHECK-NEXT:   SectionHeaderCount: 8<br>
+# CHECK-NEXT:   StringTableSectionIndex: 6<br>
 # CHECK-NEXT: }<br>
 # CHECK-NEXT: Sections [<br>
 # CHECK-NEXT:   Section {<br>
@@ -145,22 +145,6 @@ _start:<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
 # CHECK-NEXT:     Index: 5<br>
-# CHECK-NEXT:     Name: .bss<br>
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)<br>
-# CHECK-NEXT:     Flags [ (0x3)<br>
-# CHECK-NEXT:       SHF_ALLOC (0x2)<br>
-# CHECK-NEXT:       SHF_WRITE (0x1)<br>
-# CHECK-NEXT:     ]<br>
-# CHECK-NEXT:     Address: 0x10020058<br>
-# CHECK-NEXT:     Offset: 0x20058<br>
-# CHECK-NEXT:     Size: 0<br>
-# CHECK-NEXT:     Link: 0<br>
-# CHECK-NEXT:     Info: 0<br>
-# CHECK-NEXT:     AddressAlignment: 0<br>
-# CHECK-NEXT:     EntrySize: 0<br>
-# CHECK-NEXT:   }<br>
-# CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 6<br>
 # CHECK-NEXT:     Name: .symtab<br>
 # CHECK-NEXT:     Type: SHT_SYMTAB (0x2)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
@@ -168,7 +152,7 @@ _start:<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x20058<br>
 # CHECK-NEXT:     Size: 48<br>
-# CHECK-NEXT:     Link: 8<br>
+# CHECK-NEXT:     Link: 7<br>
 # CHECK-NEXT:     Info: 1<br>
 # CHECK-NEXT:     AddressAlignment: 8<br>
 # CHECK-NEXT:     EntrySize: 24<br>
@@ -176,14 +160,14 @@ _start:<br>
 # CHECK:          )<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 7<br>
+# CHECK-NEXT:     Index: 6<br>
 # CHECK-NEXT:     Name: .shstrtab<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
 # CHECK-NEXT:     Offset: 0x20088<br>
-# CHECK-NEXT:     Size: 54<br>
+# CHECK-NEXT:     Size: 49<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
 # CHECK-NEXT:     AddressAlignment: 1<br>
@@ -192,13 +176,13 @@ _start:<br>
 # CHECK:          )<br>
 # CHECK-NEXT:   }<br>
 # CHECK-NEXT:   Section {<br>
-# CHECK-NEXT:     Index: 8<br>
-# CHECK-NEXT:     Name: .strtab (32)<br>
+# CHECK-NEXT:     Index: 7<br>
+# CHECK-NEXT:     Name: .strtab (27)<br>
 # CHECK-NEXT:     Type: SHT_STRTAB (0x3)<br>
 # CHECK-NEXT:     Flags [ (0x0)<br>
 # CHECK-NEXT:     ]<br>
 # CHECK-NEXT:     Address: 0x0<br>
-# CHECK-NEXT:     Offset: 0x200BE<br>
+# CHECK-NEXT:     Offset: 0x200B9<br>
 # CHECK-NEXT:     Size: 8<br>
 # CHECK-NEXT:     Link: 0<br>
 # CHECK-NEXT:     Info: 0<br>
<br>
Modified: lld/trunk/test/elf2/merge-shared.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/merge-shared.s?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/merge-shared.s?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf2/merge-shared.s (original)<br>
+++ lld/trunk/test/elf2/merge-shared.s Tue Nov  3 15:35:14 2015<br>
@@ -11,7 +11,7 @@<br>
         .quad foo + 6<br>
<br>
<br>
-// CHECK:      Name: foo (20)<br>
+// CHECK:      Name: foo<br>
 // CHECK-NEXT: Type: SHT_PROGBITS<br>
 // CHECK-NEXT: Flags [<br>
 // CHECK-NEXT:   SHF_ALLOC<br>
<br>
Modified: lld/trunk/test/elf2/string-table.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/string-table.s?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/string-table.s?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf2/string-table.s (original)<br>
+++ lld/trunk/test/elf2/string-table.s Tue Nov  3 15:35:14 2015<br>
@@ -58,9 +58,9 @@ _start:<br>
 // CHECK-NEXT:  AddressAlignment: 1<br>
 // CHECK-NEXT:  EntrySize: 0<br>
 // CHECK-NEXT:  SectionData (<br>
-// CHECK-NEXT:    0000: 002E7465 7874002E 62737300 666F6F62  |..text..bss.foob|<br>
-// CHECK-NEXT:    0010: 6172002E 73687374 72746162 002E7374  |ar..shstrtab..st|<br>
-// CHECK-NEXT:    0020: 72746162 002E7379 6D746162 00        |rtab..symtab.|<br>
+// CHECK-NEXT:    0000: 002E7465 78740066 6F6F6261 72002E73  |..text.foobar..s|<br>
+// CHECK-NEXT:    0010: 68737472 74616200 2E737472 74616200  |hstrtab..strtab.|<br>
+// CHECK-NEXT:    0020: 2E73796D 74616200                    |.symtab.|<br>
 // CHECK-NEXT:  )<br>
 // CHECK-NEXT:}<br>
 // CHECK:        Name: .strtab<br>
<br>
Modified: lld/trunk/test/elf2/tls.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/tls.s?rev=251980&r1=251979&r2=251980&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/tls.s?rev=251980&r1=251979&r2=251980&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/elf2/tls.s (original)<br>
+++ lld/trunk/test/elf2/tls.s Tue Nov  3 15:35:14 2015<br>
@@ -87,15 +87,6 @@ _start:<br>
 // CHECK-NEXT:     AddressAlignment:<br>
 // CHECK-NEXT:     EntrySize:<br>
 // CHECK-NEXT:   }<br>
-// CHECK-NEXT:   Section {<br>
-// CHECK-NEXT:     Index:<br>
-// CHECK-NEXT:     Name:<br>
-// CHECK-NEXT:     Type:<br>
-// CHECK-NEXT:     Flags [<br>
-// CHECK-NEXT:       SHF_ALLOC<br>
-// CHECK-NEXT:       SHF_WRITE<br>
-// CHECK-NEXT:     ]<br>
-// CHECK-NEXT:     Address: [[TBSS_ADDR]]<br>
<br>
 // Check that the TLS NOBITS sections weren't added to the R/W PT_LOAD's size.<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>