[lld] r248845 - [elf2] Sort output sections.
Michael J. Spencer via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 16:05:41 PDT 2015
Author: mspencer
Date: Tue Sep 29 18:05:40 2015
New Revision: 248845
URL: http://llvm.org/viewvc/llvm-project?rev=248845&view=rev
Log:
[elf2] Sort output sections.
Sort by:
ALLOC
ALLOC && NOBITS
ALLOC & EXEC
ALLOC & EXEC && NOBITS
ALLOC & WRITE
ALLOC & WRITE && NOBITS
<nothing> (ignoring NOBITS)
The dynamic section is finalized early because it adds strings to the dynamic string table, which comes before the dynamic table.
Added:
lld/trunk/test/elf2/section-layout.s
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/Writer.cpp
lld/trunk/test/elf2/basic-aarch64.s
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/discard-none.s
lld/trunk/test/elf2/dynamic-reloc-index.s
lld/trunk/test/elf2/dynamic-reloc.s
lld/trunk/test/elf2/got.s
lld/trunk/test/elf2/local-dynamic.s
lld/trunk/test/elf2/plt-i686.s
lld/trunk/test/elf2/plt.s
lld/trunk/test/elf2/relocation-common.s
lld/trunk/test/elf2/relocation-i686.s
lld/trunk/test/elf2/relocation-local.s
lld/trunk/test/elf2/relocation.s
lld/trunk/test/elf2/shared.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=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Sep 29 18:05:40 2015
@@ -183,6 +183,9 @@ DynamicSection<ELFT>::DynamicSection(Sym
}
template <class ELFT> void DynamicSection<ELFT>::finalize() {
+ if (Header.sh_size)
+ return; // Already finalized.
+
typename Base::HeaderT &Header = this->Header;
Header.sh_link = DynStrSec.getSectionIndex();
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Sep 29 18:05:40 2015
@@ -389,12 +389,42 @@ template <class ELFT> void Writer<ELFT>:
OutputSections.begin(), OutputSections.end(),
[](OutputSectionBase<ELFT::Is64Bits> *A,
OutputSectionBase<ELFT::Is64Bits> *B) {
- // Place SHF_ALLOC sections first.
- return (A->getFlags() & SHF_ALLOC) && !(B->getFlags() & SHF_ALLOC);
+ // Sort by ALLOC < (ALLOC & NOBITS) < (ALLOC & EXECUTE) <
+ // (ALLOC & WRITE) < (ALLOC & WRITE & NOBITS)
+ uintX_t AFlags =
+ A->getFlags() & (SHF_ALLOC | SHF_EXECINSTR | SHF_WRITE);
+ uintX_t BFlags =
+ B->getFlags() & (SHF_ALLOC | SHF_EXECINSTR | SHF_WRITE);
+
+ auto rank = [](OutputSectionBase<ELFT::Is64Bits> *Sec) {
+ switch (Sec->getFlags() & (SHF_ALLOC | SHF_EXECINSTR | SHF_WRITE)) {
+ case SHF_ALLOC:
+ return 0;
+ case SHF_ALLOC | SHF_EXECINSTR:
+ return 1;
+ case SHF_ALLOC | SHF_EXECINSTR | SHF_WRITE:
+ return 2;
+ case SHF_ALLOC | SHF_WRITE:
+ return 3;
+ case 0:
+ return 4;
+ default:
+ error("Unexpected section flags");
+ }
+ };
+
+ // Ignore SHT_NOBITS for non-allocated sections.
+ if (AFlags && AFlags == BFlags)
+ return A->getType() != SHT_NOBITS && B->getType() == SHT_NOBITS;
+
+ return rank(A) < rank(B);
});
for (unsigned I = 0, N = OutputSections.size(); I < N; ++I)
OutputSections[I]->setSectionIndex(I + 1);
+
+ // Fill the DynStrSec early.
+ DynamicSec.finalize();
}
template <class ELFT>
Modified: lld/trunk/test/elf2/basic-aarch64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic-aarch64.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic-aarch64.s (original)
+++ lld/trunk/test/elf2/basic-aarch64.s Tue Sep 29 18:05:40 2015
@@ -53,15 +53,15 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 1
-# CHECK-NEXT: Name: .bss
-# CHECK-NEXT: Type: SHT_NOBITS (0x8)
-# CHECK-NEXT: Flags [ (0x3)
+# CHECK-NEXT: Name: .text
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x6)
# CHECK-NEXT: SHF_ALLOC (0x2)
-# CHECK-NEXT: SHF_WRITE (0x1)
+# CHECK-NEXT: SHF_EXECINSTR (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x11000
# CHECK-NEXT: Offset: 0x1000
-# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Size: 12
# 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: .text
+# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT: Flags [ (0x6)
+# 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: Address: 0x1100C
+# CHECK-NEXT: Offset: 0x100C
+# CHECK-NEXT: Size: 0
# 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: .data
-# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Name: .bss
+# CHECK-NEXT: Type: SHT_NOBITS (0x8)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_WRITE (0x1)
@@ -145,7 +145,7 @@ _start:
# CHECK-NEXT: Binding: Local (0x0)
# CHECK-NEXT: Type: None (0x0)
# CHECK-NEXT: Other: 0
-# CHECK-NEXT: Section: .text (0x2)
+# CHECK-NEXT: Section: .text
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: _start (7)
Modified: lld/trunk/test/elf2/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic.s (original)
+++ lld/trunk/test/elf2/basic.s Tue Sep 29 18:05:40 2015
@@ -54,15 +54,15 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 1
-# CHECK-NEXT: Name: .bss
-# CHECK-NEXT: Type: SHT_NOBITS (0x8)
-# CHECK-NEXT: Flags [ (0x3)
+# CHECK-NEXT: Name: .text
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x6)
# CHECK-NEXT: SHF_ALLOC (0x2)
-# CHECK-NEXT: SHF_WRITE (0x1)
+# CHECK-NEXT: SHF_EXECINSTR (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x11000
# CHECK-NEXT: Offset: 0x1000
-# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Size: 16
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 4
@@ -70,15 +70,15 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 2
-# CHECK-NEXT: Name: .text
+# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT: Flags [ (0x6)
+# 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: Address: 0x11010
+# CHECK-NEXT: Offset: 0x1010
+# CHECK-NEXT: Size: 0
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 4
@@ -86,8 +86,8 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 3
-# CHECK-NEXT: Name: .data
-# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Name: .bss
+# CHECK-NEXT: Type: SHT_NOBITS (0x8)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_WRITE (0x1)
Modified: lld/trunk/test/elf2/basic32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic32.s (original)
+++ lld/trunk/test/elf2/basic32.s Tue Sep 29 18:05:40 2015
@@ -52,15 +52,15 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 1
-# CHECK-NEXT: Name: .bss
-# CHECK-NEXT: Type: SHT_NOBITS (0x8)
-# CHECK-NEXT: Flags [ (0x3)
+# CHECK-NEXT: Name: .text
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x6)
# CHECK-NEXT: SHF_ALLOC (0x2)
-# CHECK-NEXT: SHF_WRITE (0x1)
+# CHECK-NEXT: SHF_EXECINSTR (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x11000
# CHECK-NEXT: Offset: 0x1000
-# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Size: 12
# 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: .text
+# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT: Flags [ (0x6)
+# 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: Address: 0x1100C
+# CHECK-NEXT: Offset: 0x100C
+# CHECK-NEXT: Size: 0
# 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: .data
-# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Name: .bss
+# CHECK-NEXT: Type: SHT_NOBITS (0x8)
# 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=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic32be.s (original)
+++ lld/trunk/test/elf2/basic32be.s Tue Sep 29 18:05:40 2015
@@ -52,15 +52,15 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 1
-# CHECK-NEXT: Name: .bss
-# CHECK-NEXT: Type: SHT_NOBITS (0x8)
-# CHECK-NEXT: Flags [ (0x3)
+# CHECK-NEXT: Name: .text
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x6)
# CHECK-NEXT: SHF_ALLOC (0x2)
-# CHECK-NEXT: SHF_WRITE (0x1)
+# CHECK-NEXT: SHF_EXECINSTR (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x11000
# CHECK-NEXT: Offset: 0x1000
-# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Size: 12
# 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: .text
+# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
-# CHECK-NEXT: Flags [ (0x6)
+# 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: Address: 0x1100C
+# CHECK-NEXT: Offset: 0x100C
+# CHECK-NEXT: Size: 0
# 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: .data
-# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Name: .bss
+# CHECK-NEXT: Type: SHT_NOBITS (0x8)
# 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=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic64be.s (original)
+++ lld/trunk/test/elf2/basic64be.s Tue Sep 29 18:05:40 2015
@@ -59,22 +59,6 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 1
-# CHECK-NEXT: Name: .bss
-# CHECK-NEXT: Type: SHT_NOBITS (0x8)
-# CHECK-NEXT: Flags [ (0x3)
-# CHECK-NEXT: SHF_ALLOC (0x2)
-# CHECK-NEXT: SHF_WRITE (0x1)
-# CHECK-NEXT: ]
-# CHECK-NEXT: Address: 0x11000
-# CHECK-NEXT: Offset: 0x1000
-# CHECK-NEXT: Size: 0
-# CHECK-NEXT: Link: 0
-# CHECK-NEXT: Info: 0
-# CHECK-NEXT: AddressAlignment: 4
-# CHECK-NEXT: EntrySize: 0
-# CHECK-NEXT: }
-# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 2
# CHECK-NEXT: Name: .text
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x6)
@@ -92,7 +76,7 @@ _start:
# CHECK: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 3
+# CHECK-NEXT: Index: 2
# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
@@ -110,7 +94,7 @@ _start:
# CHECK: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 4
+# CHECK-NEXT: Index: 3
# CHECK-NEXT: Name: .opd
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
@@ -130,6 +114,22 @@ _start:
# CHECK-NEXT: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 4
+# CHECK-NEXT: Name: .bss
+# CHECK-NEXT: Type: SHT_NOBITS (0x8)
+# CHECK-NEXT: Flags [ (0x3)
+# CHECK-NEXT: SHF_ALLOC (0x2)
+# CHECK-NEXT: SHF_WRITE (0x1)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x12018
+# CHECK-NEXT: Offset: 0x2018
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 4
+# CHECK-NEXT: EntrySize: 0
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 5
# CHECK-NEXT: Name: .symtab
# CHECK-NEXT: Type: SHT_SYMTAB
Modified: lld/trunk/test/elf2/bss.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/bss.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/bss.s (original)
+++ lld/trunk/test/elf2/bss.s Tue Sep 29 18:05:40 2015
@@ -19,17 +19,6 @@
// CHECK-NEXT: AddressAlignment: 4
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: }
-// CHECK-NEXT: Section {
-// CHECK-NEXT: Index:
-// 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
-
.global _start
_start:
Modified: lld/trunk/test/elf2/discard-none.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/discard-none.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/discard-none.s (original)
+++ lld/trunk/test/elf2/discard-none.s Tue Sep 29 18:05:40 2015
@@ -40,7 +40,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: .Lmyothervar
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value: 0x102C
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
@@ -49,7 +49,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: .Lmyvar
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value: 0x102C
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
Modified: lld/trunk/test/elf2/dynamic-reloc-index.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/dynamic-reloc-index.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/dynamic-reloc-index.s (original)
+++ lld/trunk/test/elf2/dynamic-reloc-index.s Tue Sep 29 18:05:40 2015
@@ -8,7 +8,7 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x11000 R_X86_64_64 bar 0x0
+// CHECK-NEXT: 0x12000 R_X86_64_64 bar 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
Modified: lld/trunk/test/elf2/dynamic-reloc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/dynamic-reloc.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/dynamic-reloc.s (original)
+++ lld/trunk/test/elf2/dynamic-reloc.s Tue Sep 29 18:05:40 2015
@@ -6,15 +6,7 @@
// RUN: llvm-readobj -dynamic-table -r --expand-relocs -s %t | FileCheck %s
// REQUIRES: x86
-// CHECK: Name: .text
-// CHECK-NEXT: Type: SHT_PROGBITS
-// CHECK-NEXT: Flags [
-// CHECK-NEXT: SHF_ALLOC
-// CHECK-NEXT: SHF_EXECINSTR
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: [[ADDR:.*]]
-
-// CHECK: Index: 4
+// CHECK: Index: 1
// CHECK-NEXT: Name: .dynsym
// CHECK: Name: .rela.dyn
@@ -25,11 +17,19 @@
// CHECK-NEXT: Address: [[RELAADDR:.*]]
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: [[RELASIZE:.*]]
-// CHECK-NEXT: Link: 4
+// CHECK-NEXT: Link: 1
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 24
+// CHECK: Name: .text
+// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_ALLOC
+// CHECK-NEXT: SHF_EXECINSTR
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: [[ADDR:.*]]
+
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: Relocation {
Modified: lld/trunk/test/elf2/got.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/got.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/got.s (original)
+++ lld/trunk/test/elf2/got.s Tue Sep 29 18:05:40 2015
@@ -12,7 +12,7 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x15000
+// CHECK-NEXT: Address: 0x13080
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 16
// CHECK-NEXT: Link: 0
@@ -21,22 +21,22 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x15000 R_X86_64_GLOB_DAT bar 0x0
-// CHECK-NEXT: 0x15008 R_X86_64_GLOB_DAT zed 0x0
+// CHECK-NEXT: 0x13080 R_X86_64_GLOB_DAT bar 0x0
+// CHECK-NEXT: 0x13088 R_X86_64_GLOB_DAT zed 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
// Unfortunately FileCheck can't do math, so we have to check for explicit
// values:
-// 0x15000 - (0x11000 + 2) - 4 = 16378
-// 0x15000 - (0x11006 + 2) - 4 = 16372
-// 0x15008 - (0x1100c + 2) - 4 = 16374
+// 0x13080 - (0x12000 + 2) - 4 = 4218
+// 0x13080 - (0x12006 + 2) - 4 = 4212
+// 0x13088 - (0x1200c + 2) - 4 = 4214
// DISASM: _start:
-// DISASM-NEXT: 11000: ff 25 fa 3f 00 00 jmpq *16378(%rip)
-// DISASM-NEXT: 11006: ff 25 f4 3f 00 00 jmpq *16372(%rip)
-// DISASM-NEXT: 1100c: ff 25 f6 3f 00 00 jmpq *16374(%rip)
+// DISASM-NEXT: 12000: {{.*}} jmpq *4218(%rip)
+// DISASM-NEXT: 12006: {{.*}} jmpq *4212(%rip)
+// DISASM-NEXT: 1200c: {{.*}} jmpq *4214(%rip)
.global _start
_start:
Modified: lld/trunk/test/elf2/local-dynamic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/local-dynamic.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/local-dynamic.s (original)
+++ lld/trunk/test/elf2/local-dynamic.s Tue Sep 29 18:05:40 2015
@@ -16,7 +16,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: blah
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value: 0x1050
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
@@ -25,7 +25,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: foo
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value: 0x1050
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
@@ -34,7 +34,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: goo
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value: 0x1050
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
@@ -43,7 +43,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: _start
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value: 0x1050
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
@@ -64,7 +64,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: _start@
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value: 0x1050
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
Modified: lld/trunk/test/elf2/plt-i686.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/plt-i686.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/plt-i686.s (original)
+++ lld/trunk/test/elf2/plt-i686.s Tue Sep 29 18:05:40 2015
@@ -12,7 +12,7 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_EXECINSTR
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x16000
+// CHECK-NEXT: Address: 0x12010
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 16
// CHECK-NEXT: Link: 0
@@ -21,34 +21,34 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rel.dyn {
-// CHECK-NEXT: 0x15000 R_386_GLOB_DAT bar 0x0
-// CHECK-NEXT: 0x15004 R_386_GLOB_DAT zed 0x0
+// CHECK-NEXT: 0x13040 R_386_GLOB_DAT bar 0x0
+// CHECK-NEXT: 0x13044 R_386_GLOB_DAT zed 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
// Unfortunately FileCheck can't do math, so we have to check for explicit
// values:
-// 0x16000 - (0x11000 + 1) - 4 = 20475
-// 0x16000 - (0x11005 + 1) - 4 = 20470
-// 0x16008 - (0x1100a + 1) - 4 = 20473
+// 0x12010 - (0x12000 + 1) - 4 = 11
+// 0x12010 - (0x12005 + 1) - 4 = 2
+// 0x12018 - (0x1200a + 1) - 4 = 9
// DISASM: _start:
-// DISASM-NEXT: 11000: e9 fb 4f 00 00 jmp 20475
-// DISASM-NEXT: 11005: e9 f6 4f 00 00 jmp 20470
-// DISASM-NEXT: 1100a: e9 f9 4f 00 00 jmp 20473
+// DISASM-NEXT: 12000: e9 0b 00 00 00 jmp 11
+// DISASM-NEXT: 12005: e9 06 00 00 00 jmp 6
+// DISASM-NEXT: 1200a: e9 09 00 00 00 jmp 9
-// 0x15000 = 86016
-// 0x15004 = 86020
+// 0x13040 = 77888
+// 0x13044 = 77892
// DISASM: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 16000: ff 25 00 50 01 00 jmpl *86016
-// DISASM-NEXT: 16006: 90 nop
-// DISASM-NEXT: 16007: 90 nop
-// DISASM-NEXT: 16008: ff 25 04 50 01 00 jmpl *86020
-// DISASM-NEXT: 1600e: 90 nop
-// DISASM-NEXT: 1600f: 90 nop
+// DISASM-NEXT: 12010: ff 25 {{.*}} jmpl *77888
+// DISASM-NEXT: 12016: 90 nop
+// DISASM-NEXT: 12017: 90 nop
+// DISASM-NEXT: 12018: ff 25 {{.*}} jmpl *77892
+// DISASM-NEXT: 1201e: 90 nop
+// DISASM-NEXT: 1201f: 90 nop
.global _start
_start:
Modified: lld/trunk/test/elf2/plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/plt.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/plt.s (original)
+++ lld/trunk/test/elf2/plt.s Tue Sep 29 18:05:40 2015
@@ -12,7 +12,7 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_EXECINSTR
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x16000
+// CHECK-NEXT: Address: 0x12020
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 24
// CHECK-NEXT: Link: 0
@@ -21,35 +21,35 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x15000 R_X86_64_GLOB_DAT bar 0x0
-// CHECK-NEXT: 0x15008 R_X86_64_GLOB_DAT zed 0x0
-// CHECK-NEXT: 0x15010 R_X86_64_GLOB_DAT _start 0x0
+// CHECK-NEXT: 0x13080 R_X86_64_GLOB_DAT bar 0x0
+// CHECK-NEXT: 0x13088 R_X86_64_GLOB_DAT zed 0x0
+// CHECK-NEXT: 0x13090 R_X86_64_GLOB_DAT _start 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
// Unfortunately FileCheck can't do math, so we have to check for explicit
// values:
-// 0x16000 - (0x11000 + 1) - 4 = 20475
-// 0x16000 - (0x11005 + 1) - 4 = 20470
-// 0x16008 - (0x1100a + 1) - 4 = 20473
+// 0x12020 - (0x12000 + 1) - 4 = 27
+// 0x12020 - (0x12005 + 1) - 4 = 22
+// 0x12028 - (0x1200a + 1) - 4 = 25
// DISASM: _start:
-// DISASM-NEXT: 11000: e9 fb 4f 00 00 jmp 20475
-// DISASM-NEXT: 11005: e9 f6 4f 00 00 jmp 20470
-// DISASM-NEXT: 1100a: e9 f9 4f 00 00 jmp 20473
+// DISASM-NEXT: 12000: e9 {{.*}} jmp 27
+// DISASM-NEXT: 12005: e9 {{.*}} jmp 22
+// DISASM-NEXT: 1200a: e9 {{.*}} jmp 25
-// 0x15000 - 0x16006 = -4102
-// 0x15008 - 0x1600e = -4102
+// 0x13080 - 0x12026 = 4186
+// 0x13088 - 0x1202e = 4186
// DISASM: Disassembly of section .plt:
// DISASM-NEXT: .plt:
-// DISASM-NEXT: 16000: ff 25 fa ef ff ff jmpq *-4102(%rip)
-// DISASM-NEXT: 16006: 90 nop
-// DISASM-NEXT: 16007: 90 nop
-// DISASM-NEXT: 16008: ff 25 fa ef ff ff jmpq *-4102(%rip)
-// DISASM-NEXT: 1600e: 90 nop
-// DISASM-NEXT: 1600f: 90 nop
+// DISASM-NEXT: 12020: ff 25 {{.*}} jmpq *4186(%rip)
+// DISASM-NEXT: 12026: 90 nop
+// DISASM-NEXT: 12027: 90 nop
+// DISASM-NEXT: 12028: ff 25 {{.*}} jmpq *4186(%rip)
+// DISASM-NEXT: 1202e: 90 nop
+// DISASM-NEXT: 1202f: 90 nop
.global _start
_start:
Modified: lld/trunk/test/elf2/relocation-common.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation-common.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation-common.s (original)
+++ lld/trunk/test/elf2/relocation-common.s Tue Sep 29 18:05:40 2015
@@ -10,5 +10,5 @@ _start:
.global sym1
.comm sym1,4,4
-// CHECK: 12000: {{.*}} movl $1, -4106(%rip)
-// CHECK: 0000000000011000 g .bss 00000004 sym1
+// CHECK: 11000: {{.*}} movl $1, 4086(%rip)
+// CHECK: 0000000000012000 g .bss 00000004 sym1
Modified: lld/trunk/test/elf2/relocation-i686.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation-i686.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation-i686.s (original)
+++ lld/trunk/test/elf2/relocation-i686.s Tue Sep 29 18:05:40 2015
@@ -27,14 +27,14 @@ R_386_PC32_2:
// CHECK: Disassembly of section .R_386_32:
// CHECK-NEXT: R_386_32:
-// CHECK-NEXT: 11000: {{.*}} movl $69633, %edx
+// CHECK-NEXT: 12000: {{.*}} movl $73729, %edx
// CHECK: Disassembly of section .R_386_PC32:
// CHECK-NEXT: R_386_PC32:
-// CHECK-NEXT: 11005: e8 04 00 00 00 calll 4
+// CHECK-NEXT: 12005: e8 04 00 00 00 calll 4
// CHECK: R_386_PC32_2:
-// CHECK-NEXT: 1100e: 90 nop
+// CHECK-NEXT: 1200e: 90 nop
// Create a .got
movl bar at GOT, %eax
@@ -46,23 +46,23 @@ movl bar at GOT, %eax
// ADDR-NEXT: SHF_ALLOC
// ADDR-NEXT: SHF_WRITE
// ADDR-NEXT: ]
-// ADDR-NEXT: Address: 0x15000
+// ADDR-NEXT: Address: 0x13040
.section .R_386_GOTPC,"ax", at progbits
R_386_GOTPC:
movl $_GLOBAL_OFFSET_TABLE_, %eax
-// 0x15000 - 0x11014 = 16364
+// 0x13040 - 0x12014 = 4140
// CHECK: Disassembly of section .R_386_GOTPC:
// CHECK-NEXT: R_386_GOTPC:
-// CHECK-NEXT: 11014: {{.*}} movl $16364, %eax
+// CHECK-NEXT: 12014: {{.*}} movl $4140, %eax
.section .dynamic_reloc, "ax", at progbits
call bar+4
// CHECK: Disassembly of section .dynamic_reloc:
// CHECK-NEXT: .dynamic_reloc:
-// CHECK-NEXT: 11019: e8 00 00 00 00 calll 0
+// CHECK-NEXT: 12019: e8 00 00 00 00 calll 0
.section .R_386_GOT32,"ax", at progbits
.global R_386_GOT32
@@ -71,4 +71,4 @@ R_386_GOT32:
// This is the second symbol in the got, so the offset is 4.
// CHECK: Disassembly of section .R_386_GOT32:
// CHECK-NEXT: R_386_GOT32:
-// CHECK-NEXT: 1101e: {{.*}} movl 4, %eax
+// CHECK-NEXT: 1201e: {{.*}} movl 4, %eax
Modified: lld/trunk/test/elf2/relocation-local.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation-local.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation-local.s (original)
+++ lld/trunk/test/elf2/relocation-local.s Tue Sep 29 18:05:40 2015
@@ -20,7 +20,7 @@ R_X86_64_32:
// constants in hex.
// CHECK: Disassembly of section .text2:
// CHECK-NEXT: R_X86_64_32:
-// CHECK-NEXT: 1100c: {{.*}} movl $69644, %edx
+// CHECK-NEXT: 12009: {{.*}} movl $73737, %edx
.section .R_X86_64_32S,"ax", at progbits
R_X86_64_32S:
@@ -28,11 +28,11 @@ R_X86_64_32S:
// CHECK: Disassembly of section .R_X86_64_32S:
// CHECK-NEXT: R_X86_64_32S:
-// CHECK-NEXT: {{.*}}: {{.*}} movq -978935, %rdx
+// CHECK-NEXT: {{.*}}: {{.*}} movq -974839, %rdx
.section .R_X86_64_64,"a", at progbits
R_X86_64_64:
.quad R_X86_64_64
// CHECK: Contents of section .R_X86_64_64:
-// CHECK-NEXT: 12000 00200100 00000000
+// CHECK-NEXT: 11000 00100100 00000000
Modified: lld/trunk/test/elf2/relocation.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation.s (original)
+++ lld/trunk/test/elf2/relocation.s Tue Sep 29 18:05:40 2015
@@ -32,11 +32,11 @@ lulz:
// CHECK: Disassembly of section .text:
// CHECK-NEXT: _start:
-// CHECK-NEXT: 11000: e8 04 00 00 00 callq 4
-// CHECK-NEXT: 11005:
+// CHECK-NEXT: 12000: e8 04 00 00 00 callq 4
+// CHECK-NEXT: 12005:
// CHECK: lulz:
-// CHECK-NEXT: 11009: 90 nop
+// CHECK-NEXT: 12009: 90 nop
.section .text2,"ax", at progbits
@@ -48,7 +48,7 @@ R_X86_64_32:
// constants in hex.
// CHECK: Disassembly of section .text2:
// CHECK-NEXT: R_X86_64_32:
-// CHECK-NEXT: 1100c: {{.*}} movl $69644, %edx
+// CHECK-NEXT: 1200a: {{.*}} movl $73738, %edx
.section .R_X86_64_32S,"ax", at progbits
.global R_X86_64_32S
@@ -57,7 +57,7 @@ R_X86_64_32S:
// CHECK: Disassembly of section .R_X86_64_32S:
// CHECK-NEXT: R_X86_64_32S:
-// CHECK-NEXT: {{.*}}: {{.*}} movq -978935, %rdx
+// CHECK-NEXT: {{.*}}: {{.*}} movq -974839, %rdx
.section .R_X86_64_64,"a", at progbits
.global R_X86_64_64
@@ -65,7 +65,7 @@ R_X86_64_64:
.quad R_X86_64_64
// CHECK: Contents of section .R_X86_64_64:
-// CHECK-NEXT: 12000 00200100 00000000
+// CHECK-NEXT: 11000 00100100 00000000
.section .R_X86_64_GOTPCREL,"a", at progbits
.global R_X86_64_GOTPCREL
@@ -75,4 +75,4 @@ R_X86_64_GOTPCREL:
// 0x13000 - 0x12008 = 4088
// 4088 = 0xf80f0000 in little endian
// CHECK: Contents of section .R_X86_64_GOTPCREL
-// CHECK-NEXT: 12008 f80f0000
+// CHECK-NEXT: 11008 f81f0000
Added: lld/trunk/test/elf2/section-layout.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/section-layout.s?rev=248845&view=auto
==============================================================================
--- lld/trunk/test/elf2/section-layout.s (added)
+++ lld/trunk/test/elf2/section-layout.s Tue Sep 29 18:05:40 2015
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: lld -flavor gnu2 %t -o %tout
+# RUN: llvm-readobj -sections %tout | FileCheck %s
+# REQUIRES: x86
+
+# Check that sections are laid out in the correct order.
+
+.global _start
+.text
+_start:
+
+.section h,""
+.section g,"", at nobits
+.section f,"aw", at nobits
+.section e,"aw"
+.section d,"ax", at nobits
+.section c,"ax"
+.section b,"a", at nobits
+.section a,"a"
+
+// CHECK: Name: a
+// CHECK: Name: b
+// CHECK: Name: c
+// CHECK: Name: d
+// CHECK: Name: e
+// CHECK: Name: f
+// CHECK: Name: h
+// CHECK: Name: g
Modified: lld/trunk/test/elf2/shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/shared.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/shared.s (original)
+++ lld/trunk/test/elf2/shared.s Tue Sep 29 18:05:40 2015
@@ -14,7 +14,7 @@
// SO-NEXT: Flags [
// SO-NEXT: ]
// SO-NEXT: Address:
-// SO-NEXT: Offset: 0x300C
+// SO-NEXT: Offset: 0x2028
// SO-NEXT: Size:
// SO-NEXT: Link:
// SO-NEXT: Info:
@@ -39,14 +39,14 @@
// CHECK-NEXT: }
// test that .hash is linked to .dynsym
-// CHECK: Index: 5
+// CHECK: Index: 2
// CHECK-NEXT: Name: .dynsym
// CHECK-NEXT: Type: SHT_DYNSYM
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: ]
// CHECK-NEXT: Address: [[DYNSYMADDR:.*]]
-// CHECK-NEXT: Offset: 0x201C
+// CHECK-NEXT: Offset: 0x101C
// CHECK-NEXT: Size:
// CHECK-NEXT: Link: [[DYNSTR:.*]]
// CHECK-NEXT: Info: 1
@@ -60,7 +60,7 @@
// CHECK-NEXT: )
// CHECK-NEXT: }
// CHECK-NEXT: Section {
-// CHECK-NEXT: Index: 6
+// CHECK-NEXT: Index: 3
// CHECK-NEXT: Name: .hash
// CHECK-NEXT: Type: SHT_HASH
// CHECK-NEXT: Flags [
@@ -69,29 +69,11 @@
// CHECK-NEXT: Address: [[HASHADDR:.*]]
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size:
-// CHECK-NEXT: Link: 5
+// CHECK-NEXT: Link: 2
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 4
// CHECK-NEXT: EntrySize: 4
-
-// CHECK: Name: .dynamic
-// CHECK-NEXT: Type: SHT_DYNAMIC
-// CHECK-NEXT: Flags [
-// CHECK-NEXT: SHF_ALLOC
-// CHECK-NEXT: SHF_WRITE
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: [[ADDR:.*]]
-// CHECK-NEXT: Offset: [[OFFSET:.*]]
-// CHECK-NEXT: Size: [[SIZE:.*]]
-// CHECK-NEXT: Link: [[DYNSTR]]
-// CHECK-NEXT: Info: 0
-// CHECK-NEXT: AddressAlignment: [[ALIGN:.*]]
-// CHECK-NEXT: EntrySize: 8
-// CHECK-NEXT: SectionData (
-// CHECK: )
-// CHECK-NEXT: }
-
// CHECK: Index: [[DYNSTR]]
// CHECK-NEXT: Name: .dynstr
// CHECK-NEXT: Type: SHT_STRTAB
@@ -118,6 +100,22 @@
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: [[RELSIZE:.*]]
+// CHECK: Name: .dynamic
+// CHECK-NEXT: Type: SHT_DYNAMIC
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_ALLOC
+// CHECK-NEXT: SHF_WRITE
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: [[ADDR:.*]]
+// CHECK-NEXT: Offset: [[OFFSET:.*]]
+// CHECK-NEXT: Size: [[SIZE:.*]]
+// CHECK-NEXT: Link: [[DYNSTR]]
+// CHECK-NEXT: Info: 0
+// CHECK-NEXT: AddressAlignment: [[ALIGN:.*]]
+// CHECK-NEXT: EntrySize: 8
+// CHECK-NEXT: SectionData (
+// CHECK: )
+// CHECK-NEXT: }
// CHECK: Symbols [
// CHECK-NEXT: Symbol {
@@ -131,7 +129,7 @@
// 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
// CHECK-NEXT: Type: None
@@ -170,7 +168,7 @@
// 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
// CHECK-NEXT: Type: Non
Modified: lld/trunk/test/elf2/symbols.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/symbols.s?rev=248845&r1=248844&r2=248845&view=diff
==============================================================================
--- lld/trunk/test/elf2/symbols.s (original)
+++ lld/trunk/test/elf2/symbols.s Tue Sep 29 18:05:40 2015
@@ -45,15 +45,12 @@ hidden:
.internal internal
internal:
-// CHECK: Name: .bss
+// CHECK: Name: foobar
// CHECK-NEXT: Type: SHT_NOBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
-// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x11000
-// CHECK-NEXT: Offset: 0x1000
-// CHECK-NEXT: Size: 4
// CHECK: Name: .text
// CHECK-NEXT: Type: SHT_PROGBITS
@@ -63,12 +60,15 @@ internal:
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x12000
-// CHECK: Name: foobar
+// CHECK: Name: .bss
// CHECK-NEXT: Type: SHT_NOBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
+// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x13000
+// CHECK-NEXT: Offset: 0x2000
+// CHECK-NEXT: Size: 4
// CHECK: Symbols [
// CHECK-NEXT: Symbol {
@@ -109,7 +109,7 @@ internal:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: common
-// CHECK-NEXT: Value: 0x11000
+// CHECK-NEXT: Value: 0x13000
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Object
@@ -127,7 +127,7 @@ internal:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: protected
-// CHECK-NEXT: Value: 0x13008
+// CHECK-NEXT: Value: 0x11008
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
@@ -136,7 +136,7 @@ internal:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: zed
-// CHECK-NEXT: Value: 0x13000
+// CHECK-NEXT: Value: 0x11000
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
// CHECK-NEXT: Type: None
@@ -145,7 +145,7 @@ internal:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: zed2
-// CHECK-NEXT: Value: 0x13004
+// CHECK-NEXT: Value: 0x11004
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
@@ -154,7 +154,7 @@ internal:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: zed3
-// CHECK-NEXT: Value: 0x13008
+// CHECK-NEXT: Value: 0x11008
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: None
More information about the llvm-commits
mailing list