[lld] r247911 - Use a MapVector to output symbols in a deterministic order.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 11:26:26 PDT 2015


Author: rafael
Date: Thu Sep 17 13:26:25 2015
New Revision: 247911

URL: http://llvm.org/viewvc/llvm-project?rev=247911&view=rev
Log:
Use a MapVector to output symbols in a deterministic order.

We used to sort the symbols at the very end, but we need to know the order
earlier so that we can create reference to them in the dynamic relocations.

Thanks to Igor Kudrin for pointing out the problem.

Added:
    lld/trunk/test/elf2/dynamic-reloc-index.s
Modified:
    lld/trunk/ELF/SymbolTable.h
    lld/trunk/ELF/Writer.cpp
    lld/trunk/test/elf2/common.s
    lld/trunk/test/elf2/resolution.s
    lld/trunk/test/elf2/symbols.s

Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=247911&r1=247910&r2=247911&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Thu Sep 17 13:26:25 2015
@@ -11,8 +11,7 @@
 #define LLD_ELF_SYMBOL_TABLE_H
 
 #include "InputFiles.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/MapVector.h"
 
 namespace lld {
 namespace elf2 {
@@ -44,7 +43,7 @@ public:
 
   bool shouldUseRela() const;
 
-  const llvm::DenseMap<StringRef, Symbol *> &getSymbols() const {
+  const llvm::MapVector<StringRef, Symbol *> &getSymbols() const {
     return Symtab;
   }
 
@@ -74,7 +73,14 @@ private:
 
   std::vector<std::unique_ptr<ArchiveFile>> ArchiveFiles;
 
-  llvm::DenseMap<StringRef, Symbol *> Symtab;
+  // The order the global symbols are in is not defined. We can use an arbitrary
+  // order, but it has to be reproducible. That is true even when cross linking.
+  // The default hashing of StringRef produces different results on 32 and 64
+  // bit systems so we use a MapVector. That is arbitrary, deterministic but
+  // a bit inefficient.
+  // FIXME: Experiment with passing in a custom hashing or sorting the symbols
+  // once symbol resolution is finished.
+  llvm::MapVector<StringRef, Symbol *> Symtab;
   llvm::BumpPtrAllocator Alloc;
 
   // The writer needs to infer the machine type from the object files.

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=247911&r1=247910&r2=247911&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Sep 17 13:26:25 2015
@@ -699,8 +699,6 @@ template <class ELFT> void SymbolTableSe
     }
   }
 
-  uint8_t *GlobalStart = Buf;
-
   for (auto &P : Table.getSymbols()) {
     StringRef Name = P.first;
     Symbol *Sym = P.second;
@@ -755,14 +753,6 @@ template <class ELFT> void SymbolTableSe
 
     Buf += sizeof(Elf_Sym);
   }
-
-  // The order the global symbols are in is not defined. We can use an arbitrary
-  // order, but it has to be reproducible. That is true even when cross linking.
-  // The default hashing of StringRef produces different results on 32 and 64
-  // bit systems so we sort by st_name. That is arbitrary but deterministic.
-  // FIXME: Experiment with passing in a custom hashing instead.
-  auto *Syms = reinterpret_cast<Elf_Sym *>(GlobalStart);
-  array_pod_sort(Syms, Syms + NumVisible - NumLocals, compareSym<ELFT>);
 }
 
 template <bool Is64Bits>

Modified: lld/trunk/test/elf2/common.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/common.s?rev=247911&r1=247910&r2=247911&view=diff
==============================================================================
--- lld/trunk/test/elf2/common.s (original)
+++ lld/trunk/test/elf2/common.s Thu Sep 17 13:26:25 2015
@@ -14,34 +14,33 @@
 // CHECK-NEXT: Offset:
 // CHECK-NEXT: Size: 22
 
-
-// CHECK:      Name: sym4
-// CHECK-NEXT: Value: 0x11000
-// CHECK-NEXT: Size: 4
+// CHECK:      Name: sym1
+// CHECK-NEXT: Value: 0x11004
+// CHECK-NEXT: Size: 8
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object
 // CHECK-NEXT: Other: 0
 // CHECK-NEXT: Section: .bss
 
-// CHECK:      Name: sym3
-// CHECK-NEXT: Value: 0x11014
-// CHECK-NEXT: Size: 2
+// CHECK:      Name: sym2
+// CHECK-NEXT: Value: 0x1100C
+// CHECK-NEXT: Size: 8
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object
 // CHECK-NEXT: Other: 0
 // CHECK-NEXT: Section: .bss
 
-// CHECK:      Name: sym2
-// CHECK-NEXT: Value: 0x1100C
-// CHECK-NEXT: Size: 8
+// CHECK:      Name: sym3
+// CHECK-NEXT: Value: 0x11014
+// CHECK-NEXT: Size: 2
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object
 // CHECK-NEXT: Other: 0
 // CHECK-NEXT: Section: .bss
 
-// CHECK:      Name: sym1
-// CHECK-NEXT: Value: 0x11004
-// CHECK-NEXT: Size: 8
+// CHECK:      Name: sym4
+// CHECK-NEXT: Value: 0x11000
+// CHECK-NEXT: Size: 4
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object
 // CHECK-NEXT: Other: 0

Added: lld/trunk/test/elf2/dynamic-reloc-index.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/dynamic-reloc-index.s?rev=247911&view=auto
==============================================================================
--- lld/trunk/test/elf2/dynamic-reloc-index.s (added)
+++ lld/trunk/test/elf2/dynamic-reloc-index.s Thu Sep 17 13:26:25 2015
@@ -0,0 +1,21 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
+// RUN: lld -flavor gnu2 -shared %t2.o -o %t2.so
+// RUN: lld -flavor gnu2 %t.o %t2.so -o %t
+// RUN: llvm-readobj -r %t | FileCheck %s
+
+// We used to record the wrong symbol index for this test
+
+// CHECK:      Relocations [
+// CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
+// CHECK-NEXT:     0x11000 R_X86_64_64 bar 0x0
+// CHECK-NEXT:   }
+// CHECK-NEXT: ]
+
+        .global foobar
+foobar:
+        .global zedx
+zedx:
+        .global _start
+_start:
+.quad bar

Modified: lld/trunk/test/elf2/resolution.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/resolution.s?rev=247911&r1=247910&r2=247911&view=diff
==============================================================================
--- lld/trunk/test/elf2/resolution.s (original)
+++ lld/trunk/test/elf2/resolution.s Thu Sep 17 13:26:25 2015
@@ -28,36 +28,27 @@
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularWeak_with_RegularWeak
-// CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 0
-// CHECK-NEXT:     Binding: Weak
-// CHECK-NEXT:     Type: None
-// CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: .text
-// CHECK-NEXT:   }
-// CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonWeak_with_RegularWeak
+// CHECK-NEXT:     Name: CommonStrong_with_CommonStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 20
-// CHECK-NEXT:     Binding: Weak
+// CHECK-NEXT:     Size: 63
+// CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefWeak_with_RegularWeak
+// CHECK-NEXT:     Name: CommonStrong_with_CommonWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 43
-// CHECK-NEXT:     Binding: Weak
-// CHECK-NEXT:     Type: None
+// CHECK-NEXT:     Size: 30
+// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: .text
+// CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularStrong_with_RegularWeak
+// CHECK-NEXT:     Name: CommonStrong_with_RegularStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 2
+// CHECK-NEXT:     Size: 55
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
@@ -73,94 +64,112 @@
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefStrong_with_RegularWeak
+// CHECK-NEXT:     Name: CommonStrong_with_UndefStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 45
-// CHECK-NEXT:     Binding: Weak
-// CHECK-NEXT:     Type: None
+// CHECK-NEXT:     Size: 27
+// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: .text
+// CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularWeak_with_CommonWeak
+// CHECK-NEXT:     Name: CommonStrong_with_UndefWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 7
-// CHECK-NEXT:     Binding: Weak
-// CHECK-NEXT:     Type: None
+// CHECK-NEXT:     Size: 26
+// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: .text
+// CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonWeak_with_CommonWeak
+// CHECK-NEXT:     Name: CommonWeak_with_CommonStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 28
-// CHECK-NEXT:     Binding: Weak
+// CHECK-NEXT:     Size: 61
+// CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefWeak_with_CommonWeak
+// CHECK-NEXT:     Name: CommonWeak_with_CommonWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 48
+// CHECK-NEXT:     Size: 28
 // CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularStrong_with_CommonWeak
+// CHECK-NEXT:     Name: CommonWeak_with_RegularStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 9
+// CHECK-NEXT:     Size: 53
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonStrong_with_CommonWeak
+// CHECK-NEXT:     Name: CommonWeak_with_RegularWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 30
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 20
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefStrong_with_CommonWeak
+// CHECK-NEXT:     Name: CommonWeak_with_UndefStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 50
+// CHECK-NEXT:     Size: 25
 // CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularWeak_with_UndefWeak
+// CHECK-NEXT:     Name: CommonWeak_with_UndefWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 3
+// CHECK-NEXT:     Size: 24
 // CHECK-NEXT:     Binding: Weak
+// CHECK-NEXT:     Type: Object
+// CHECK-NEXT:     Other: 0
+// CHECK-NEXT:     Section:
+// CHECK-NEXT:   }
+// CHECK-NEXT:   Symbol {
+// CHECK-NEXT:     Name: RegularStrong_with_CommonStrong
+// CHECK-NEXT:     Value:
+// CHECK-NEXT:     Size: 10
+// CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonWeak_with_UndefWeak
+// CHECK-NEXT:     Name: RegularStrong_with_CommonWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 24
-// CHECK-NEXT:     Binding: Weak
-// CHECK-NEXT:     Type: Object
+// CHECK-NEXT:     Size: 9
+// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section:
+// CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefWeak_with_UndefWeak
-// CHECK-NEXT:     Value: 0x0
-// CHECK-NEXT:     Size: 15
-// CHECK-NEXT:     Binding: Weak
+// CHECK-NEXT:     Name: RegularStrong_with_RegularWeak
+// CHECK-NEXT:     Value:
+// CHECK-NEXT:     Size: 2
+// CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: Undefined
+// CHECK-NEXT:     Section: .text
+// CHECK-NEXT:   }
+// CHECK-NEXT:   Symbol {
+// CHECK-NEXT:     Name: RegularStrong_with_UndefStrong
+// CHECK-NEXT:     Value:
+// CHECK-NEXT:     Size: 6
+// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Type: None
+// CHECK-NEXT:     Other: 0
+// CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: RegularStrong_with_UndefWeak
@@ -172,148 +181,139 @@
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonStrong_with_UndefWeak
+// CHECK-NEXT:     Name: RegularWeak_with_CommonStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 26
+// CHECK-NEXT:     Size: 40
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularWeak_with_RegularStrong
+// CHECK-NEXT:     Name: RegularWeak_with_CommonWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 33
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 7
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonWeak_with_RegularStrong
+// CHECK-NEXT:     Name: RegularWeak_with_RegularStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 53
+// CHECK-NEXT:     Size: 33
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefWeak_with_RegularStrong
+// CHECK-NEXT:     Name: RegularWeak_with_RegularWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 44
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 0
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonStrong_with_RegularStrong
+// CHECK-NEXT:     Name: RegularWeak_with_UndefStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 55
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 4
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefStrong_with_RegularStrong
+// CHECK-NEXT:     Name: RegularWeak_with_UndefWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 46
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 3
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularWeak_with_CommonStrong
+// CHECK-NEXT:     Name: UndefStrong_with_CommonStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 40
+// CHECK-NEXT:     Size: 51
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonWeak_with_CommonStrong
+// CHECK-NEXT:     Name: UndefStrong_with_CommonWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 61
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 50
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefWeak_with_CommonStrong
+// CHECK-NEXT:     Name: UndefStrong_with_RegularStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 49
+// CHECK-NEXT:     Size: 46
 // CHECK-NEXT:     Binding: Global
-// CHECK-NEXT:     Type: Object
+// CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section:
+// CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularStrong_with_CommonStrong
+// CHECK-NEXT:     Name: UndefStrong_with_RegularWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 10
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 45
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonStrong_with_CommonStrong
+// CHECK-NEXT:     Name: UndefWeak_with_CommonStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 63
+// CHECK-NEXT:     Size: 49
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: UndefStrong_with_CommonStrong
+// CHECK-NEXT:     Name: UndefWeak_with_CommonWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 51
-// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Size: 48
+// CHECK-NEXT:     Binding: Weak
 // CHECK-NEXT:     Type: Object
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularWeak_with_UndefStrong
+// CHECK-NEXT:     Name: UndefWeak_with_RegularStrong
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 4
-// CHECK-NEXT:     Binding: Weak
+// CHECK-NEXT:     Size: 44
+// CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonWeak_with_UndefStrong
+// CHECK-NEXT:     Name: UndefWeak_with_RegularWeak
 // CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 25
+// CHECK-NEXT:     Size: 43
 // CHECK-NEXT:     Binding: Weak
-// CHECK-NEXT:     Type: Object
-// CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section:
-// CHECK-NEXT:   }
-// CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: RegularStrong_with_UndefStrong
-// CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 6
-// CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: CommonStrong_with_UndefStrong
-// CHECK-NEXT:     Value:
-// CHECK-NEXT:     Size: 27
-// CHECK-NEXT:     Binding: Global
-// CHECK-NEXT:     Type: Object
+// CHECK-NEXT:     Name: UndefWeak_with_UndefWeak
+// CHECK-NEXT:     Value: 0x0
+// CHECK-NEXT:     Size: 15
+// CHECK-NEXT:     Binding: Weak
+// CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section:
+// CHECK-NEXT:     Section: Undefined
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
 

Modified: lld/trunk/test/elf2/symbols.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/symbols.s?rev=247911&r1=247910&r2=247911&view=diff
==============================================================================
--- lld/trunk/test/elf2/symbols.s (original)
+++ lld/trunk/test/elf2/symbols.s Thu Sep 17 13:26:25 2015
@@ -108,6 +108,15 @@ internal:
 // CHECK-NEXT:     Section: Undefined (0x0)
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
+// CHECK-NEXT:     Name: common
+// CHECK-NEXT:     Value: 0x12000
+// CHECK-NEXT:     Size: 4
+// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Type: Object
+// CHECK-NEXT:     Other: 0
+// CHECK-NEXT:     Section: .bss
+// CHECK-NEXT:   }
+// CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: foo
 // CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
@@ -117,13 +126,13 @@ internal:
 // CHECK-NEXT:     Section: .text
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: common (34)
-// CHECK-NEXT:     Value: 0x12000
-// CHECK-NEXT:     Size: 4
-// CHECK-NEXT:     Binding: Global (0x1)
-// CHECK-NEXT:     Type: Object (0x1)
-// CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: .bss
+// CHECK-NEXT:     Name: protected
+// CHECK-NEXT:     Value: 0x13008
+// CHECK-NEXT:     Size: 0
+// CHECK-NEXT:     Binding: Global
+// CHECK-NEXT:     Type: None
+// CHECK-NEXT:     Other: 3
+// CHECK-NEXT:     Section: foobar
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: zed
@@ -135,12 +144,12 @@ internal:
 // CHECK-NEXT:     Section: foobar
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: protected
-// CHECK-NEXT:     Value: 0x13008
+// CHECK-NEXT:     Name: zed2
+// CHECK-NEXT:     Value: 0x13004
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
-// CHECK-NEXT:     Other: 3
+// CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: foobar
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
@@ -150,15 +159,6 @@ internal:
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
 // CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: foobar
-// CHECK-NEXT:   }
-// CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: zed2
-// CHECK-NEXT:     Value: 0x13004
-// CHECK-NEXT:     Size: 0
-// CHECK-NEXT:     Binding: Global
-// CHECK-NEXT:     Type: None
-// CHECK-NEXT:     Other: 0
 // CHECK-NEXT:     Section: foobar
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]




More information about the llvm-commits mailing list