[lld] r250836 - [ELF2] .shstrtab section implemented
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 10:21:35 PDT 2015
Author: grimar
Date: Tue Oct 20 12:21:35 2015
New Revision: 250836
URL: http://llvm.org/viewvc/llvm-project?rev=250836&view=rev
Log:
[ELF2] .shstrtab section implemented
The section header table index of the entry that is associated with the section name string table.
Differential Revision: http://reviews.llvm.org/D13904
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
lld/trunk/ELF/Writer.cpp
lld/trunk/test/elf2/basic-aarch64.s
lld/trunk/test/elf2/basic-mips.s
lld/trunk/test/elf2/basic.s
lld/trunk/test/elf2/basic32.s
lld/trunk/test/elf2/basic64be.s
lld/trunk/test/elf2/discard-locals.s
lld/trunk/test/elf2/discard-none.s
lld/trunk/test/elf2/emulation.s
lld/trunk/test/elf2/ppc64-shared-rel-toc.s
lld/trunk/test/elf2/shared.s
lld/trunk/test/elf2/string-table.s
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Oct 20 12:21:35 2015
@@ -625,9 +625,8 @@ unsigned MergeOutputSection<ELFT>::getOf
}
template <class ELFT>
-StringTableSection<ELFT>::StringTableSection(bool Dynamic)
- : OutputSectionBase<ELFT>(Dynamic ? ".dynstr" : ".strtab",
- llvm::ELF::SHT_STRTAB,
+StringTableSection<ELFT>::StringTableSection(StringRef Name, bool Dynamic)
+ : OutputSectionBase<ELFT>(Name, llvm::ELF::SHT_STRTAB,
Dynamic ? (uintX_t)llvm::ELF::SHF_ALLOC : 0),
Dynamic(Dynamic) {
this->Header.sh_addralign = 1;
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Tue Oct 20 12:21:35 2015
@@ -249,7 +249,7 @@ template <class ELFT>
class StringTableSection final : public OutputSectionBase<ELFT> {
public:
typedef typename llvm::object::ELFFile<ELFT>::uintX_t uintX_t;
- StringTableSection(bool Dynamic);
+ StringTableSection(StringRef Name, bool Dynamic);
void add(StringRef S) { StrTabBuilder.add(S); }
size_t getFileOff(StringRef S) const { return StrTabBuilder.getOffset(S); }
StringRef data() const { return StrTabBuilder.data(); }
@@ -321,6 +321,7 @@ template <class ELFT> struct Out {
static RelocationSection<ELFT> *RelaDyn;
static RelocationSection<ELFT> *RelaPlt;
static StringTableSection<ELFT> *DynStrTab;
+ static StringTableSection<ELFT> *ShStrTab;
static StringTableSection<ELFT> *StrTab;
static SymbolTableSection<ELFT> *DynSymTab;
static SymbolTableSection<ELFT> *SymTab;
@@ -338,6 +339,7 @@ template <class ELFT> PltSection<ELFT> *
template <class ELFT> RelocationSection<ELFT> *Out<ELFT>::RelaDyn;
template <class ELFT> RelocationSection<ELFT> *Out<ELFT>::RelaPlt;
template <class ELFT> StringTableSection<ELFT> *Out<ELFT>::DynStrTab;
+template <class ELFT> StringTableSection<ELFT> *Out<ELFT>::ShStrTab;
template <class ELFT> StringTableSection<ELFT> *Out<ELFT>::StrTab;
template <class ELFT> SymbolTableSection<ELFT> *Out<ELFT>::DynSymTab;
template <class ELFT> SymbolTableSection<ELFT> *Out<ELFT>::SymTab;
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Oct 20 12:21:35 2015
@@ -94,9 +94,11 @@ template <class ELFT> void lld::elf2::wr
// Don't reorder because the order of initialization matters.
InterpSection<ELFT> Interp;
Out<ELFT>::Interp = &Interp;
- StringTableSection<ELFT> StrTab(false);
+ StringTableSection<ELFT> ShStrTab(".shstrtab", false);
+ Out<ELFT>::ShStrTab = &ShStrTab;
+ StringTableSection<ELFT> StrTab(".strtab", false);
Out<ELFT>::StrTab = &StrTab;
- StringTableSection<ELFT> DynStrTab(true);
+ StringTableSection<ELFT> DynStrTab(".dynstr", true);
Out<ELFT>::DynStrTab = &DynStrTab;
OutputSection<ELFT> Bss(".bss", SHT_NOBITS, SHF_ALLOC | SHF_WRITE);
Out<ELFT>::Bss = &Bss;
@@ -516,6 +518,7 @@ template <class ELFT> void Writer<ELFT>:
// This order is not the same as the final output order
// because we sort the sections using their attributes below.
OutputSections.push_back(Out<ELFT>::SymTab);
+ OutputSections.push_back(Out<ELFT>::ShStrTab);
OutputSections.push_back(Out<ELFT>::StrTab);
if (isOutputDynamic()) {
OutputSections.push_back(Out<ELFT>::DynSymTab);
@@ -541,7 +544,7 @@ template <class ELFT> void Writer<ELFT>:
OutputSections[I]->SectionIndex = I + 1;
for (OutputSectionBase<ELFT> *Sec : OutputSections)
- Out<ELFT>::StrTab->add(Sec->getName());
+ Out<ELFT>::ShStrTab->add(Sec->getName());
// Fill the DynStrTab early because Dynamic adds strings to
// DynStrTab but .dynstr may appear before .dynamic.
@@ -739,14 +742,14 @@ template <class ELFT> void Writer<ELFT>:
EHdr->e_phnum = Phdrs.size();
EHdr->e_shentsize = sizeof(Elf_Shdr);
EHdr->e_shnum = getNumSections();
- EHdr->e_shstrndx = Out<ELFT>::StrTab->SectionIndex;
+ EHdr->e_shstrndx = Out<ELFT>::ShStrTab->SectionIndex;
memcpy(Buf + EHdr->e_phoff, &Phdrs[0], Phdrs.size() * sizeof(Phdrs[0]));
auto SHdrs = reinterpret_cast<Elf_Shdr *>(Buf + EHdr->e_shoff);
// First entry is null.
++SHdrs;
for (OutputSectionBase<ELFT> *Sec : OutputSections) {
- Sec->setNameOffset(Out<ELFT>::StrTab->getFileOff(Sec->getName()));
+ Sec->setNameOffset(Out<ELFT>::ShStrTab->getFileOff(Sec->getName()));
Sec->writeHeaderTo(SHdrs++);
}
}
Modified: lld/trunk/test/elf2/basic-aarch64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic-aarch64.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic-aarch64.s (original)
+++ lld/trunk/test/elf2/basic-aarch64.s Tue Oct 20 12:21:35 2015
@@ -26,14 +26,14 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]]
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x1088
+# CHECK-NEXT: SectionHeaderOffset: 0x1098
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
# CHECK-NEXT: ProgramHeaderEntrySize: 56
# CHECK-NEXT: ProgramHeaderCount: 3
# CHECK-NEXT: SectionHeaderEntrySize: 64
-# CHECK-NEXT: SectionHeaderCount: 6
+# CHECK-NEXT: SectionHeaderCount: 7
# CHECK-NEXT: StringTableSectionIndex: 5
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
@@ -108,20 +108,34 @@ _start:
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1010
# CHECK-NEXT: Size: 72
-# CHECK-NEXT: Link: 5
+# CHECK-NEXT: Link: 6
# CHECK-NEXT: Info: 2
# CHECK-NEXT: AddressAlignment: 8
# CHECK-NEXT: EntrySize: 24
-# CHECK-NEXT: }
-# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 5
-# CHECK-NEXT: Name: .strtab
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 5
+# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1058
-# CHECK-NEXT: Size: 46
+# CHECK-NEXT: Size: 44
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 0
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 6
+# CHECK-NEXT: Name: .strtab (22)
+# CHECK-NEXT: Type: SHT_STRTAB (0x3)
+# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x1084
+# CHECK-NEXT: Size: 13
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
@@ -139,7 +153,7 @@ _start:
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: $x.0 (41)
+# CHECK-NEXT: Name: $x.0
# CHECK-NEXT: Value: 0x11000
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local (0x0)
@@ -148,7 +162,7 @@ _start:
# CHECK-NEXT: Section: .text
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _start (7)
+# CHECK-NEXT: Name: _start
# CHECK-NEXT: Value: [[ENTRY]]
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global (0x1)
Modified: lld/trunk/test/elf2/basic-mips.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic-mips.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic-mips.s (original)
+++ lld/trunk/test/elf2/basic-mips.s Tue Oct 20 12:21:35 2015
@@ -27,14 +27,14 @@ __start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x20000
# CHECK-NEXT: ProgramHeaderOffset: 0x34
-# CHECK-NEXT: SectionHeaderOffset: 0x10074
+# CHECK-NEXT: SectionHeaderOffset: 0x10080
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 52
# CHECK-NEXT: ProgramHeaderEntrySize: 32
# CHECK-NEXT: ProgramHeaderCount: 3
# CHECK-NEXT: SectionHeaderEntrySize: 40
-# CHECK-NEXT: SectionHeaderCount: 8
+# CHECK-NEXT: SectionHeaderCount: 9
# CHECK-NEXT: StringTableSectionIndex: 7
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
@@ -54,7 +54,7 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 1
-# CHECK-NEXT: Name: .reginfo (35)
+# CHECK-NEXT: Name: .reginfo
# CHECK-NEXT: Type: SHT_MIPS_REGINFO (0x70000006)
# CHECK-NEXT: Flags [ (0x2)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -69,7 +69,7 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 2
-# CHECK-NEXT: Name: .MIPS.abiflags (20)
+# CHECK-NEXT: Name: .MIPS.abiflags
# CHECK-NEXT: Type: SHT_MIPS_ABIFLAGS (0x7000002A)
# CHECK-NEXT: Flags [ (0x2)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -100,7 +100,7 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 4
-# CHECK-NEXT: Name: .data (60)
+# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -116,7 +116,7 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 5
-# CHECK-NEXT: Name: .bss (15)
+# CHECK-NEXT: Name: .bss (7)
# CHECK-NEXT: Type: SHT_NOBITS (0x8)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -132,27 +132,41 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 6
-# CHECK-NEXT: Name: .symtab (52)
+# CHECK-NEXT: Name: .symtab
# CHECK-NEXT: Type: SHT_SYMTAB (0x2)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x10010
# CHECK-NEXT: Size: 32
-# CHECK-NEXT: Link: 7
+# CHECK-NEXT: Link: 8
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 4
# CHECK-NEXT: EntrySize: 16
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 7
-# CHECK-NEXT: Name: .strtab (44)
+# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x10030
-# CHECK-NEXT: Size: 66
+# CHECK-NEXT: Size: 68
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 0
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 8
+# CHECK-NEXT: Name: .strtab (46)
+# CHECK-NEXT: Type: SHT_STRTAB (0x3)
+# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x10074
+# CHECK-NEXT: Size: 9
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
@@ -170,7 +184,7 @@ __start:
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: __start (7)
+# CHECK-NEXT: Name: __start
# CHECK-NEXT: Value: 0x20000
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global (0x1)
Modified: lld/trunk/test/elf2/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic.s (original)
+++ lld/trunk/test/elf2/basic.s Tue Oct 20 12:21:35 2015
@@ -27,14 +27,14 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]]
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x1070
+# CHECK-NEXT: SectionHeaderOffset: 0x1078
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
# CHECK-NEXT: ProgramHeaderEntrySize: 56
# CHECK-NEXT: ProgramHeaderCount: 3
# CHECK-NEXT: SectionHeaderEntrySize: 64
-# CHECK-NEXT: SectionHeaderCount: 6
+# CHECK-NEXT: SectionHeaderCount: 7
# CHECK-NEXT: StringTableSectionIndex: 5
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
@@ -109,20 +109,34 @@ _start:
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1010
# CHECK-NEXT: Size: 48
-# CHECK-NEXT: Link: 5
+# CHECK-NEXT: Link: 6
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 8
# CHECK-NEXT: EntrySize: 24
-# CHECK-NEXT: }
-# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 5
-# CHECK-NEXT: Name: .strtab
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 5
+# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1040
-# CHECK-NEXT: Size: 41
+# CHECK-NEXT: Size: 44
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 0
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 6
+# CHECK-NEXT: Name: .strtab (22)
+# CHECK-NEXT: Type: SHT_STRTAB (0x3)
+# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x106C
+# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
@@ -140,7 +154,7 @@ _start:
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: _start (7)
+# CHECK-NEXT: Name: _start
# CHECK-NEXT: Value: [[ENTRY]]
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global (0x1)
@@ -189,7 +203,6 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: ]
-
# Test for the response file
# RUN: echo " -o %t2" > %t.responsefile
# RUN: ld.lld2 %t @%t.responsefile
Modified: lld/trunk/test/elf2/basic32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic32.s (original)
+++ lld/trunk/test/elf2/basic32.s Tue Oct 20 12:21:35 2015
@@ -25,14 +25,14 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x11000
# CHECK-NEXT: ProgramHeaderOffset: 0x34
-# CHECK-NEXT: SectionHeaderOffset: 0x1058
+# CHECK-NEXT: SectionHeaderOffset: 0x1060
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 52
# CHECK-NEXT: ProgramHeaderEntrySize: 32
# CHECK-NEXT: ProgramHeaderCount: 3
# CHECK-NEXT: SectionHeaderEntrySize: 40
-# CHECK-NEXT: SectionHeaderCount: 6
+# CHECK-NEXT: SectionHeaderCount: 7
# CHECK-NEXT: StringTableSectionIndex: 5
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
@@ -107,20 +107,34 @@ _start:
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x100C
# CHECK-NEXT: Size: 32
-# CHECK-NEXT: Link: 5
+# CHECK-NEXT: Link: 6
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 4
# CHECK-NEXT: EntrySize: 16
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 5
-# CHECK-NEXT: Name: .strtab
+# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x102C
-# CHECK-NEXT: Size: 41
+# CHECK-NEXT: Size: 44
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 0
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 6
+# CHECK-NEXT: Name: .strtab (22)
+# CHECK-NEXT: Type: SHT_STRTAB (0x3)
+# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x1058
+# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
Modified: lld/trunk/test/elf2/basic64be.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic64be.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic64be.s (original)
+++ lld/trunk/test/elf2/basic64be.s Tue Oct 20 12:21:35 2015
@@ -38,14 +38,14 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x10020040
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x200C8
+# CHECK-NEXT: SectionHeaderOffset: 0x200D0
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
# CHECK-NEXT: ProgramHeaderEntrySize: 56
# CHECK-NEXT: ProgramHeaderCount: 4
# CHECK-NEXT: SectionHeaderEntrySize: 64
-# CHECK-NEXT: SectionHeaderCount: 9
+# CHECK-NEXT: SectionHeaderCount: 10
# CHECK-NEXT: StringTableSectionIndex: 8
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
@@ -85,7 +85,7 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 2
-# CHECK-NEXT: Name: .data (45)
+# CHECK-NEXT: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -103,7 +103,7 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 3
-# CHECK-NEXT: Name: .toc (24)
+# CHECK-NEXT: Name: .toc
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -123,7 +123,7 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 4
-# CHECK-NEXT: Name: .toc1 (51)
+# CHECK-NEXT: Name: .toc1
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -143,7 +143,7 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 5
-# CHECK-NEXT: Name: .opd (19)
+# CHECK-NEXT: Name: .opd
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -163,7 +163,7 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 6
-# CHECK-NEXT: Name: .bss (14)
+# CHECK-NEXT: Name: .bss
# CHECK-NEXT: Type: SHT_NOBITS (0x8)
# CHECK-NEXT: Flags [ (0x3)
# CHECK-NEXT: SHF_ALLOC (0x2)
@@ -179,14 +179,14 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 7
-# CHECK-NEXT: Name: .symtab (37)
+# CHECK-NEXT: Name: .symtab
# CHECK-NEXT: Type: SHT_SYMTAB (0x2)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x20058
# CHECK-NEXT: Size: 48
-# CHECK-NEXT: Link: 8
+# CHECK-NEXT: Link: 9
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 8
# CHECK-NEXT: EntrySize: 24
@@ -195,13 +195,13 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 8
-# CHECK-NEXT: Name: .strtab (29)
+# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x20088
-# CHECK-NEXT: Size: 57
+# CHECK-NEXT: Size: 60
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
@@ -209,6 +209,23 @@ _start:
# CHECK-NEXT: SectionData (
# CHECK: )
# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 9
+# CHECK-NEXT: Name: .strtab (32)
+# CHECK-NEXT: Type: SHT_STRTAB (0x3)
+# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x200C4
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 0
+# CHECK-NEXT: SectionData (
+# CHECK-NEXT: 0000: 005F7374 61727400 |._start.|
+# CHECK-NEXT: )
+# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: ProgramHeaders [
# CHECK-NEXT: ProgramHeader {
Modified: lld/trunk/test/elf2/discard-locals.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/discard-locals.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/discard-locals.s (original)
+++ lld/trunk/test/elf2/discard-locals.s Tue Oct 20 12:21:35 2015
@@ -23,9 +23,7 @@ _start:
// CHECK-NEXT: AddressAlignment:
// CHECK-NEXT: EntrySize:
// CHECK-NEXT: SectionData (
-// CHECK-NEXT: 0000: 002E7465 7874005F 73746172 74002E62 |..text._start..b|
-// CHECK-NEXT: 0010: 7373002E 73747274 6162002E 73796D74 |ss..strtab..symt|
-// CHECK-NEXT: 0020: 6162002E 64617461 00 |ab..data.|
+// CHECK-NEXT: 0000: 005F7374 61727400 |._start.|
// CHECK-NEXT: )
// CHECK-NEXT: }
// CHECK-NEXT: ]
Modified: lld/trunk/test/elf2/discard-none.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/discard-none.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/discard-none.s (original)
+++ lld/trunk/test/elf2/discard-none.s Tue Oct 20 12:21:35 2015
@@ -20,12 +20,8 @@
// CHECK-NEXT: AddressAlignment:
// CHECK-NEXT: EntrySize:
// CHECK-NEXT: SectionData (
-// CHECK-NEXT: 0000: 002E7465 7874002E 62737300 2E64796E |..text..bss..dyn|
-// CHECK-NEXT: 0010: 73747200 2E4C6D79 76617200 2E4C6D79 |str..Lmyvar..Lmy|
-// CHECK-NEXT: 0020: 6F746865 72766172 002E6479 6E73796D |othervar..dynsym|
-// CHECK-NEXT: 0030: 002E6861 7368002E 64796E61 6D696300 |..hash..dynamic.|
-// CHECK-NEXT: 0040: 2E737472 74616200 2E73796D 74616200 |.strtab..symtab.|
-// CHECK-NEXT: 0050: 2E646174 6100 |.data.|
+// CHECK-NEXT: 0000: 002E4C6D 79766172 002E4C6D 796F7468 |..Lmyvar..Lmyoth|
+// CHECK-NEXT: 0010: 65727661 7200 |ervar.|
// CHECK-NEXT: )
// CHECK-NEXT: }
Modified: lld/trunk/test/elf2/emulation.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/emulation.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/emulation.s (original)
+++ lld/trunk/test/elf2/emulation.s Tue Oct 20 12:21:35 2015
@@ -18,14 +18,14 @@
# X86-64-NEXT: Version: 1
# X86-64-NEXT: Entry: 0x100B0
# X86-64-NEXT: ProgramHeaderOffset: 0x40
-# X86-64-NEXT: SectionHeaderOffset: 0x110
+# X86-64-NEXT: SectionHeaderOffset: 0x118
# X86-64-NEXT: Flags [ (0x0)
# X86-64-NEXT: ]
# X86-64-NEXT: HeaderSize: 64
# X86-64-NEXT: ProgramHeaderEntrySize: 56
# X86-64-NEXT: ProgramHeaderCount: 2
# X86-64-NEXT: SectionHeaderEntrySize: 64
-# X86-64-NEXT: SectionHeaderCount: 6
+# X86-64-NEXT: SectionHeaderCount: 7
# X86-64-NEXT: StringTableSectionIndex: 5
# X86-64-NEXT: }
@@ -49,14 +49,14 @@
# X86-NEXT: Version: 1
# X86-NEXT: Entry: 0x10074
# X86-NEXT: ProgramHeaderOffset: 0x34
-# X86-NEXT: SectionHeaderOffset: 0xC0
+# X86-NEXT: SectionHeaderOffset: 0xC8
# X86-NEXT: Flags [ (0x0)
# X86-NEXT: ]
# X86-NEXT: HeaderSize: 52
# X86-NEXT: ProgramHeaderEntrySize: 32
# X86-NEXT: ProgramHeaderCount: 2
# X86-NEXT: SectionHeaderEntrySize: 40
-# X86-NEXT: SectionHeaderCount: 6
+# X86-NEXT: SectionHeaderCount: 7
# X86-NEXT: StringTableSectionIndex: 5
# X86-NEXT: }
@@ -80,14 +80,14 @@
# PPC64-NEXT: Version: 1
# PPC64-NEXT: Entry: 0x100000B0
# PPC64-NEXT: ProgramHeaderOffset: 0x40
-# PPC64-NEXT: SectionHeaderOffset: 0x110
+# PPC64-NEXT: SectionHeaderOffset: 0x118
# PPC64-NEXT: Flags [ (0x0)
# PPC64-NEXT: ]
# PPC64-NEXT: HeaderSize: 64
# PPC64-NEXT: ProgramHeaderEntrySize: 56
# PPC64-NEXT: ProgramHeaderCount: 2
# PPC64-NEXT: SectionHeaderEntrySize: 64
-# PPC64-NEXT: SectionHeaderCount: 6
+# PPC64-NEXT: SectionHeaderCount: 7
# PPC64-NEXT: StringTableSectionIndex: 5
# PPC64-NEXT: }
@@ -111,7 +111,7 @@
# MIPS-NEXT: Version: 1
# MIPS-NEXT: Entry: 0x100B0
# MIPS-NEXT: ProgramHeaderOffset: 0x34
-# MIPS-NEXT: SectionHeaderOffset: 0x114
+# MIPS-NEXT: SectionHeaderOffset: 0x11C
# MIPS-NEXT: Flags [ (0x0)
# MIPS-NEXT: ]
@@ -135,7 +135,7 @@
# MIPSEL-NEXT: Version: 1
# MIPSEL-NEXT: Entry: 0x100B0
# MIPSEL-NEXT: ProgramHeaderOffset: 0x34
-# MIPSEL-NEXT: SectionHeaderOffset: 0x114
+# MIPSEL-NEXT: SectionHeaderOffset: 0x11C
# MIPSEL-NEXT: Flags [ (0x0)
# MIPSEL-NEXT: ]
Modified: lld/trunk/test/elf2/ppc64-shared-rel-toc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/ppc64-shared-rel-toc.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/ppc64-shared-rel-toc.s (original)
+++ lld/trunk/test/elf2/ppc64-shared-rel-toc.s Tue Oct 20 12:21:35 2015
@@ -22,6 +22,6 @@ foo:
// CHECK: 0x20090 R_PPC64_RELATIVE - 0x10000
// CHECK: 0x20098 R_PPC64_RELATIVE - 0x8000
-// CHECK: Name: foo (20)
+// CHECK: Name: foo
// CHECK-NEXT: Value: 0x20090
Modified: lld/trunk/test/elf2/shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/shared.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/shared.s (original)
+++ lld/trunk/test/elf2/shared.s Tue Oct 20 12:21:35 2015
@@ -162,7 +162,7 @@
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: zed (62)
+// CHECK-NEXT: Name: zed
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Global (0x1)
Modified: lld/trunk/test/elf2/string-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/string-table.s?rev=250836&r1=250835&r2=250836&view=diff
==============================================================================
--- lld/trunk/test/elf2/string-table.s (original)
+++ lld/trunk/test/elf2/string-table.s Tue Oct 20 12:21:35 2015
@@ -44,22 +44,38 @@ _start:
// Test that the string "bar" is merged into "foobar".
-// CHECK: Section {
-// CHECK: Index:
+// CHECK: Section {
+// CHECK: Index:
+// CHECK: Name: .shstrtab
+// CHECK-NEXT: Type: SHT_STRTAB
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x0
+// CHECK-NEXT: Offset:
+// CHECK-NEXT: Size: 51
+// CHECK-NEXT: Link: 0
+// CHECK-NEXT: Info: 0
+// CHECK-NEXT: AddressAlignment: 1
+// CHECK-NEXT: EntrySize: 0
+// CHECK-NEXT: SectionData (
+// CHECK-NEXT: 0000: 002E7465 7874002E 62737300 666F6F62 |..text..bss.foob|
+// CHECK-NEXT: 0010: 6172002E 73687374 72746162 002E7374 |ar..shstrtab..st|
+// CHECK-NEXT: 0020: 72746162 002E7379 6D746162 002E6461 |rtab..symtab..da|
+// CHECK-NEXT: 0030: 746100 |ta.|
+// CHECK-NEXT: )
+// CHECK-NEXT:}
// CHECK: Name: .strtab
// CHECK-NEXT: Type: SHT_STRTAB (0x3)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x0
// CHECK-NEXT: Offset:
-// CHECK-NEXT: Size: 48
+// CHECK-NEXT: Size: 15
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 1
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: SectionData (
-// CHECK-NEXT: 0000: 002E7465 7874005F 73746172 74002E62 |..text._start..b|
-// CHECK-NEXT: 0010: 73730066 6F6F6261 72002E73 74727461 |ss.foobar..strta|
-// CHECK-NEXT: 0020: 62002E73 796D7461 62002E64 61746100 |b..symtab..data.|
+// CHECK-NEXT: 0000: 005F7374 61727400 666F6F62 617200 |._start.foobar.|
// CHECK-NEXT: )
// CHECK-NEXT: }
More information about the llvm-commits
mailing list