[lld] r247290 - Create a PT_LOAD program header for the start of the file.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 08:41:35 PDT 2015


Author: rafael
Date: Thu Sep 10 10:41:34 2015
New Revision: 247290

URL: http://llvm.org/viewvc/llvm-project?rev=247290&view=rev
Log:
Create a PT_LOAD program header for the start of the file.

With this a trivial dynamic program works with the musl dynamic linker:

LD_LIBRARY_PATH=.  ~/musl/lib/libc.so ./t

Modified:
    lld/trunk/ELF/Writer.cpp
    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/common.s
    lld/trunk/test/elf2/relocation.s
    lld/trunk/test/elf2/shared.s
    lld/trunk/test/elf2/string-table.s
    lld/trunk/test/elf2/symbols.s
    lld/trunk/test/elf2/visibility.s

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Sep 10 10:41:34 2015
@@ -29,6 +29,13 @@ using namespace lld::elf2;
 
 static const int PageSize = 4096;
 
+// On linux x86_64 mmap of the first 15 pages fails, so the smallest value
+// that can be used in here is 0x10000.
+// If using 2MB pages, the smallest page aligned address that works is
+// 0x200000, but it looks like every OS uses 4k pages for executables.
+// FIXME: This is architecture and OS dependent.
+static const int VAStart = 0x10000;
+
 namespace {
 // OutputSection represents a section in an output file. It's a
 // container of chunks. OutputSection and Chunk are 1:N relationship.
@@ -587,20 +594,22 @@ static bool outputSectionHasPHDR(OutputS
 // Visits all sections to assign incremental, non-overlapping RVAs and
 // file offsets.
 template <class ELFT> void Writer<ELFT>::assignAddresses() {
-  // On linux x86_64 mmap of the first 15 pages fails, so the smallest value
-  // that can be used in here is 0x10000.
-  // If using 2MB pages, the smallest page aligned address that works is
-  // 0x200000, but it looks like every OS uses 4k pages for executables.
-  // FIXME: This is architecture and OS dependent.
-  uintX_t VA = 0x10000;
+  uintX_t VA = VAStart;
+  uintX_t FileOff = 0;
 
-  uintX_t FileOff = sizeof(Elf_Ehdr);
+  FileOff += sizeof(Elf_Ehdr);
+  VA += sizeof(Elf_Ehdr);
 
   // Reserve space for PHDRs.
   ProgramHeaderOff = FileOff;
   FileOff = RoundUpToAlignment(FileOff, PageSize);
+  VA = RoundUpToAlignment(VA, PageSize);
 
   NumPhdrs = 0;
+  // Add a PHDR for the elf header and program headers. Some dynamic linkers
+  // (musl at least) require them to be covered by a PT_LOAD.
+  ++NumPhdrs;
+
   for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
     StrTabSec.add(Sec->getName());
     Sec->finalize();
@@ -681,6 +690,16 @@ template <class ELFT> void Writer<ELFT>:
   EHdr->e_shstrndx = StrTabSec.getSectionIndex();
 
   auto PHdrs = reinterpret_cast<Elf_Phdr *>(Buf + EHdr->e_phoff);
+  PHdrs->p_type = PT_LOAD;
+  PHdrs->p_flags = PF_R;
+  PHdrs->p_offset = 0;
+  PHdrs->p_vaddr = VAStart;
+  PHdrs->p_paddr = PHdrs->p_vaddr;
+  PHdrs->p_filesz = ProgramHeaderOff + NumPhdrs * sizeof(Elf_Phdr);
+  PHdrs->p_memsz = PHdrs->p_filesz;
+  PHdrs->p_align = PageSize;
+  ++PHdrs;
+
   for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
     if (!outputSectionHasPHDR<ELFT>(Sec))
       continue;

Modified: lld/trunk/test/elf2/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic.s (original)
+++ lld/trunk/test/elf2/basic.s Thu Sep 10 10:41:34 2015
@@ -31,7 +31,7 @@ _start:
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   HeaderSize: 64
 # CHECK-NEXT:   ProgramHeaderEntrySize: 56
-# CHECK-NEXT:   ProgramHeaderCount: 1
+# CHECK-NEXT:   ProgramHeaderCount: 2
 # CHECK-NEXT:   SectionHeaderEntrySize: 64
 # CHECK-NEXT:   SectionHeaderCount: 6
 # CHECK-NEXT:   StringTableSectionIndex: 5
@@ -59,7 +59,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x10000
+# CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
 # CHECK-NEXT:     Size: 16
 # CHECK-NEXT:     Link: 0
@@ -75,7 +75,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x10010
+# CHECK-NEXT:     Address: 0x11010
 # CHECK-NEXT:     Offset: 0x1010
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -91,7 +91,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x10010
+# CHECK-NEXT:     Address: 0x11010
 # CHECK-NEXT:     Offset: 0x1010
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -151,9 +151,21 @@ _start:
 # CHECK-NEXT: ProgramHeaders [
 # CHECK-NEXT:   ProgramHeader {
 # CHECK-NEXT:     Type: PT_LOAD (0x1)
-# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     Offset: 0x0
 # CHECK-NEXT:     VirtualAddress: 0x10000
 # CHECK-NEXT:     PhysicalAddress: 0x10000
+# CHECK-NEXT:     FileSize: 176
+# CHECK-NEXT:     MemSize: 176
+# CHECK-NEXT:     Flags [
+# CHECK-NEXT:       PF_R
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment: 4096
+# CHECK-NEXT:   }
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD (0x1)
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     VirtualAddress: 0x11000
+# CHECK-NEXT:     PhysicalAddress: 0x11000
 # CHECK-NEXT:     FileSize: 16
 # CHECK-NEXT:     MemSize: 16
 # CHECK-NEXT:     Flags [ (0x5)

Modified: lld/trunk/test/elf2/basic32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic32.s (original)
+++ lld/trunk/test/elf2/basic32.s Thu Sep 10 10:41:34 2015
@@ -23,14 +23,14 @@ _start:
 # CHECK-NEXT:   Type: Executable (0x2)
 # CHECK-NEXT:   Machine: EM_386 (0x3)
 # CHECK-NEXT:   Version: 1
-# CHECK-NEXT:   Entry: 0x10000
+# CHECK-NEXT:   Entry: 0x11000
 # CHECK-NEXT:   ProgramHeaderOffset: 0x34
 # CHECK-NEXT:   SectionHeaderOffset: 0x1058
 # CHECK-NEXT:   Flags [ (0x0)
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   HeaderSize: 52
 # CHECK-NEXT:   ProgramHeaderEntrySize: 32
-# CHECK-NEXT:   ProgramHeaderCount: 1
+# CHECK-NEXT:   ProgramHeaderCount: 2
 # CHECK-NEXT:   SectionHeaderEntrySize: 40
 # CHECK-NEXT:   SectionHeaderCount: 6
 # CHECK-NEXT:   StringTableSectionIndex: 5
@@ -58,7 +58,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x10000
+# CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
 # CHECK-NEXT:     Size: 12
 # CHECK-NEXT:     Link: 0
@@ -74,7 +74,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1000C
+# CHECK-NEXT:     Address: 0x1100C
 # CHECK-NEXT:     Offset: 0x100C
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -90,7 +90,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1000C
+# CHECK-NEXT:     Address: 0x1100C
 # CHECK-NEXT:     Offset: 0x100C
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -130,9 +130,21 @@ _start:
 # CHECK-NEXT: ProgramHeaders [
 # CHECK-NEXT:   ProgramHeader {
 # CHECK-NEXT:     Type: PT_LOAD (0x1)
-# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     Offset: 0x0
 # CHECK-NEXT:     VirtualAddress: 0x10000
 # CHECK-NEXT:     PhysicalAddress: 0x10000
+# CHECK-NEXT:     FileSize: 116
+# CHECK-NEXT:     MemSize: 116
+# CHECK-NEXT:     Flags [
+# CHECK-NEXT:       PF_R
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment: 4096
+# CHECK-NEXT:   }
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD (0x1)
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     VirtualAddress: 0x11000
+# CHECK-NEXT:     PhysicalAddress: 0x11000
 # CHECK-NEXT:     FileSize: 12
 # CHECK-NEXT:     MemSize: 12
 # CHECK-NEXT:     Flags [ (0x5)

Modified: lld/trunk/test/elf2/basic32be.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32be.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic32be.s (original)
+++ lld/trunk/test/elf2/basic32be.s Thu Sep 10 10:41:34 2015
@@ -23,14 +23,14 @@ _start:
 # CHECK-NEXT:   Type: Executable (0x2)
 # CHECK-NEXT:   Machine: EM_PPC (0x14)
 # CHECK-NEXT:   Version: 1
-# CHECK-NEXT:   Entry: 0x10000
+# CHECK-NEXT:   Entry: 0x11000
 # CHECK-NEXT:   ProgramHeaderOffset: 0x34
 # CHECK-NEXT:   SectionHeaderOffset: 0x1058
 # CHECK-NEXT:   Flags [ (0x0)
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   HeaderSize: 52
 # CHECK-NEXT:   ProgramHeaderEntrySize: 32
-# CHECK-NEXT:   ProgramHeaderCount: 1
+# CHECK-NEXT:   ProgramHeaderCount: 2
 # CHECK-NEXT:   SectionHeaderEntrySize: 40
 # CHECK-NEXT:   SectionHeaderCount: 6
 # CHECK-NEXT:    StringTableSectionIndex: 5
@@ -58,7 +58,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x10000
+# CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
 # CHECK-NEXT:     Size: 12
 # CHECK-NEXT:     Link: 0
@@ -74,7 +74,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1000C
+# CHECK-NEXT:     Address: 0x1100C
 # CHECK-NEXT:     Offset: 0x100C
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -90,7 +90,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1000C
+# CHECK-NEXT:     Address: 0x1100C
 # CHECK-NEXT:     Offset: 0x100C
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -130,9 +130,21 @@ _start:
 # CHECK-NEXT: ProgramHeaders [
 # CHECK-NEXT:   ProgramHeader {
 # CHECK-NEXT:     Type: PT_LOAD (0x1)
-# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     Offset: 0x0
 # CHECK-NEXT:     VirtualAddress: 0x10000
 # CHECK-NEXT:     PhysicalAddress: 0x10000
+# CHECK-NEXT:     FileSize: 116
+# CHECK-NEXT:     MemSize: 116
+# CHECK-NEXT:     Flags [
+# CHECK-NEXT:       PF_R
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment: 4096
+# CHECK-NEXT:   }
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD (0x1)
+# CHECK-NEXT:     Offset: 0x1000
+# CHECK-NEXT:     VirtualAddress: 0x11000
+# CHECK-NEXT:     PhysicalAddress: 0x11000
 # CHECK-NEXT:     FileSize: 12
 # CHECK-NEXT:     MemSize: 12
 # CHECK-NEXT:     Flags [ (0x5)

Modified: lld/trunk/test/elf2/basic64be.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic64be.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic64be.s (original)
+++ lld/trunk/test/elf2/basic64be.s Thu Sep 10 10:41:34 2015
@@ -28,14 +28,14 @@ _start:
 # CHECK-NEXT:   Type: Executable (0x2)
 # CHECK-NEXT:   Machine: EM_PPC64 (0x15)
 # CHECK-NEXT:   Version: 1
-# CHECK-NEXT:   Entry: 0x11000
+# CHECK-NEXT:   Entry: 0x12000
 # CHECK-NEXT:   ProgramHeaderOffset: 0x40
 # CHECK-NEXT:   SectionHeaderOffset: 0x2078
 # CHECK-NEXT:   Flags [ (0x0)
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   HeaderSize: 64
 # CHECK-NEXT:   ProgramHeaderEntrySize: 56
-# CHECK-NEXT:   ProgramHeaderCount: 2
+# CHECK-NEXT:   ProgramHeaderCount: 3
 # CHECK-NEXT:   SectionHeaderEntrySize: 64
 # CHECK-NEXT:   SectionHeaderCount: 7
 # CHECK-NEXT:    StringTableSectionIndex: 6
@@ -63,7 +63,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_EXECINSTR (0x4)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x10000
+# CHECK-NEXT:     Address: 0x11000
 # CHECK-NEXT:     Offset: 0x1000
 # CHECK-NEXT:     Size: 12
 # CHECK-NEXT:     Link: 0
@@ -79,7 +79,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1000C
+# CHECK-NEXT:     Address: 0x1100C
 # CHECK-NEXT:     Offset: 0x100C
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -95,7 +95,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x1000C
+# CHECK-NEXT:     Address: 0x1100C
 # CHECK-NEXT:     Offset: 0x100C
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
@@ -111,7 +111,7 @@ _start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x11000
+# CHECK-NEXT:     Address: 0x12000
 # CHECK-NEXT:     Offset: 0x2000
 # CHECK-NEXT:     Size: 24
 # CHECK-NEXT:     Link: 0
@@ -151,9 +151,21 @@ _start:
 # CHECK-NEXT: ProgramHeaders [
 # CHECK-NEXT:  ProgramHeader {
 # CHECK-NEXT:    Type: PT_LOAD (0x1)
-# CHECK-NEXT:    Offset: 0x1000
+# CHECK-NEXT:    Offset: 0x0
 # CHECK-NEXT:    VirtualAddress: 0x10000
 # CHECK-NEXT:    PhysicalAddress: 0x10000
+# CHECK-NEXT:    FileSize: 232
+# CHECK-NEXT:    MemSize: 232
+# CHECK-NEXT:    Flags [
+# CHECK-NEXT:      PF_R
+# CHECK-NEXT:    ]
+# CHECK-NEXT:    Alignment: 4096
+# CHECK-NEXT:  }
+# CHECK-NEXT:  ProgramHeader {
+# CHECK-NEXT:    Type: PT_LOAD (0x1)
+# CHECK-NEXT:    Offset: 0x1000
+# CHECK-NEXT:    VirtualAddress: 0x11000
+# CHECK-NEXT:    PhysicalAddress: 0x11000
 # CHECK-NEXT:    FileSize: 12
 # CHECK-NEXT:    MemSize: 12
 # CHECK-NEXT:    Flags [ (0x5)
@@ -165,8 +177,8 @@ _start:
 # CHECK-NEXT:  ProgramHeader {
 # CHECK-NEXT:    Type: PT_LOAD (0x1)
 # CHECK-NEXT:    Offset: 0x2000
-# CHECK-NEXT:    VirtualAddress: 0x11000
-# CHECK-NEXT:    PhysicalAddress: 0x11000
+# CHECK-NEXT:    VirtualAddress: 0x12000
+# CHECK-NEXT:    PhysicalAddress: 0x12000
 # CHECK-NEXT:    FileSize: 24
 # CHECK-NEXT:    MemSize: 24
 # CHECK-NEXT:    Flags [ (0x6)

Modified: lld/trunk/test/elf2/bss.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/bss.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/bss.s (original)
+++ lld/trunk/test/elf2/bss.s Thu Sep 10 10:41:34 2015
@@ -11,7 +11,7 @@
 // CHECK-NEXT:     SHF_ALLOC
 // CHECK-NEXT:     SHF_WRITE
 // CHECK-NEXT:   ]
-// CHECK-NEXT:   Address: 0x10000
+// CHECK-NEXT:   Address: 0x11000
 // CHECK-NEXT:   Offset: 0x1000
 // CHECK-NEXT:   Size: 4
 // CHECK-NEXT:   Link: 0

Modified: lld/trunk/test/elf2/common.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/common.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/common.s (original)
+++ lld/trunk/test/elf2/common.s Thu Sep 10 10:41:34 2015
@@ -10,13 +10,13 @@
 // CHECK-NEXT:   SHF_ALLOC
 // CHECK-NEXT:   SHF_WRITE
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x10000
+// CHECK-NEXT: Address: 0x11000
 // CHECK-NEXT: Offset:
 // CHECK-NEXT: Size: 22
 
 
 // CHECK:      Name: sym4
-// CHECK-NEXT: Value: 0x10000
+// CHECK-NEXT: Value: 0x11000
 // CHECK-NEXT: Size: 4
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object
@@ -24,7 +24,7 @@
 // CHECK-NEXT: Section: .bss
 
 // CHECK:      Name: sym3
-// CHECK-NEXT: Value: 0x10014
+// CHECK-NEXT: Value: 0x11014
 // CHECK-NEXT: Size: 2
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object
@@ -32,7 +32,7 @@
 // CHECK-NEXT: Section: .bss
 
 // CHECK:      Name: sym2
-// CHECK-NEXT: Value: 0x1000C
+// CHECK-NEXT: Value: 0x1100C
 // CHECK-NEXT: Size: 8
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object
@@ -40,7 +40,7 @@
 // CHECK-NEXT: Section: .bss
 
 // CHECK:      Name: sym1
-// CHECK-NEXT: Value: 0x10004
+// CHECK-NEXT: Value: 0x11004
 // CHECK-NEXT: Size: 8
 // CHECK-NEXT: Binding: Global
 // CHECK-NEXT: Type: Object

Modified: lld/trunk/test/elf2/relocation.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation.s (original)
+++ lld/trunk/test/elf2/relocation.s Thu Sep 10 10:41:34 2015
@@ -21,9 +21,9 @@ bar:
 
 // R_X86_64_32
 // CHECK: bar:
-// CHECK:  10000: ba 00 00 01 00 movl $65536, %edx
+// CHECK:  11000: ba 00 10 01 00 movl $69632, %edx
 
 // CHECK: e8 04 00 00 00  callq   4
 
 // Also check that symbols match.
-// CHECK: 0000000000010000         .text           00000000 bar
+// CHECK: 0000000000011000         .text           00000000 bar

Modified: lld/trunk/test/elf2/shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/shared.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/shared.s (original)
+++ lld/trunk/test/elf2/shared.s Thu Sep 10 10:41:34 2015
@@ -46,7 +46,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _start
-// CHECK-NEXT:     Value: 0x10000
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None

Modified: lld/trunk/test/elf2/string-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/string-table.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/string-table.s (original)
+++ lld/trunk/test/elf2/string-table.s Thu Sep 10 10:41:34 2015
@@ -23,7 +23,7 @@ hidden:
 // CHECK-NEXT: Flags [
 // CHECK-NEXT:  SHF_ALLOC
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x10000
+// CHECK-NEXT: Address: 0x11000
 
 // CHECK:      Name: foobar
 // CHECK-NEXT: Type: SHT_PROGBITS

Modified: lld/trunk/test/elf2/symbols.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/symbols.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/symbols.s (original)
+++ lld/trunk/test/elf2/symbols.s Thu Sep 10 10:41:34 2015
@@ -51,7 +51,7 @@ internal:
 // CHECK-NEXT:   SHF_ALLOC
 // CHECK-NEXT:   SHF_EXECINSTR
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x10000
+// CHECK-NEXT: Address: 0x11000
 
 // CHECK:      Name: .bss (14)
 // CHECK-NEXT: Type: SHT_NOBITS (0x8)
@@ -59,7 +59,7 @@ internal:
 // CHECK-NEXT:   SHF_ALLOC (0x2)
 // CHECK-NEXT:   SHF_WRITE (0x1)
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x11000
+// CHECK-NEXT: Address: 0x12000
 // CHECK-NEXT: Offset: 0x2000
 // CHECK-NEXT: Size: 4
 
@@ -68,7 +68,7 @@ internal:
 // CHECK-NEXT: Flags [
 // CHECK-NEXT:   SHF_ALLOC
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x12000
+// CHECK-NEXT: Address: 0x13000
 
 // CHECK:      Symbols [
 // CHECK-NEXT:   Symbol {
@@ -82,7 +82,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _start
-// CHECK-NEXT:     Value: 0x10000
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global (0x1)
 // CHECK-NEXT:     Type: Function
@@ -109,7 +109,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: foo
-// CHECK-NEXT:     Value: 0x10000
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Weak (0x2)
 // CHECK-NEXT:     Type: Object
@@ -118,7 +118,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: common (34)
-// CHECK-NEXT:     Value: 0x11000
+// CHECK-NEXT:     Value: 0x12000
 // CHECK-NEXT:     Size: 4
 // CHECK-NEXT:     Binding: Global (0x1)
 // CHECK-NEXT:     Type: Object (0x1)
@@ -127,7 +127,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: zed
-// CHECK-NEXT:     Value: 0x12000
+// CHECK-NEXT:     Value: 0x13000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global (0x1)
 // CHECK-NEXT:     Type: None
@@ -136,7 +136,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: protected
-// CHECK-NEXT:     Value: 0x12008
+// CHECK-NEXT:     Value: 0x13008
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
@@ -145,7 +145,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: zed3
-// CHECK-NEXT:     Value: 0x12008
+// CHECK-NEXT:     Value: 0x13008
 // CHECK-NEXT:     Size: 4
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
@@ -154,7 +154,7 @@ internal:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: zed2
-// CHECK-NEXT:     Value: 0x12004
+// CHECK-NEXT:     Value: 0x13004
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None

Modified: lld/trunk/test/elf2/visibility.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/visibility.s?rev=247290&r1=247289&r2=247290&view=diff
==============================================================================
--- lld/trunk/test/elf2/visibility.s (original)
+++ lld/trunk/test/elf2/visibility.s Thu Sep 10 10:41:34 2015
@@ -16,7 +16,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _start
-// CHECK-NEXT:     Value: 0x10000
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
@@ -25,7 +25,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: default
-// CHECK-NEXT:     Value: 0x10000
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None
@@ -34,7 +34,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: protected
-// CHECK-NEXT:     Value: 0x10000
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None




More information about the llvm-commits mailing list