[lld] r248412 - Create the .bss section early so that we don't have to set it after the fact.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 11:25:06 PDT 2015


Author: rafael
Date: Wed Sep 23 13:25:05 2015
New Revision: 248412

URL: http://llvm.org/viewvc/llvm-project?rev=248412&view=rev
Log:
Create the .bss section early so that we don't have to set it after the fact.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h
    lld/trunk/ELF/Writer.cpp
    lld/trunk/test/elf2/basic.s
    lld/trunk/test/elf2/basic32.s
    lld/trunk/test/elf2/basic32be.s
    lld/trunk/test/elf2/basic64be.s
    lld/trunk/test/elf2/bss.s
    lld/trunk/test/elf2/relocation-common.s
    lld/trunk/test/elf2/symbols.s

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Sep 23 13:25:05 2015
@@ -252,7 +252,7 @@ lld::elf2::getLocalSymVA(const typename
 
 template <class ELFT> void OutputSection<ELFT>::writeTo(uint8_t *Buf) {
   for (InputSection<ELFT> *C : Sections)
-    C->writeTo(Buf, *BssSec, PltSec, GotSec);
+    C->writeTo(Buf, BssSec, PltSec, GotSec);
 }
 
 template <bool Is64Bits>
@@ -336,7 +336,7 @@ template <class ELFT> void SymbolTableSe
       Section = &cast<DefinedRegular<ELFT>>(Body)->Section;
       break;
     case SymbolBody::DefinedCommonKind:
-      Out = BssSec;
+      Out = &BssSec;
       break;
     case SymbolBody::UndefinedKind:
     case SymbolBody::DefinedAbsoluteKind:

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Wed Sep 23 13:25:05 2015
@@ -154,13 +154,14 @@ public:
   typedef typename llvm::object::ELFFile<ELFT>::Elf_Sym_Range Elf_Sym_Range;
   typedef typename OutputSectionBase<ELFT::Is64Bits>::uintX_t uintX_t;
   SymbolTableSection(SymbolTable &Table,
-                     StringTableSection<ELFT::Is64Bits> &StrTabSec)
+                     StringTableSection<ELFT::Is64Bits> &StrTabSec,
+                     const OutputSection<ELFT> &BssSec)
       : OutputSectionBase<ELFT::Is64Bits>(
             StrTabSec.isDynamic() ? ".dynsym" : ".symtab",
             StrTabSec.isDynamic() ? llvm::ELF::SHT_DYNSYM
                                   : llvm::ELF::SHT_SYMTAB,
             StrTabSec.isDynamic() ? (uintX_t)llvm::ELF::SHF_ALLOC : 0),
-        Table(Table), StrTabSec(StrTabSec) {
+        Table(Table), StrTabSec(StrTabSec), BssSec(BssSec) {
     typedef OutputSectionBase<ELFT::Is64Bits> Base;
     typename Base::HeaderT &Header = this->Header;
 
@@ -187,14 +188,13 @@ public:
 
   StringTableSection<ELFT::Is64Bits> &getStrTabSec() const { return StrTabSec; }
   unsigned getNumSymbols() const { return NumVisible + 1; }
-  void setBssSec(const OutputSection<ELFT> *V) { BssSec = V; }
 
 private:
   SymbolTable &Table;
   StringTableSection<ELFT::Is64Bits> &StrTabSec;
   unsigned NumVisible = 0;
   unsigned NumLocals = 0;
-  const OutputSection<ELFT> *BssSec = nullptr;
+  const OutputSection<ELFT> &BssSec;
 };
 
 template <class ELFT>
@@ -236,19 +236,19 @@ public:
   typedef typename llvm::object::ELFFile<ELFT>::Elf_Rel Elf_Rel;
   typedef typename llvm::object::ELFFile<ELFT>::Elf_Rela Elf_Rela;
   OutputSection(const PltSection<ELFT> &PltSec, const GotSection<ELFT> &GotSec,
-                StringRef Name, uint32_t sh_type, uintX_t sh_flags)
+                const OutputSection<ELFT> &BssSec, StringRef Name,
+                uint32_t sh_type, uintX_t sh_flags)
       : OutputSectionBase<ELFT::Is64Bits>(Name, sh_type, sh_flags),
-        PltSec(PltSec), GotSec(GotSec) {}
+        PltSec(PltSec), GotSec(GotSec), BssSec(BssSec) {}
 
   void addSection(InputSection<ELFT> *C);
   void writeTo(uint8_t *Buf) override;
-  void setBssSec(const OutputSection<ELFT> *BS) { BssSec = BS; }
 
 private:
   std::vector<InputSection<ELFT> *> Sections;
   const PltSection<ELFT> &PltSec;
   const GotSection<ELFT> &GotSec;
-  const OutputSection<ELFT> *BssSec = nullptr;
+  const OutputSection<ELFT> &BssSec;
 };
 
 template <bool Is64Bits>

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Sep 23 13:25:05 2015
@@ -97,9 +97,11 @@ public:
   typedef typename ELFFile<ELFT>::Elf_Sym_Range Elf_Sym_Range;
   typedef typename ELFFile<ELFT>::Elf_Rela Elf_Rela;
   Writer(SymbolTable *T)
-      : SymTabSec(*T, StrTabSec), DynSymSec(*T, DynStrSec),
+      : SymTabSec(*T, StrTabSec, BssSec), DynSymSec(*T, DynStrSec, BssSec),
         RelaDynSec(DynSymSec, GotSec, T->shouldUseRela()), PltSec(GotSec),
-        HashSec(DynSymSec), DynamicSec(*T, HashSec, RelaDynSec) {}
+        HashSec(DynSymSec), DynamicSec(*T, HashSec, RelaDynSec),
+        BssSec(PltSec, GotSec, BssSec, ".bss", SHT_NOBITS,
+               SHF_ALLOC | SHF_WRITE) {}
   void run();
 
 private:
@@ -154,7 +156,7 @@ private:
 
   InterpSection<ELFT::Is64Bits> InterpSec;
 
-  OutputSection<ELFT> *BSSSec = nullptr;
+  OutputSection<ELFT> BssSec;
 };
 } // anonymous namespace
 
@@ -312,13 +314,17 @@ static void undefError(const SymbolTable
 // Create output section objects and add them to OutputSections.
 template <class ELFT> void Writer<ELFT>::createSections() {
   SmallDenseMap<SectionKey<ELFT::Is64Bits>, OutputSection<ELFT> *> Map;
+
+  OutputSections.push_back(&BssSec);
+  Map[{BssSec.getName(), BssSec.getType(), BssSec.getFlags()}] = &BssSec;
+
   auto getSection = [&](StringRef Name, uint32_t sh_type,
                         uintX_t sh_flags) -> OutputSection<ELFT> * {
     SectionKey<ELFT::Is64Bits> Key{Name, sh_type, sh_flags};
     OutputSection<ELFT> *&Sec = Map[Key];
     if (!Sec) {
       Sec = new (CAlloc.Allocate()) OutputSection<ELFT>(
-          PltSec, GotSec, Key.Name, Key.sh_type, Key.sh_flags);
+          PltSec, GotSec, BssSec, Key.Name, Key.sh_type, Key.sh_flags);
       OutputSections.push_back(Sec);
     }
     return Sec;
@@ -364,18 +370,9 @@ template <class ELFT> void Writer<ELFT>:
       HashSec.addSymbol(Body);
   }
 
-  BSSSec = getSection(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE);
-
-  // The only type in OutputSections is currently OutputSection.
-  for (OutputSectionBase<ELFT::Is64Bits> *OSB : OutputSections)
-    static_cast<OutputSection<ELFT> *>(OSB)->setBssSec(BSSSec);
-
-  SymTabSec.setBssSec(BSSSec);
-  DynSymSec.setBssSec(BSSSec);
-
   // Sort the common symbols by alignment as an heuristic to pack them better.
   std::stable_sort(CommonSymbols.begin(), CommonSymbols.end(), cmpAlign<ELFT>);
-  uintX_t Off = BSSSec->getSize();
+  uintX_t Off = BssSec.getSize();
   for (DefinedCommon<ELFT> *C : CommonSymbols) {
     const Elf_Sym &Sym = C->Sym;
     uintX_t Align = C->MaxAlignment;
@@ -384,7 +381,7 @@ template <class ELFT> void Writer<ELFT>:
     Off += Sym.st_size;
   }
 
-  BSSSec->setSize(Off);
+  BssSec.setSize(Off);
 
   OutputSections.push_back(&SymTabSec);
   OutputSections.push_back(&StrTabSec);

Modified: lld/trunk/test/elf2/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic.s (original)
+++ lld/trunk/test/elf2/basic.s Wed Sep 23 13:25:05 2015
@@ -53,15 +53,15 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 1
-# CHECK-NEXT:     Name: .text
-# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x6)
+# CHECK-NEXT:     Name: .bss
+# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_EXECINSTR (0x4)
+# CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
-# CHECK-NEXT:     Size: 16
+# CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
@@ -69,15 +69,15 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 2
-# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Name: .text
 # CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x3)
+# CHECK-NEXT:     Flags [ (0x6)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_WRITE (0x1)
+# CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x11010
-# CHECK-NEXT:     Offset: 0x1010
-# CHECK-NEXT:     Size: 0
+# CHECK-NEXT:     Address: 0x11000
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     Size: 16
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
@@ -85,8 +85,8 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 3
-# CHECK-NEXT:     Name: .bss
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
 # CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
@@ -145,7 +145,7 @@ _start:
 # CHECK-NEXT:     Binding: Global (0x1)
 # CHECK-NEXT:     Type: None (0x0)
 # CHECK-NEXT:     Other: 0
-# CHECK-NEXT:     Section: .text (0x1)
+# CHECK-NEXT:     Section: .text
 # CHECK-NEXT:   }
 # CHECK-NEXT: ]
 # CHECK-NEXT: ProgramHeaders [

Modified: lld/trunk/test/elf2/basic32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic32.s (original)
+++ lld/trunk/test/elf2/basic32.s Wed Sep 23 13:25:05 2015
@@ -52,15 +52,15 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 1
-# CHECK-NEXT:     Name: .text
-# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x6)
+# CHECK-NEXT:     Name: .bss
+# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_EXECINSTR (0x4)
+# CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
-# CHECK-NEXT:     Size: 12
+# CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
@@ -68,15 +68,15 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 2
-# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Name: .text
 # CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x3)
+# CHECK-NEXT:     Flags [ (0x6)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_WRITE (0x1)
+# CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1100C
-# CHECK-NEXT:     Offset: 0x100C
-# CHECK-NEXT:     Size: 0
+# CHECK-NEXT:     Address: 0x11000
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     Size: 12
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
@@ -84,8 +84,8 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 3
-# CHECK-NEXT:     Name: .bss
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
 # CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)

Modified: lld/trunk/test/elf2/basic32be.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32be.s?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic32be.s (original)
+++ lld/trunk/test/elf2/basic32be.s Wed Sep 23 13:25:05 2015
@@ -52,15 +52,15 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 1
-# CHECK-NEXT:     Name: .text
-# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x6)
+# CHECK-NEXT:     Name: .bss
+# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_EXECINSTR (0x4)
+# CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
-# CHECK-NEXT:     Size: 12
+# CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
@@ -68,15 +68,15 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 2
-# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Name: .text
 # CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x3)
+# CHECK-NEXT:     Flags [ (0x6)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_WRITE (0x1)
+# CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1100C
-# CHECK-NEXT:     Offset: 0x100C
-# CHECK-NEXT:     Size: 0
+# CHECK-NEXT:     Address: 0x11000
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     Size: 12
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
@@ -84,8 +84,8 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 3
-# CHECK-NEXT:     Name: .bss
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
 # CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)

Modified: lld/trunk/test/elf2/basic64be.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic64be.s?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic64be.s (original)
+++ lld/trunk/test/elf2/basic64be.s Wed Sep 23 13:25:05 2015
@@ -59,33 +59,31 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 1
-# CHECK-NEXT:     Name: .text
-# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x6)
+# CHECK-NEXT:     Name: .bss
+# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_EXECINSTR (0x4)
+# CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
-# CHECK-NEXT:     Size: 12
+# CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
 # CHECK-NEXT:     EntrySize: 0
-# CHECK-NEXT:     SectionData (
-# CHECK:          )
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 2
-# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Name: .text
 # CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT:     Flags [ (0x3)
+# CHECK-NEXT:     Flags [ (0x6)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
-# CHECK-NEXT:       SHF_WRITE (0x1)
+# CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1100C
-# CHECK-NEXT:     Offset: 0x100C
-# CHECK-NEXT:     Size: 0
+# CHECK-NEXT:     Address: 0x11000
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     Size: 12
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
@@ -95,8 +93,8 @@ _start:
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 3
-# CHECK-NEXT:     Name: .bss
-# CHECK-NEXT:     Type: SHT_NOBITS (0x8)
+# CHECK-NEXT:     Name: .data
+# CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
 # CHECK-NEXT:     Flags [ (0x3)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
@@ -108,6 +106,8 @@ _start:
 # CHECK-NEXT:     Info: 0
 # CHECK-NEXT:     AddressAlignment: 4
 # CHECK-NEXT:     EntrySize: 0
+# CHECK-NEXT:     SectionData (
+# CHECK:          )
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section {
 # CHECK-NEXT:     Index: 4

Modified: lld/trunk/test/elf2/bss.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/bss.s?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/test/elf2/bss.s (original)
+++ lld/trunk/test/elf2/bss.s Wed Sep 23 13:25:05 2015
@@ -24,6 +24,8 @@
 // CHECK-NEXT:   Name:
 // CHECK-NEXT:   Type:
 // CHECK-NEXT:   Flags [
+// CHECK-NEXT:     SHF_ALLOC
+// CHECK-NEXT:     SHF_EXECINSTR
 // CHECK-NEXT:   ]
 // CHECK-NEXT:   Address:
 // CHECK-NEXT:   Offset: 0x1000

Modified: lld/trunk/test/elf2/relocation-common.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation-common.s?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation-common.s (original)
+++ lld/trunk/test/elf2/relocation-common.s Wed Sep 23 13:25:05 2015
@@ -10,5 +10,5 @@ _start:
 .global sym1
 .comm sym1,4,4
 
-// CHECK: 11000: {{.*}} movl    $1, 4086(%rip)
-// CHECK: 0000000000012000 g       .bss            00000004 sym1
+// CHECK: 12000: {{.*}} movl    $1, -4106(%rip)
+// CHECK: 0000000000011000 g       .bss            00000004 sym1

Modified: lld/trunk/test/elf2/symbols.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/symbols.s?rev=248412&r1=248411&r2=248412&view=diff
==============================================================================
--- lld/trunk/test/elf2/symbols.s (original)
+++ lld/trunk/test/elf2/symbols.s Wed Sep 23 13:25:05 2015
@@ -45,23 +45,23 @@ hidden:
 .internal internal
 internal:
 
-// CHECK:      Name: .text
-// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK:      Name: .bss
+// CHECK-NEXT: Type: SHT_NOBITS
 // CHECK-NEXT: Flags [
 // CHECK-NEXT:   SHF_ALLOC
-// CHECK-NEXT:   SHF_EXECINSTR
+// CHECK-NEXT:   SHF_WRITE
 // CHECK-NEXT: ]
 // CHECK-NEXT: Address: 0x11000
+// CHECK-NEXT: Offset: 0x1000
+// CHECK-NEXT: Size: 4
 
-// CHECK:      Name: .bss (14)
-// CHECK-NEXT: Type: SHT_NOBITS (0x8)
-// CHECK-NEXT: Flags [ (0x3)
-// CHECK-NEXT:   SHF_ALLOC (0x2)
-// CHECK-NEXT:   SHF_WRITE (0x1)
+// CHECK:      Name: .text
+// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK-NEXT: Flags [
+// CHECK-NEXT:   SHF_ALLOC
+// CHECK-NEXT:   SHF_EXECINSTR
 // CHECK-NEXT: ]
 // CHECK-NEXT: Address: 0x12000
-// CHECK-NEXT: Offset: 0x2000
-// CHECK-NEXT: Size: 4
 
 // CHECK:      Name: foobar
 // CHECK-NEXT: Type: SHT_NOBITS
@@ -82,7 +82,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _start
-// CHECK-NEXT:     Value: 0x11000
+// CHECK-NEXT:     Value: 0x12000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global (0x1)
 // CHECK-NEXT:     Type: Function
@@ -109,7 +109,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: common
-// CHECK-NEXT:     Value: 0x12000
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 4
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: Object
@@ -118,7 +118,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: foo
-// CHECK-NEXT:     Value: 0x11000
+// CHECK-NEXT:     Value: 0x12000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Weak (0x2)
 // CHECK-NEXT:     Type: Object




More information about the llvm-commits mailing list