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.

llvm-svn: 247911
This commit is contained in:
Rafael Espindola 2015-09-17 18:26:25 +00:00
parent c608d206c7
commit 40102eb27f
6 changed files with 261 additions and 245 deletions

View File

@ -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.

View File

@ -699,8 +699,6 @@ template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
}
}
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 SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
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>

View File

@ -14,18 +14,9 @@
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 22
// CHECK: Name: sym4
// CHECK-NEXT: Value: 0x11000
// CHECK-NEXT: Size: 4
// 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: sym1
// CHECK-NEXT: Value: 0x11004
// CHECK-NEXT: Size: 8
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
@ -39,9 +30,17 @@
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .bss
// CHECK: Name: sym1
// CHECK-NEXT: Value: 0x11004
// 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: sym4
// CHECK-NEXT: Value: 0x11000
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0

View File

@ -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

View File

@ -28,36 +28,27 @@
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_RegularWeak
// CHECK-NEXT: Name: CommonStrong_with_CommonStrong
// 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: 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,105 +64,15 @@
// 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: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_CommonWeak
// CHECK-NEXT: Value:
// 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_CommonWeak
// CHECK-NEXT: Value:
// 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: UndefWeak_with_CommonWeak
// CHECK-NEXT: Value:
// 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: RegularStrong_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 9
// 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: Value:
// CHECK-NEXT: Size: 30
// CHECK-NEXT: Size: 27
// 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_CommonWeak
// CHECK-NEXT: Value:
// 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: RegularWeak_with_UndefWeak
// CHECK-NEXT: Value:
// 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: CommonWeak_with_UndefWeak
// CHECK-NEXT: Value:
// 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: 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: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularStrong_with_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 5
// 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_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 26
@ -181,60 +82,6 @@
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: RegularWeak_with_RegularStrong
// CHECK-NEXT: Value:
// 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: CommonWeak_with_RegularStrong
// CHECK-NEXT: Value:
// 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: UndefWeak_with_RegularStrong
// CHECK-NEXT: Value:
// 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: CommonStrong_with_RegularStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 55
// CHECK-NEXT: Binding: Global
// 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: Value:
// CHECK-NEXT: Size: 46
// CHECK-NEXT: Binding: Global
// 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: Value:
// 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: CommonWeak_with_CommonStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 61
@ -244,10 +91,46 @@
// CHECK-NEXT: Section:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefWeak_with_CommonStrong
// CHECK-NEXT: Name: CommonWeak_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 49
// 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: CommonWeak_with_RegularStrong
// CHECK-NEXT: Value:
// 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: CommonWeak_with_RegularWeak
// CHECK-NEXT: Value:
// 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: CommonWeak_with_UndefStrong
// CHECK-NEXT: Value:
// 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: CommonWeak_with_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 24
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section:
@ -262,40 +145,22 @@
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_CommonStrong
// CHECK-NEXT: Name: RegularStrong_with_CommonWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 63
// CHECK-NEXT: Size: 9
// 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: Value:
// 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: RegularWeak_with_UndefStrong
// CHECK-NEXT: Value:
// 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: CommonWeak_with_UndefStrong
// CHECK-NEXT: Name: RegularStrong_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 25
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: Object
// CHECK-NEXT: Size: 2
// 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: RegularStrong_with_UndefStrong
@ -307,14 +172,149 @@
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: CommonStrong_with_UndefStrong
// CHECK-NEXT: Name: RegularStrong_with_UndefWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 27
// CHECK-NEXT: Size: 5
// CHECK-NEXT: Binding: Global
// 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: Value:
// 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_CommonWeak
// CHECK-NEXT: Value:
// 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: RegularWeak_with_RegularStrong
// CHECK-NEXT: Value:
// 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: 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: RegularWeak_with_UndefStrong
// CHECK-NEXT: Value:
// 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: RegularWeak_with_UndefWeak
// CHECK-NEXT: Value:
// 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: UndefStrong_with_CommonStrong
// CHECK-NEXT: Value:
// 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: UndefStrong_with_CommonWeak
// CHECK-NEXT: Value:
// 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: UndefStrong_with_RegularStrong
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 46
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: .text
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefStrong_with_RegularWeak
// CHECK-NEXT: Value:
// 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: UndefWeak_with_CommonStrong
// CHECK-NEXT: Value:
// 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: UndefWeak_with_CommonWeak
// CHECK-NEXT: Value:
// 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: UndefWeak_with_RegularStrong
// CHECK-NEXT: Value:
// 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: UndefWeak_with_RegularWeak
// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 43
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// 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: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: ]
.globl _start

View File

@ -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,24 +126,6 @@ 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: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: zed
// CHECK-NEXT: Value: 0x13000
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: foobar
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: protected
// CHECK-NEXT: Value: 0x13008
// CHECK-NEXT: Size: 0
@ -144,10 +135,10 @@ internal:
// CHECK-NEXT: Section: foobar
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: zed3
// CHECK-NEXT: Value: 0x13008
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Name: zed
// CHECK-NEXT: Value: 0x13000
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: foobar
@ -161,4 +152,13 @@ internal:
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: foobar
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: zed3
// CHECK-NEXT: Value: 0x13008
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
// CHECK-NEXT: Section: foobar
// CHECK-NEXT: }
// CHECK-NEXT: ]