[lld] r286496 - Include version string into ".comment" section.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 10 12:20:37 PST 2016
Author: ruiu
Date: Thu Nov 10 14:20:37 2016
New Revision: 286496
URL: http://llvm.org/viewvc/llvm-project?rev=286496&view=rev
Log:
Include version string into ".comment" section.
Summary:
This patch adds a ".comment" section to an output. The comment
section contains the linker's version string. You can now
find out whether a binary is created by LLD or not using objdump
command like this.
$ objdump -s -j .comment foo
foo: file format elf64-x86-64
Contents of section .comment:
0000 00474343 3a202855 62756e74 7520342e .GCC: (Ubuntu 4.
0010 382e342d 32756275 6e747531 7e31342e 8.4-2ubuntu1~14.
...
00c0 766d2f74 72756e6b 20323835 38343629 vm/trunk 285846)
00d0 004c696e 6b65723a 204c4c44 20342e30 .Linker: LLD 4.0
00e0 2e302028 7472756e 6b203238 36343036 .0 (trunk 286406
00f0 2900 ).
Compilers emits .comment section as well, so the output contains
both compiler and linker information.
Alternative considered:
I first tried to add a SHT_NOTE section because GNU gold does that.
A NOTE section starts with a header which contains content type.
It turned out that ld.gold sets type NT_GNU_GOLD_VERSION to their
NOTE section. So the NOTE type is only for GNU gold (surprise!)
Next, I tried to create ".linker-version" section. However, it seems
that reusing the existing ".comment" section is better because 1)
other tools already know about .comment section and is able to strip
it and 2) the result contans not only linker info but also compiler
info.
Differential Revision: https://reviews.llvm.org/D26487
Modified:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/SyntheticSections.h
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/aarch64-gnu-ifunc.s
lld/trunk/test/ELF/basic-aarch64.s
lld/trunk/test/ELF/basic-mips.s
lld/trunk/test/ELF/basic-ppc.s
lld/trunk/test/ELF/basic.s
lld/trunk/test/ELF/basic32.s
lld/trunk/test/ELF/basic64be.s
lld/trunk/test/ELF/build-id.s
lld/trunk/test/ELF/comment-gc.s
lld/trunk/test/ELF/gnu-ifunc-i386.s
lld/trunk/test/ELF/gnu-ifunc.s
lld/trunk/test/ELF/linkerscript/sections-keep.s
lld/trunk/test/ELF/linkerscript/sections-sort.s
lld/trunk/test/ELF/linkerscript/sections.s
lld/trunk/test/ELF/linkerscript/wildcards.s
lld/trunk/test/ELF/pie.s
lld/trunk/test/ELF/relocatable-bss.s
lld/trunk/test/ELF/relocatable.s
lld/trunk/test/ELF/section-name.s
lld/trunk/test/ELF/shared.s
lld/trunk/test/ELF/string-table.s
lld/trunk/test/lit.cfg
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Nov 10 14:20:37 2016
@@ -25,12 +25,14 @@
#include "Target.h"
#include "Writer.h"
+#include "lld/Config/Version.h"
#include "lld/Core/Parallel.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/RandomNumberGenerator.h"
#include "llvm/Support/SHA1.h"
#include "llvm/Support/xxhash.h"
+#include <cstdlib>
using namespace llvm;
using namespace llvm::ELF;
@@ -78,6 +80,36 @@ template <class ELFT> InputSection<ELFT>
return Ret;
}
+// Returns an LLD version string.
+static ArrayRef<uint8_t> getVersion() {
+ // Check LLD_VERSION first for ease of testing.
+ // You can get consitent output by using the environment variable.
+ // This is only for testing.
+ StringRef S = getenv("LLD_VERSION");
+ if (S.empty())
+ S = Saver.save(Twine("Linker: ") + getLLDVersion());
+
+ // +1 to include the terminating '\0'.
+ return {(const uint8_t *)S.data(), S.size() + 1};
+};
+
+// Creates a .comment section containing LLD version info.
+// With this feature, you can identify LLD-generated binaries easily
+// by "objdump -s -j .comment <file>".
+// The returned object is a mergeable string section.
+template <class ELFT> MergeInputSection<ELFT> *elf::createCommentSection() {
+ typename ELFT::Shdr Hdr = {};
+ Hdr.sh_flags = SHF_MERGE | SHF_STRINGS;
+ Hdr.sh_type = SHT_PROGBITS;
+ Hdr.sh_entsize = 1;
+ Hdr.sh_addralign = 1;
+
+ auto *Ret = make<MergeInputSection<ELFT>>(/*file=*/nullptr, &Hdr, ".comment");
+ Ret->Data = getVersion();
+ Ret->splitIntoPieces();
+ return Ret;
+}
+
// Iterate over sections of the specified type. For each section call
// provided function. After that "kill" the section by turning off
// "Live" flag, so that they won't be included in the final output.
@@ -352,6 +384,11 @@ template InputSection<ELF32BE> *elf::cre
template InputSection<ELF64LE> *elf::createInterpSection();
template InputSection<ELF64BE> *elf::createInterpSection();
+template MergeInputSection<ELF32LE> *elf::createCommentSection();
+template MergeInputSection<ELF32BE> *elf::createCommentSection();
+template MergeInputSection<ELF64LE> *elf::createCommentSection();
+template MergeInputSection<ELF64BE> *elf::createCommentSection();
+
template class elf::MipsAbiFlagsSection<ELF32LE>;
template class elf::MipsAbiFlagsSection<ELF32BE>;
template class elf::MipsAbiFlagsSection<ELF64LE>;
Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Thu Nov 10 14:20:37 2016
@@ -149,6 +149,7 @@ private:
template <class ELFT> InputSection<ELFT> *createCommonSection();
template <class ELFT> InputSection<ELFT> *createInterpSection();
+template <class ELFT> MergeInputSection<ELFT> *createCommentSection();
// Linker generated sections which can be used as inputs.
template <class ELFT> struct In {
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Nov 10 14:20:37 2016
@@ -268,6 +268,8 @@ template <class ELFT> void Writer<ELFT>:
Out<ELFT>::VerDef = make<VersionDefinitionSection<ELFT>>();
// Initialize linker generated sections
+ Symtab<ELFT>::X->Sections.push_back(createCommentSection<ELFT>());
+
if (Config->BuildId == BuildIdKind::Fast)
In<ELFT>::BuildId = make<BuildIdFastHash<ELFT>>();
else if (Config->BuildId == BuildIdKind::Md5)
Modified: lld/trunk/test/ELF/aarch64-gnu-ifunc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-gnu-ifunc.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-gnu-ifunc.s (original)
+++ lld/trunk/test/ELF/aarch64-gnu-ifunc.s Thu Nov 10 14:20:37 2016
@@ -15,7 +15,7 @@
// CHECK-NEXT: Address: [[RELA:.*]]
// CHECK-NEXT: Offset: 0x158
// CHECK-NEXT: Size: 48
-// CHECK-NEXT: Link: 5
+// CHECK-NEXT: Link: 6
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 24
Modified: lld/trunk/test/ELF/basic-aarch64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-aarch64.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic-aarch64.s (original)
+++ lld/trunk/test/ELF/basic-aarch64.s Thu Nov 10 14:20:37 2016
@@ -26,15 +26,15 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]]
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x10088
+# CHECK-NEXT: SectionHeaderOffset: 0x10098
# 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: 5
-# CHECK-NEXT: StringTableSectionIndex: 3
+# CHECK-NEXT: SectionHeaderCount: 6
+# CHECK-NEXT: StringTableSectionIndex: 4
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
# CHECK-NEXT: Section {
@@ -69,40 +69,56 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 2
+# CHECK-NEXT: Name: .comment
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x30)
+# CHECK-NEXT: SHF_MERGE (0x10)
+# CHECK-NEXT: SHF_STRINGS (0x20)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x1000C
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 1
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 3
# 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: Offset: 0x10018
# CHECK-NEXT: Size: 72
-# CHECK-NEXT: Link: 4
+# CHECK-NEXT: Link: 5
# CHECK-NEXT: Info: 2
# CHECK-NEXT: AddressAlignment: 8
# CHECK-NEXT: EntrySize: 24
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 3
+# CHECK-NEXT: Index: 4
# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x10058
-# CHECK-NEXT: Size: 33
+# CHECK-NEXT: Offset: 0x10060
+# CHECK-NEXT: Size: 42
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 4
+# CHECK-NEXT: Index: 5
# CHECK-NEXT: Name: .strtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x10079
+# CHECK-NEXT: Offset: 0x1008A
# CHECK-NEXT: Size: 13
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Modified: lld/trunk/test/ELF/basic-mips.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-mips.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic-mips.s (original)
+++ lld/trunk/test/ELF/basic-mips.s Thu Nov 10 14:20:37 2016
@@ -27,7 +27,7 @@ __start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x20000
# CHECK-NEXT: ProgramHeaderOffset: 0x34
-# CHECK-NEXT: SectionHeaderOffset: 0x30088
+# CHECK-NEXT: SectionHeaderOffset: 0x30098
# CHECK-NEXT: Flags [
# CHECK-NEXT: EF_MIPS_ABI_O32
# CHECK-NEXT: EF_MIPS_ARCH_32
@@ -37,8 +37,8 @@ __start:
# CHECK-NEXT: ProgramHeaderEntrySize: 32
# CHECK-NEXT: ProgramHeaderCount: 6
# CHECK-NEXT: SectionHeaderEntrySize: 40
-# CHECK-NEXT: SectionHeaderCount: 10
-# CHECK-NEXT: StringTableSectionIndex: 8
+# CHECK-NEXT: SectionHeaderCount: 11
+# CHECK-NEXT: StringTableSectionIndex: 9
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
# CHECK-NEXT: Section {
@@ -152,40 +152,56 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 7
+# CHECK-NEXT: Name: .comment
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x30)
+# CHECK-NEXT: SHF_MERGE (0x10)
+# CHECK-NEXT: SHF_STRINGS (0x20)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x30000
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 1
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 8
# CHECK-NEXT: Name: .symtab
# CHECK-NEXT: Type: SHT_SYMTAB (0x2)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x30000
+# CHECK-NEXT: Offset: 0x30008
# CHECK-NEXT: Size: 48
-# CHECK-NEXT: Link: 9
+# CHECK-NEXT: Link: 10
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 4
# CHECK-NEXT: EntrySize: 16
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 8
+# CHECK-NEXT: Index: 9
# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x30030
-# CHECK-NEXT: Size: 73
+# CHECK-NEXT: Offset: 0x30038
+# CHECK-NEXT: Size: 82
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 9
+# CHECK-NEXT: Index: 10
# CHECK-NEXT: Name: .strtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x30079
+# CHECK-NEXT: Offset: 0x3008A
# CHECK-NEXT: Size: 13
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Modified: lld/trunk/test/ELF/basic-ppc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-ppc.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic-ppc.s (original)
+++ lld/trunk/test/ELF/basic-ppc.s Thu Nov 10 14:20:37 2016
@@ -28,15 +28,15 @@
// CHECK-NEXT: Version: 1
// CHECK-NEXT: Entry: 0x0
// CHECK-NEXT: ProgramHeaderOffset: 0x34
-// CHECK-NEXT: SectionHeaderOffset: 0x209C
+// CHECK-NEXT: SectionHeaderOffset: 0x20AC
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: HeaderSize: 52
// CHECK-NEXT: ProgramHeaderEntrySize: 32
// CHECK-NEXT: ProgramHeaderCount: 7
// CHECK-NEXT: SectionHeaderEntrySize: 40
-// CHECK-NEXT: SectionHeaderCount: 9
-// CHECK-NEXT: StringTableSectionIndex: 7
+// CHECK-NEXT: SectionHeaderCount: 10
+// CHECK-NEXT: StringTableSectionIndex: 8
// CHECK-NEXT: }
// CHECK-NEXT: Sections [
// CHECK-NEXT: Section {
@@ -151,14 +151,33 @@
// CHECK-NEXT: }
// CHECK-NEXT: Section {
// CHECK-NEXT: Index: 6
+// CHECK-NEXT: Name: .comment
+// CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+// CHECK-NEXT: Flags [ (0x30)
+// CHECK-NEXT: SHF_MERGE (0x10)
+// CHECK-NEXT: SHF_STRINGS (0x20)
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x0
+// CHECK-NEXT: Offset: 0x2030
+// CHECK-NEXT: Size: 8
+// CHECK-NEXT: Link: 0
+// CHECK-NEXT: Info: 0
+// CHECK-NEXT: AddressAlignment: 1
+// CHECK-NEXT: EntrySize: 1
+// CHECK-NEXT: SectionData (
+// CHECK-NEXT: 0000: 4C4C4420 312E3000 |LLD 1.0.|
+// CHECK-NEXT: )
+// CHECK-NEXT: }
+// CHECK-NEXT: Section {
+// CHECK-NEXT: Index: 7
// CHECK-NEXT: Name: .symtab
// CHECK-NEXT: Type: SHT_SYMTAB (0x2)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x0
-// CHECK-NEXT: Offset: 0x2030
+// CHECK-NEXT: Offset: 0x2038
// CHECK-NEXT: Size: 32
-// CHECK-NEXT: Link: 8
+// CHECK-NEXT: Link: 9
// CHECK-NEXT: Info: 1
// CHECK-NEXT: AddressAlignment: 4
// CHECK-NEXT: EntrySize: 16
@@ -168,14 +187,14 @@
// CHECK-NEXT: )
// CHECK-NEXT: }
// CHECK-NEXT: Section {
-// CHECK-NEXT: Index: 7
+// CHECK-NEXT: Index: 8
// CHECK-NEXT: Name: .shstrtab
// CHECK-NEXT: Type: SHT_STRTAB (0x3)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x0
-// CHECK-NEXT: Offset: 0x2050
-// CHECK-NEXT: Size: 64
+// CHECK-NEXT: Offset: 0x2058
+// CHECK-NEXT: Size: 73
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 1
@@ -183,18 +202,19 @@
// CHECK-NEXT: SectionData (
// CHECK-NEXT: 0000: 002E6479 6E73796D 002E6861 7368002E |..dynsym..hash..|
// CHECK-NEXT: 0010: 64796E73 7472002E 74657874 002E6479 |dynstr..text..dy|
-// CHECK-NEXT: 0020: 6E616D69 63002E73 796D7461 62002E73 |namic..symtab..s|
-// CHECK-NEXT: 0030: 68737472 74616200 2E737472 74616200 |hstrtab..strtab.|
+// CHECK-NEXT: 0020: 6E616D69 63002E63 6F6D6D65 6E74002E |namic..comment..|
+// CHECK-NEXT: 0030: 73796D74 6162002E 73687374 72746162 |symtab..shstrtab|
+// CHECK-NEXT: 0040: 002E7374 72746162 00 |..strtab.|
// CHECK-NEXT: )
// CHECK-NEXT: }
// CHECK-NEXT: Section {
-// CHECK-NEXT: Index: 8
+// CHECK-NEXT: Index: 9
// CHECK-NEXT: Name: .strtab
// CHECK-NEXT: Type: SHT_STRTAB (0x3)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x0
-// CHECK-NEXT: Offset: 0x2090
+// CHECK-NEXT: Offset: 0x20A1
// CHECK-NEXT: Size: 1
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
Modified: lld/trunk/test/ELF/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic.s (original)
+++ lld/trunk/test/ELF/basic.s Thu Nov 10 14:20:37 2016
@@ -27,15 +27,15 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]]
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x1070
+# CHECK-NEXT: SectionHeaderOffset: 0x1080
# 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: 5
-# CHECK-NEXT: StringTableSectionIndex: 3
+# CHECK-NEXT: SectionHeaderCount: 6
+# CHECK-NEXT: StringTableSectionIndex: 4
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
# CHECK-NEXT: Section {
@@ -70,40 +70,56 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 2
+# CHECK-NEXT: Name: .comment
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x30)
+# CHECK-NEXT: SHF_MERGE (0x10)
+# CHECK-NEXT: SHF_STRINGS (0x20)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x1010
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 1
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 3
# CHECK-NEXT: Name: .symtab
# CHECK-NEXT: Type: SHT_SYMTAB (0x2)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x1010
+# CHECK-NEXT: Offset: 0x1018
# CHECK-NEXT: Size: 48
-# CHECK-NEXT: Link: 4
+# CHECK-NEXT: Link: 5
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 8
# CHECK-NEXT: EntrySize: 24
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 3
+# CHECK-NEXT: Index: 4
# 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: 33
+# CHECK-NEXT: Offset: 0x1048
+# CHECK-NEXT: Size: 42
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 4
+# CHECK-NEXT: Index: 5
# CHECK-NEXT: Name: .strtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x1061
+# CHECK-NEXT: Offset: 0x1072
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Modified: lld/trunk/test/ELF/basic32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic32.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic32.s (original)
+++ lld/trunk/test/ELF/basic32.s Thu Nov 10 14:20:37 2016
@@ -25,15 +25,15 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x11000
# CHECK-NEXT: ProgramHeaderOffset: 0x34
-# CHECK-NEXT: SectionHeaderOffset: 0x1058
+# CHECK-NEXT: SectionHeaderOffset: 0x1068
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 52
# CHECK-NEXT: ProgramHeaderEntrySize: 32
# CHECK-NEXT: ProgramHeaderCount: 4
# CHECK-NEXT: SectionHeaderEntrySize: 40
-# CHECK-NEXT: SectionHeaderCount: 5
-# CHECK-NEXT: StringTableSectionIndex: 3
+# CHECK-NEXT: SectionHeaderCount: 6
+# CHECK-NEXT: StringTableSectionIndex: 4
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
# CHECK-NEXT: Section {
@@ -68,40 +68,56 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 2
+# CHECK-NEXT: Name: .comment
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x30)
+# CHECK-NEXT: SHF_MERGE (0x10)
+# CHECK-NEXT: SHF_STRINGS (0x20)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x100C
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 1
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 3
# CHECK-NEXT: Name: .symtab
# CHECK-NEXT: Type: SHT_SYMTAB
# CHECK-NEXT: Flags [
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x100C
+# CHECK-NEXT: Offset: 0x1014
# CHECK-NEXT: Size: 32
-# CHECK-NEXT: Link: 4
+# CHECK-NEXT: Link: 5
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 4
# CHECK-NEXT: EntrySize: 16
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 3
+# CHECK-NEXT: Index: 4
# 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: 33
+# CHECK-NEXT: Offset: 0x1034
+# CHECK-NEXT: Size: 42
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 4
+# CHECK-NEXT: Index: 5
# CHECK-NEXT: Name: .strtab
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x104D
+# CHECK-NEXT: Offset: 0x105E
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Modified: lld/trunk/test/ELF/basic64be.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic64be.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic64be.s (original)
+++ lld/trunk/test/ELF/basic64be.s Thu Nov 10 14:20:37 2016
@@ -38,15 +38,15 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x10020040
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x200C8
+# CHECK-NEXT: SectionHeaderOffset: 0x200D8
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
# CHECK-NEXT: ProgramHeaderEntrySize: 56
# CHECK-NEXT: ProgramHeaderCount: 6
# CHECK-NEXT: SectionHeaderEntrySize: 64
-# CHECK-NEXT: SectionHeaderCount: 9
-# CHECK-NEXT: StringTableSectionIndex: 7
+# CHECK-NEXT: SectionHeaderCount: 10
+# CHECK-NEXT: StringTableSectionIndex: 8
# CHECK-NEXT: }
# CHECK-NEXT: Sections [
# CHECK-NEXT: Section {
@@ -163,14 +163,33 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: Section {
# CHECK-NEXT: Index: 6
+# CHECK-NEXT: Name: .comment
+# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
+# CHECK-NEXT: Flags [ (0x30)
+# CHECK-NEXT: SHF_MERGE (0x10)
+# CHECK-NEXT: SHF_STRINGS (0x20)
+# CHECK-NEXT: ]
+# CHECK-NEXT: Address: 0x0
+# CHECK-NEXT: Offset: 0x20058
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Link: 0
+# CHECK-NEXT: Info: 0
+# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: EntrySize: 1
+# CHECK-NEXT: SectionData (
+# CHECK-NEXT: 0000: 4C4C4420 312E3000 |LLD 1.0.|
+# CHECK-NEXT: )
+# CHECK-NEXT: }
+# CHECK-NEXT: Section {
+# CHECK-NEXT: Index: 7
# 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: Offset: 0x20060
# CHECK-NEXT: Size: 48
-# CHECK-NEXT: Link: 8
+# CHECK-NEXT: Link: 9
# CHECK-NEXT: Info: 1
# CHECK-NEXT: AddressAlignment: 8
# CHECK-NEXT: EntrySize: 24
@@ -178,14 +197,14 @@ _start:
# CHECK: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 7
+# CHECK-NEXT: Index: 8
# CHECK-NEXT: Name: .shstrtab
# CHECK-NEXT: Type: SHT_STRTAB
# CHECK-NEXT: Flags [
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x20088
-# CHECK-NEXT: Size: 54
+# CHECK-NEXT: Offset: 0x20090
+# CHECK-NEXT: Size: 63
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
@@ -194,13 +213,13 @@ _start:
# CHECK: )
# CHECK-NEXT: }
# CHECK-NEXT: Section {
-# CHECK-NEXT: Index: 8
+# CHECK-NEXT: Index: 9
# CHECK-NEXT: Name: .strtab
# CHECK-NEXT: Type: SHT_STRTAB
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
-# CHECK-NEXT: Offset: 0x200BE
+# CHECK-NEXT: Offset: 0x200CF
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Modified: lld/trunk/test/ELF/build-id.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/build-id.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/build-id.s (original)
+++ lld/trunk/test/ELF/build-id.s Thu Nov 10 14:20:37 2016
@@ -34,19 +34,15 @@ _start:
# DEFAULT: Contents of section .note.test:
# DEFAULT: Contents of section .note.gnu.build-id:
# DEFAULT-NEXT: 04000000 08000000 03000000 474e5500 ............GNU.
-# DEFAULT-NEXT: ab
+# DEFAULT-NEXT: 6a
# MD5: Contents of section .note.gnu.build-id:
# MD5-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
-# MD5-NEXT: 29
+# MD5-NEXT: 37
# SHA1: Contents of section .note.gnu.build-id:
# SHA1-NEXT: 04000000 14000000 03000000 474e5500 ............GNU.
-# SHA1-NEXT: b1
-
-# TREE: Contents of section .note.gnu.build-id:
-# TREE-NEXT: 04000000 14000000 03000000 474e5500 ............GNU.
-# TREE-NEXT: 18
+# SHA1-NEXT: 79
# UUID: Contents of section .note.gnu.build-id:
# UUID-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
Modified: lld/trunk/test/ELF/comment-gc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/comment-gc.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/comment-gc.s (original)
+++ lld/trunk/test/ELF/comment-gc.s Thu Nov 10 14:20:37 2016
@@ -5,7 +5,8 @@
# RUN: llvm-objdump -s %t1 | FileCheck %s
# CHECK: Contents of section .comment:
-# CHECK-NEXT: 0000 00666f6f 00626172 00 .foo.bar.
+# CHECK-NEXT: 0000 00666f6f 00626172 004c4c44 20312e30 .foo.bar.LLD 1.0
+# CHECK-NEXT: 0010 00 .
.ident "foo"
Modified: lld/trunk/test/ELF/gnu-ifunc-i386.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-ifunc-i386.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-ifunc-i386.s (original)
+++ lld/trunk/test/ELF/gnu-ifunc-i386.s Thu Nov 10 14:20:37 2016
@@ -15,7 +15,7 @@
// CHECK-NEXT: Address: [[RELA:.*]]
// CHECK-NEXT: Offset: 0xD4
// CHECK-NEXT: Size: 16
-// CHECK-NEXT: Link: 5
+// CHECK-NEXT: Link: 6
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 4
// CHECK-NEXT: EntrySize: 8
Modified: lld/trunk/test/ELF/gnu-ifunc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-ifunc.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-ifunc.s (original)
+++ lld/trunk/test/ELF/gnu-ifunc.s Thu Nov 10 14:20:37 2016
@@ -15,7 +15,7 @@
// CHECK-NEXT: Address: [[RELA:.*]]
// CHECK-NEXT: Offset: 0x158
// CHECK-NEXT: Size: 48
-// CHECK-NEXT: Link: 5
+// CHECK-NEXT: Link: 6
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 24
Modified: lld/trunk/test/ELF/linkerscript/sections-keep.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/sections-keep.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/sections-keep.s (original)
+++ lld/trunk/test/ELF/linkerscript/sections-keep.s Thu Nov 10 14:20:37 2016
@@ -46,9 +46,10 @@
# MIXED1-NEXT: 1 .keep 00000004
# MIXED1-NEXT: 2 .text 00000007 00000000000000ec TEXT DATA
# MIXED1-NEXT: 3 .temp 00000004 00000000000000f3 DATA
-# MIXED1-NEXT: 4 .symtab 00000060 0000000000000000
-# MIXED1-NEXT: 5 .shstrtab 0000002d 0000000000000000
-# MIXED1-NEXT: 6 .strtab 00000012 0000000000000000
+# MIXED1-NEXT: 4 .comment 00000008 0000000000000000
+# MIXED1-NEXT: 5 .symtab 00000060 0000000000000000
+# MIXED1-NEXT: 6 .shstrtab 00000036 0000000000000000
+# MIXED1-NEXT: 7 .strtab 00000012 0000000000000000
## The same, but now section without KEEP is at first place.
## gold and bfd linkers disagree here. gold collects .keep while
@@ -66,9 +67,10 @@
# MIXED2-NEXT: 1 .nokeep 00000004 00000000000000e8 DATA
# MIXED2-NEXT: 2 .text 00000007 00000000000000ec TEXT DATA
# MIXED2-NEXT: 3 .temp 00000004 00000000000000f3 DATA
-# MIXED2-NEXT: 4 .symtab 00000060 0000000000000000
-# MIXED2-NEXT: 5 .shstrtab 0000002f 0000000000000000
-# MIXED2-NEXT: 6 .strtab 00000012 0000000000000000
+# MIXED2-NEXT: 4 .comment 00000008 0000000000000000
+# MIXED2-NEXT: 5 .symtab 00000060 0000000000000000
+# MIXED2-NEXT: 6 .shstrtab 00000038 0000000000000000
+# MIXED2-NEXT: 7 .strtab 00000012 0000000000000000
# Check file pattern for kept sections.
# RUN: echo "SECTIONS { \
Modified: lld/trunk/test/ELF/linkerscript/sections-sort.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/sections-sort.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/sections-sort.s (original)
+++ lld/trunk/test/ELF/linkerscript/sections-sort.s Thu Nov 10 14:20:37 2016
@@ -24,6 +24,7 @@ nop
# CHECK-NEXT: 4 .hash
# CHECK-NEXT: 5 .dynstr
# CHECK-NEXT: 6 .dynamic
-# CHECK-NEXT: 7 .symtab
-# CHECK-NEXT: 8 .shstrtab
-# CHECK-NEXT: 9 .strtab
+# CHECK-NEXT: 7 .comment
+# CHECK-NEXT: 8 .symtab
+# CHECK-NEXT: 9 .shstrtab
+# CHECK-NEXT: 10 .strtab
Modified: lld/trunk/test/ELF/linkerscript/sections.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/sections.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/sections.s (original)
+++ lld/trunk/test/ELF/linkerscript/sections.s Thu Nov 10 14:20:37 2016
@@ -21,9 +21,10 @@
# SEC-DEFAULT: 3 other 00000003 {{[0-9a-f]*}} DATA
# SEC-DEFAULT: 4 .bss 00000002 {{[0-9a-f]*}} BSS
# SEC-DEFAULT: 5 .shstrtab 00000002 {{[0-9a-f]*}}
-# SEC-DEFAULT: 6 .symtab 00000030 {{[0-9a-f]*}}
-# SEC-DEFAULT: 7 .shstrtab 00000032 {{[0-9a-f]*}}
-# SEC-DEFAULT: 8 .strtab 00000008 {{[0-9a-f]*}}
+# SEC-DEFAULT: 6 .comment 00000008 {{[0-9a-f]*}}
+# SEC-DEFAULT: 7 .symtab 00000030 {{[0-9a-f]*}}
+# SEC-DEFAULT: 8 .shstrtab 0000003b {{[0-9a-f]*}}
+# SEC-DEFAULT: 9 .strtab 00000008 {{[0-9a-f]*}}
# Sections are put in order specified in linker script, other than alloc
# sections going first.
@@ -43,7 +44,7 @@
# SEC-ORDER: 1 .bss 00000002 {{[0-9a-f]*}} BSS
# SEC-ORDER: 2 other 00000003 {{[0-9a-f]*}} DATA
# SEC-ORDER: 3 .shstrtab 00000002 {{[0-9a-f]*}}
-# SEC-ORDER: 4 .shstrtab 00000032 {{[0-9a-f]*}}
+# SEC-ORDER: 4 .shstrtab 0000003b {{[0-9a-f]*}}
# SEC-ORDER: 5 .symtab 00000030 {{[0-9a-f]*}}
# SEC-ORDER: 6 .strtab 00000008 {{[0-9a-f]*}}
# SEC-ORDER: 7 .data 00000020 {{[0-9a-f]*}} DATA
@@ -63,9 +64,10 @@
# SEC-SWAP-NAMES: 3 other 00000003 {{[0-9a-f]*}} DATA
# SEC-SWAP-NAMES: 4 .bss 00000002 {{[0-9a-f]*}} BSS
# SEC-SWAP-NAMES: 5 .shstrtab 00000002 {{[0-9a-f]*}}
-# SEC-SWAP-NAMES: 6 .symtab 00000030 {{[0-9a-f]*}}
-# SEC-SWAP-NAMES: 7 .shstrtab 00000032 {{[0-9a-f]*}}
-# SEC-SWAP-NAMES: 8 .strtab 00000008 {{[0-9a-f]*}}
+# SEC-SWAP-NAMES: 6 .comment 00000008 {{[0-9a-f]*}}
+# SEC-SWAP-NAMES: 7 .symtab 00000030 {{[0-9a-f]*}}
+# SEC-SWAP-NAMES: 8 .shstrtab 0000003b {{[0-9a-f]*}}
+# SEC-SWAP-NAMES: 9 .strtab 00000008 {{[0-9a-f]*}}
# .shstrtab from the input object file is discarded.
# RUN: echo "SECTIONS { \
@@ -79,9 +81,10 @@
# SEC-DISCARD: 2 .data 00000020 {{[0-9a-f]*}} DATA
# SEC-DISCARD: 3 other 00000003 {{[0-9a-f]*}} DATA
# SEC-DISCARD: 4 .bss 00000002 {{[0-9a-f]*}} BSS
-# SEC-DISCARD: 5 .symtab 00000030 {{[0-9a-f]*}}
-# SEC-DISCARD: 6 .shstrtab 00000032 {{[0-9a-f]*}}
-# SEC-DISCARD: 7 .strtab 00000008 {{[0-9a-f]*}}
+# SEC-DISCARD: 5 .comment 00000008 {{[0-9a-f]*}}
+# SEC-DISCARD: 6 .symtab 00000030 {{[0-9a-f]*}}
+# SEC-DISCARD: 7 .shstrtab 0000003b {{[0-9a-f]*}}
+# SEC-DISCARD: 8 .strtab 00000008 {{[0-9a-f]*}}
# Multiple SECTIONS command specifying additional input section descriptions
# for the same output section description - input sections are merged into
@@ -100,9 +103,10 @@
# SEC-MULTI: 2 .data 00000023 {{[0-9a-f]*}} DATA
# SEC-MULTI: 3 .bss 00000002 {{[0-9a-f]*}} BSS
# SEC-MULTI: 4 .shstrtab 00000002 {{[0-9a-f]*}}
-# SEC-MULTI: 5 .symtab 00000030 {{[0-9a-f]*}}
-# SEC-MULTI: 6 .shstrtab 0000002c {{[0-9a-f]*}}
-# SEC-MULTI: 7 .strtab 00000008 {{[0-9a-f]*}}
+# SEC-MULTI: 5 .comment 00000008 {{[0-9a-f]*}}
+# SEC-MULTI: 6 .symtab 00000030 {{[0-9a-f]*}}
+# SEC-MULTI: 7 .shstrtab 00000035 {{[0-9a-f]*}}
+# SEC-MULTI: 8 .strtab 00000008 {{[0-9a-f]*}}
.globl _start
_start:
Modified: lld/trunk/test/ELF/linkerscript/wildcards.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/wildcards.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/wildcards.s (original)
+++ lld/trunk/test/ELF/linkerscript/wildcards.s Thu Nov 10 14:20:37 2016
@@ -14,9 +14,10 @@
# SEC-DEFAULT-NEXT: 2 .abcd 00000004
# SEC-DEFAULT-NEXT: 3 .ad 00000004
# SEC-DEFAULT-NEXT: 4 .ag 00000004
-# SEC-DEFAULT-NEXT: 5 .symtab 00000030
-# SEC-DEFAULT-NEXT: 6 .shstrtab 0000002f
-# SEC-DEFAULT-NEXT: 7 .strtab 00000008
+# SEC-DEFAULT-NEXT: 5 .comment 00000008 {{[0-9a-f]*}}
+# SEC-DEFAULT-NEXT: 6 .symtab 00000030
+# SEC-DEFAULT-NEXT: 7 .shstrtab 00000038
+# SEC-DEFAULT-NEXT: 8 .strtab 00000008
## Now replace the symbol with '?' and check that results are the same.
# RUN: echo "SECTIONS { \
@@ -37,9 +38,10 @@
# SEC-ALL-NEXT: 1 .text 0000000c
# SEC-ALL-NEXT: 2 .ad 00000004
# SEC-ALL-NEXT: 3 .ag 00000004
-# SEC-ALL-NEXT: 4 .symtab 00000030
-# SEC-ALL-NEXT: 5 .shstrtab 00000029
-# SEC-ALL-NEXT: 6 .strtab 00000008
+# SEC-ALL-NEXT: 4 .comment 00000008
+# SEC-ALL-NEXT: 5 .symtab 00000030
+# SEC-ALL-NEXT: 6 .shstrtab 00000032
+# SEC-ALL-NEXT: 7 .strtab 00000008
## All sections started with .a are merged.
# RUN: echo "SECTIONS { \
@@ -51,9 +53,10 @@
# SEC-NO-NEXT: Idx Name Size
# SEC-NO-NEXT: 0 00000000
# SEC-NO-NEXT: 1 .text 00000014
-# SEC-NO-NEXT: 2 .symtab 00000030
-# SEC-NO-NEXT: 3 .shstrtab 00000021
-# SEC-NO-NEXT: 4 .strtab 00000008
+# SEC-NO-NEXT: 2 .comment 00000008
+# SEC-NO-NEXT: 3 .symtab 00000030
+# SEC-NO-NEXT: 4 .shstrtab 0000002a
+# SEC-NO-NEXT: 5 .strtab 00000008
.text
.section .abc,"ax", at progbits
Modified: lld/trunk/test/ELF/pie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/pie.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/pie.s (original)
+++ lld/trunk/test/ELF/pie.s Thu Nov 10 14:20:37 2016
@@ -29,15 +29,15 @@
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x1000
# CHECK-NEXT: ProgramHeaderOffset: 0x40
-# CHECK-NEXT: SectionHeaderOffset: 0x1110
+# CHECK-NEXT: SectionHeaderOffset: 0x1120
# CHECK-NEXT: Flags [
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
# CHECK-NEXT: ProgramHeaderEntrySize: 56
# CHECK-NEXT: ProgramHeaderCount: 7
# CHECK-NEXT: SectionHeaderEntrySize: 64
-# CHECK-NEXT: SectionHeaderCount: 9
-# CHECK-NEXT: StringTableSectionIndex: 7
+# CHECK-NEXT: SectionHeaderCount: 10
+# CHECK-NEXT: StringTableSectionIndex: 8
# CHECK-NEXT: }
# CHECK: ProgramHeaders [
Modified: lld/trunk/test/ELF/relocatable-bss.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocatable-bss.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocatable-bss.s (original)
+++ lld/trunk/test/ELF/relocatable-bss.s Thu Nov 10 14:20:37 2016
@@ -20,7 +20,7 @@
# CHECK-NEXT: Version:
# CHECK-NEXT: Entry:
# CHECK-NEXT: ProgramHeaderOffset:
-# CHECK-NEXT: SectionHeaderOffset: 0xA8
+# CHECK-NEXT: SectionHeaderOffset: 0xB8
# CHECK-NEXT: Flags [
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize:
Modified: lld/trunk/test/ELF/relocatable.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocatable.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocatable.s (original)
+++ lld/trunk/test/ELF/relocatable.s Thu Nov 10 14:20:37 2016
@@ -30,15 +30,15 @@
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x0
# CHECK-NEXT: ProgramHeaderOffset: 0x0
-# CHECK-NEXT: SectionHeaderOffset: 0x2C0
+# CHECK-NEXT: SectionHeaderOffset: 0x2D0
# CHECK-NEXT: Flags [
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
# CHECK-NEXT: ProgramHeaderEntrySize: 0
# CHECK-NEXT: ProgramHeaderCount: 0
# CHECK-NEXT: SectionHeaderEntrySize: 64
-# CHECK-NEXT: SectionHeaderCount: 7
-# CHECK-NEXT: StringTableSectionIndex: 5
+# CHECK-NEXT: SectionHeaderCount: 8
+# CHECK-NEXT: StringTableSectionIndex: 6
# CHECK-NEXT: }
# CHECK: Relocations [
@@ -81,15 +81,15 @@
# CHECKEXE-NEXT: Version: 1
# CHECKEXE-NEXT: Entry: 0x11000
# CHECKEXE-NEXT: ProgramHeaderOffset: 0x40
-# CHECKEXE-NEXT: SectionHeaderOffset: 0x11E8
+# CHECKEXE-NEXT: SectionHeaderOffset: 0x11F8
# CHECKEXE-NEXT: Flags [
# CHECKEXE-NEXT: ]
# CHECKEXE-NEXT: HeaderSize: 64
# CHECKEXE-NEXT: ProgramHeaderEntrySize: 56
# CHECKEXE-NEXT: ProgramHeaderCount: 5
# CHECKEXE-NEXT: SectionHeaderEntrySize: 64
-# CHECKEXE-NEXT: SectionHeaderCount: 6
-# CHECKEXE-NEXT: StringTableSectionIndex: 4
+# CHECKEXE-NEXT: SectionHeaderCount: 7
+# CHECKEXE-NEXT: StringTableSectionIndex: 5
# CHECKEXE-NEXT: }
.text
Modified: lld/trunk/test/ELF/section-name.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/section-name.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/section-name.s (original)
+++ lld/trunk/test/ELF/section-name.s Thu Nov 10 14:20:37 2016
@@ -53,6 +53,7 @@ _start:
// CHECK: 9 .foo 00000001
// CHECK: 10 .bss 00000001
// CHECK: 11 .bss 00000001
-// CHECK: 12 .symtab 00000060
-// CHECK: 13 .shstrtab 0000006c
-// CHECK: 14 .strtab 0000001d
+// CHECK: 12 .comment 00000008
+// CHECK: 13 .symtab 00000060
+// CHECK: 14 .shstrtab 00000075
+// CHECK: 15 .strtab 0000001d
Modified: lld/trunk/test/ELF/shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/shared.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/shared.s (original)
+++ lld/trunk/test/ELF/shared.s Thu Nov 10 14:20:37 2016
@@ -14,7 +14,7 @@
// SO-NEXT: Flags [
// SO-NEXT: ]
// SO-NEXT: Address:
-// SO-NEXT: Offset: 0x1030
+// SO-NEXT: Offset: 0x1038
// SO-NEXT: Size:
// SO-NEXT: Link:
// SO-NEXT: Info:
Modified: lld/trunk/test/ELF/string-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/string-table.s?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/ELF/string-table.s (original)
+++ lld/trunk/test/ELF/string-table.s Thu Nov 10 14:20:37 2016
@@ -59,8 +59,9 @@ _start:
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: SectionData (
// CHECK-NEXT: 0000: 00626172 002E7465 78740066 6F6F6261 |.bar..text.fooba|
-// CHECK-NEXT: 0010: 72002E73 796D7461 62002E73 68737472 |r..symtab..shstr|
-// CHECK-NEXT: 0020: 74616200 2E737472 74616200 |tab..strtab.|
+// CHECK-NEXT: 0010: 72002E63 6F6D6D65 6E74002E 73796D74 |r..comment..symt|
+// CHECK-NEXT: 0020: 6162002E 73687374 72746162 002E7374 |ab..shstrtab..st|
+// CHECK-NEXT: 0030: 72746162 00 |rtab.|
// CHECK-NEXT: )
// CHECK-NEXT:}
// CHECK: Name: .strtab
Modified: lld/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg?rev=286496&r1=286495&r2=286496&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg (original)
+++ lld/trunk/test/lit.cfg Thu Nov 10 14:20:37 2016
@@ -246,6 +246,9 @@ if re.search(r'AMDGPU', archs):
config.available_features.add('amdgpu')
llvm_config_cmd.wait()
+# Set a fake constant version so that we get consitent output.
+config.environment['LLD_VERSION'] = 'LLD 1.0'
+
# Check if Windows resource file compiler exists.
cvtres = lit.util.which('cvtres', config.environment['PATH'])
rc = lit.util.which('rc', config.environment['PATH'])
More information about the llvm-commits
mailing list