[lld] r251988 - Handle 0 sized sections like any other section.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 14:08:09 PST 2015


Author: rafael
Date: Tue Nov  3 16:08:08 2015
New Revision: 251988

URL: http://llvm.org/viewvc/llvm-project?rev=251988&view=rev
Log:
Handle 0 sized sections like any other section.

This is a case where there is inconsistency among ELF linkers:

* The spec says nothing special about empty sections.
* BFD ld removes them.
* Gold handles them like regular sections.

We were outputting them but sometimes ignoring them. This would create
odd looking outputs where a rw section could be in a ro segment for example.

The bfd way of doing things is also strange for the case where a symbol
points to the empty section.

Now we match gold and what seems to be the intention of the spec.

Modified:
    lld/trunk/ELF/Writer.cpp
    lld/trunk/test/elf2/basic-mips.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/gnu-hash-table.s
    lld/trunk/test/elf2/local-dynamic.s
    lld/trunk/test/elf2/local.s
    lld/trunk/test/elf2/merge-string-align.s
    lld/trunk/test/elf2/merge-string.s
    lld/trunk/test/elf2/merge-sym.s
    lld/trunk/test/elf2/program-header-layout.s
    lld/trunk/test/elf2/string-table.s

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Nov  3 16:08:08 2015
@@ -698,27 +698,24 @@ template <class ELFT> void Writer<ELFT>:
   // Create phdrs as we assign VAs and file offsets to all output sections.
   SmallPtrSet<Elf_Phdr *, 8> Closed;
   for (OutputSectionBase<ELFT> *Sec : OutputSections) {
-    if (Sec->getSize()) {
-      uintX_t Flags = toPhdrFlags(Sec->getFlags());
-      Elf_Phdr *Last = &Phdrs[PhdrIdx];
-      if (Last->p_flags != Flags || !needsPhdr<ELFT>(Sec)) {
-        // Flags changed. End current Phdr and potentially create a new one.
-        if (Closed.insert(Last).second) {
-          Last->p_filesz = FileOff - Last->p_offset;
-          Last->p_memsz = VA - Last->p_vaddr;
-        }
-
-        if (needsPhdr<ELFT>(Sec)) {
-          VA = RoundUpToAlignment(VA, Target->getPageSize());
-          FileOff = RoundUpToAlignment(FileOff, Target->getPageSize());
-          Elf_Phdr *PH = &Phdrs[++PhdrIdx];
-          setPhdr(PH, PT_LOAD, Flags, FileOff, VA, 0, Target->getPageSize());
-        }
+    uintX_t Flags = toPhdrFlags(Sec->getFlags());
+    Elf_Phdr *Last = &Phdrs[PhdrIdx];
+    if (Last->p_flags != Flags || !needsPhdr<ELFT>(Sec)) {
+      // Flags changed. End current Phdr and potentially create a new one.
+      if (Closed.insert(Last).second) {
+        Last->p_filesz = FileOff - Last->p_offset;
+        Last->p_memsz = VA - Last->p_vaddr;
+      }
+
+      if (needsPhdr<ELFT>(Sec)) {
+        VA = RoundUpToAlignment(VA, Target->getPageSize());
+        FileOff = RoundUpToAlignment(FileOff, Target->getPageSize());
+        Elf_Phdr *PH = &Phdrs[++PhdrIdx];
+        setPhdr(PH, PT_LOAD, Flags, FileOff, VA, 0, Target->getPageSize());
       }
     }
 
-    if (Sec->getSize() && (Sec->getFlags() & SHF_ALLOC) &&
-        (Sec->getFlags() & SHF_TLS)) {
+    if ((Sec->getFlags() & SHF_ALLOC) && (Sec->getFlags() & SHF_TLS)) {
       if (!TlsPhdr.p_vaddr)
         setPhdr(&TlsPhdr, PT_TLS, PF_R, FileOff, VA, 0, Sec->getAlign());
       if (Sec->getType() != SHT_NOBITS)
@@ -776,7 +773,7 @@ template <class ELFT> int Writer<ELFT>::
     ++I;
   uintX_t Last = PF_R;
   for (OutputSectionBase<ELFT> *Sec : OutputSections) {
-    if (!Sec->getSize() || !needsPhdr<ELFT>(Sec))
+    if (!needsPhdr<ELFT>(Sec))
       continue;
     if (Sec->getFlags() & SHF_TLS)
       Tls = true;

Modified: lld/trunk/test/elf2/basic-mips.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic-mips.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic-mips.s (original)
+++ lld/trunk/test/elf2/basic-mips.s Tue Nov  3 16:08:08 2015
@@ -27,12 +27,12 @@ __start:
 # CHECK-NEXT:   Version: 1
 # CHECK-NEXT:   Entry: 0x20000
 # CHECK-NEXT:   ProgramHeaderOffset: 0x34
-# CHECK-NEXT:   SectionHeaderOffset: 0x10080
+# CHECK-NEXT:   SectionHeaderOffset: 0x20070
 # CHECK-NEXT:   Flags [ (0x0)
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   HeaderSize: 52
 # CHECK-NEXT:   ProgramHeaderEntrySize: 32
-# CHECK-NEXT:   ProgramHeaderCount: 3
+# CHECK-NEXT:   ProgramHeaderCount: 4
 # CHECK-NEXT:   SectionHeaderEntrySize: 40
 # CHECK-NEXT:   SectionHeaderCount: 9
 # CHECK-NEXT:   StringTableSectionIndex: 7
@@ -59,8 +59,8 @@ __start:
 # CHECK-NEXT:     Flags [ (0x2)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x10094
-# CHECK-NEXT:     Offset: 0x94
+# CHECK-NEXT:     Address: 0x100B4
+# CHECK-NEXT:     Offset: 0xB4
 # CHECK-NEXT:     Size: 24
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
@@ -74,8 +74,8 @@ __start:
 # CHECK-NEXT:     Flags [ (0x2)
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x100B0
-# CHECK-NEXT:     Offset: 0xB0
+# CHECK-NEXT:     Address: 0x100D0
+# CHECK-NEXT:     Offset: 0xD0
 # CHECK-NEXT:     Size: 24
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
@@ -106,8 +106,8 @@ __start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x20010
-# CHECK-NEXT:     Offset: 0x10010
+# CHECK-NEXT:     Address: 0x30000
+# CHECK-NEXT:     Offset: 0x20000
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
@@ -122,8 +122,8 @@ __start:
 # CHECK-NEXT:       SHF_ALLOC (0x2)
 # CHECK-NEXT:       SHF_WRITE (0x1)
 # CHECK-NEXT:     ]
-# CHECK-NEXT:     Address: 0x20010
-# CHECK-NEXT:     Offset: 0x10010
+# CHECK-NEXT:     Address: 0x30000
+# CHECK-NEXT:     Offset: 0x20000
 # CHECK-NEXT:     Size: 0
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
@@ -137,7 +137,7 @@ __start:
 # CHECK-NEXT:     Flags [ (0x0)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Address: 0x0
-# CHECK-NEXT:     Offset: 0x10010
+# CHECK-NEXT:     Offset: 0x20000
 # CHECK-NEXT:     Size: 32
 # CHECK-NEXT:     Link: 8
 # CHECK-NEXT:     Info: 1
@@ -151,7 +151,7 @@ __start:
 # CHECK-NEXT:     Flags [ (0x0)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Address: 0x0
-# CHECK-NEXT:     Offset: 0x10030
+# CHECK-NEXT:     Offset: 0x20020
 # CHECK-NEXT:     Size: 68
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
@@ -165,7 +165,7 @@ __start:
 # CHECK-NEXT:     Flags [ (0x0)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Address: 0x0
-# CHECK-NEXT:     Offset: 0x10074
+# CHECK-NEXT:     Offset: 0x20064
 # CHECK-NEXT:     Size: 9
 # CHECK-NEXT:     Link: 0
 # CHECK-NEXT:     Info: 0
@@ -199,8 +199,8 @@ __start:
 # CHECK-NEXT:     Offset: 0x34
 # CHECK-NEXT:     VirtualAddress: 0x10034
 # CHECK-NEXT:     PhysicalAddress: 0x10034
-# CHECK-NEXT:     FileSize: 96
-# CHECK-NEXT:     MemSize: 96
+# CHECK-NEXT:     FileSize: 128
+# CHECK-NEXT:     MemSize: 128
 # CHECK-NEXT:     Flags [ (0x4)
 # CHECK-NEXT:       PF_R (0x4)
 # CHECK-NEXT:     ]
@@ -211,8 +211,8 @@ __start:
 # CHECK-NEXT:     Offset: 0x0
 # CHECK-NEXT:     VirtualAddress: 0x10000
 # CHECK-NEXT:     PhysicalAddress: 0x10000
-# CHECK-NEXT:     FileSize: 200
-# CHECK-NEXT:     MemSize: 200
+# CHECK-NEXT:     FileSize: 232
+# CHECK-NEXT:     MemSize: 232
 # CHECK-NEXT:     Flags [ (0x4)
 # CHECK-NEXT:       PF_R (0x4)
 # CHECK-NEXT:     ]
@@ -223,12 +223,25 @@ __start:
 # CHECK-NEXT:     Offset: 0x10000
 # CHECK-NEXT:     VirtualAddress: 0x20000
 # CHECK-NEXT:     PhysicalAddress: 0x20000
-# CHECK-NEXT:     FileSize: 16
-# CHECK-NEXT:     MemSize: 16
+# CHECK-NEXT:     FileSize: 12
+# CHECK-NEXT:     MemSize: 12
 # CHECK-NEXT:     Flags [ (0x5)
 # CHECK-NEXT:       PF_R (0x4)
 # CHECK-NEXT:       PF_X (0x1)
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Alignment: 65536
 # CHECK-NEXT:   }
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD (0x1)
+# CHECK-NEXT:     Offset: 0x20000
+# CHECK-NEXT:     VirtualAddress: 0x30000
+# CHECK-NEXT:     PhysicalAddress: 0x30000
+# CHECK-NEXT:     FileSize: 0
+# CHECK-NEXT:     MemSize: 0
+# CHECK-NEXT:     Flags [
+# CHECK-NEXT:       PF_R
+# CHECK-NEXT:       PF_W
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment: 65536
+# CHECK-NEXT:   }
 # CHECK-NEXT: ]

Modified: lld/trunk/test/elf2/discard-locals.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/discard-locals.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/discard-locals.s (original)
+++ lld/trunk/test/elf2/discard-locals.s Tue Nov  3 16:08:08 2015
@@ -40,7 +40,7 @@ _start:
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _start
-// CHECK-NEXT:     Value: 0x100B0
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None

Modified: lld/trunk/test/elf2/discard-none.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/discard-none.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/discard-none.s (original)
+++ lld/trunk/test/elf2/discard-none.s Tue Nov  3 16:08:08 2015
@@ -36,7 +36,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: .Lmyothervar
-// CHECK-NEXT:     Value: 0x14C
+// CHECK-NEXT:     Value: 0x1000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Local
 // CHECK-NEXT:     Type: None
@@ -45,7 +45,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: .Lmyvar
-// CHECK-NEXT:     Value: 0x14C
+// CHECK-NEXT:     Value: 0x1000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Local
 // CHECK-NEXT:     Type: None

Modified: lld/trunk/test/elf2/emulation.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/emulation.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/emulation.s (original)
+++ lld/trunk/test/elf2/emulation.s Tue Nov  3 16:08:08 2015
@@ -16,14 +16,14 @@
 # X86-64-NEXT:   Type: Executable (0x2)
 # X86-64-NEXT:   Machine: EM_X86_64 (0x3E)
 # X86-64-NEXT:   Version: 1
-# X86-64-NEXT:   Entry: 0x100B0
+# X86-64-NEXT:   Entry:
 # X86-64-NEXT:   ProgramHeaderOffset: 0x40
 # X86-64-NEXT:   SectionHeaderOffset:
 # 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:   ProgramHeaderCount:
 # X86-64-NEXT:   SectionHeaderEntrySize: 64
 # X86-64-NEXT:   SectionHeaderCount:
 # X86-64-NEXT:   StringTableSectionIndex:
@@ -47,14 +47,14 @@
 # X86-NEXT:   Type: Executable (0x2)
 # X86-NEXT:   Machine: EM_386 (0x3)
 # X86-NEXT:   Version: 1
-# X86-NEXT:   Entry: 0x10074
+# X86-NEXT:   Entry:
 # X86-NEXT:   ProgramHeaderOffset: 0x34
 # X86-NEXT:   SectionHeaderOffset:
 # X86-NEXT:   Flags [ (0x0)
 # X86-NEXT:   ]
 # X86-NEXT:   HeaderSize: 52
 # X86-NEXT:   ProgramHeaderEntrySize: 32
-# X86-NEXT:   ProgramHeaderCount: 2
+# X86-NEXT:   ProgramHeaderCount:
 # X86-NEXT:   SectionHeaderEntrySize: 40
 # X86-NEXT:   SectionHeaderCount:
 # X86-NEXT:   StringTableSectionIndex:
@@ -78,14 +78,14 @@
 # PPC64-NEXT:   Type: Executable (0x2)
 # PPC64-NEXT:   Machine: EM_PPC64 (0x15)
 # PPC64-NEXT:   Version: 1
-# PPC64-NEXT:   Entry: 0x100000B0
+# PPC64-NEXT:   Entry:
 # PPC64-NEXT:   ProgramHeaderOffset: 0x40
 # PPC64-NEXT:   SectionHeaderOffset:
 # PPC64-NEXT:   Flags [ (0x0)
 # PPC64-NEXT:   ]
 # PPC64-NEXT:   HeaderSize: 64
 # PPC64-NEXT:   ProgramHeaderEntrySize: 56
-# PPC64-NEXT:   ProgramHeaderCount: 2
+# PPC64-NEXT:   ProgramHeaderCount:
 # PPC64-NEXT:   SectionHeaderEntrySize: 64
 # PPC64-NEXT:   SectionHeaderCount:
 # PPC64-NEXT:   StringTableSectionIndex:
@@ -109,9 +109,9 @@
 # MIPS-NEXT:   Type: Executable (0x2)
 # MIPS-NEXT:   Machine: EM_MIPS (0x8)
 # MIPS-NEXT:   Version: 1
-# MIPS-NEXT:   Entry: 0x100B0
+# MIPS-NEXT:   Entry:
 # MIPS-NEXT:   ProgramHeaderOffset: 0x34
-# MIPS-NEXT:   SectionHeaderOffset: 0x11C
+# MIPS-NEXT:   SectionHeaderOffset:
 # MIPS-NEXT:   Flags [ (0x0)
 # MIPS-NEXT:   ]
 
@@ -135,9 +135,9 @@
 # MIPSEL-NEXT:   Type: Executable (0x2)
 # MIPSEL-NEXT:   Machine: EM_MIPS (0x8)
 # MIPSEL-NEXT:   Version: 1
-# MIPSEL-NEXT:   Entry: 0x100B0
+# MIPSEL-NEXT:   Entry:
 # MIPSEL-NEXT:   ProgramHeaderOffset: 0x34
-# MIPSEL-NEXT:   SectionHeaderOffset: 0x11C
+# MIPSEL-NEXT:   SectionHeaderOffset:
 # MIPSEL-NEXT:   Flags [ (0x0)
 # MIPSEL-NEXT:   ]
 

Modified: lld/trunk/test/elf2/gnu-hash-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/gnu-hash-table.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/gnu-hash-table.s (original)
+++ lld/trunk/test/elf2/gnu-hash-table.s Tue Nov  3 16:08:08 2015
@@ -149,8 +149,8 @@
 # PPC64-NEXT:     Flags [
 # PPC64-NEXT:       SHF_ALLOC
 # PPC64-NEXT:     ]
-# PPC64-NEXT:     Address: 0x180
-# PPC64-NEXT:     Offset: 0x180
+# PPC64-NEXT:     Address: 0x1B8
+# PPC64-NEXT:     Offset: 0x1B8
 # PPC64-NEXT:     Size: 36
 # PPC64-NEXT:     Link: 1
 # PPC64-NEXT:     Info: 0

Modified: lld/trunk/test/elf2/local-dynamic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/local-dynamic.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/local-dynamic.s (original)
+++ lld/trunk/test/elf2/local-dynamic.s Tue Nov  3 16:08:08 2015
@@ -16,7 +16,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: blah
-// CHECK-NEXT:     Value: 0x170
+// CHECK-NEXT:     Value: 0x1000
 // 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: 0x170
+// CHECK-NEXT:     Value: 0x1000
 // 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: 0x170
+// CHECK-NEXT:     Value: 0x1000
 // 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: 0x170
+// CHECK-NEXT:     Value: 0x1000
 // 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: 0x170
+// CHECK-NEXT:     Value: 0x1000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None

Modified: lld/trunk/test/elf2/local.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/local.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/local.s (original)
+++ lld/trunk/test/elf2/local.s Tue Nov  3 16:08:08 2015
@@ -37,7 +37,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: blah
-// CHECK-NEXT:     Value: 0x100B0
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Local
 // CHECK-NEXT:     Type: None
@@ -46,7 +46,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: foo
-// CHECK-NEXT:     Value: 0x100B0
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Local
 // CHECK-NEXT:     Type: None
@@ -55,7 +55,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: goo
-// CHECK-NEXT:     Value: 0x100B0
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Local
 // CHECK-NEXT:     Type: None
@@ -64,7 +64,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _start
-// CHECK-NEXT:     Value: 0x100B0
+// CHECK-NEXT:     Value: 0x11000
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global
 // CHECK-NEXT:     Type: None

Modified: lld/trunk/test/elf2/merge-string-align.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/merge-string-align.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/merge-string-align.s (original)
+++ lld/trunk/test/elf2/merge-string-align.s Tue Nov  3 16:08:08 2015
@@ -17,8 +17,8 @@
 // CHECK-NEXT:   SHF_MERGE
 // CHECK-NEXT:   SHF_STRINGS
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x120
-// CHECK-NEXT: Offset: 0x120
+// CHECK-NEXT: Address:
+// CHECK-NEXT: Offset:
 // CHECK-NEXT: Size: 4
 // CHECK-NEXT: Link: 0
 // CHECK-NEXT: Info: 0
@@ -31,8 +31,8 @@
 // CHECK-NEXT:   SHF_MERGE
 // CHECK-NEXT:   SHF_STRINGS
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x124
-// CHECK-NEXT: Offset: 0x124
+// CHECK-NEXT: Address:
+// CHECK-NEXT: Offset:
 // CHECK-NEXT: Size: 4
 // CHECK-NEXT: Link: 0
 // CHECK-NEXT: Info: 0

Modified: lld/trunk/test/elf2/merge-string.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/merge-string.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/merge-string.s (original)
+++ lld/trunk/test/elf2/merge-string.s Tue Nov  3 16:08:08 2015
@@ -26,8 +26,8 @@ zed:
 // CHECK-NEXT:   SHF_MERGE
 // CHECK-NEXT:   SHF_STRINGS
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address:         0x120
-// CHECK-NEXT: Offset:  0x120
+// CHECK-NEXT: Address:         0x158
+// CHECK-NEXT: Offset:  0x158
 // CHECK-NEXT: Size:    4
 // CHECK-NEXT: Link: 0
 // CHECK-NEXT: Info: 0
@@ -44,8 +44,8 @@ zed:
 // NOTAIL-NEXT:   SHF_MERGE
 // NOTAIL-NEXT:   SHF_STRINGS
 // NOTAIL-NEXT: ]
-// NOTAIL-NEXT: Address:         0x120
-// NOTAIL-NEXT: Offset:  0x120
+// NOTAIL-NEXT: Address:         0x158
+// NOTAIL-NEXT: Offset:  0x158
 // NOTAIL-NEXT: Size:    7
 // NOTAIL-NEXT: Link: 0
 // NOTAIL-NEXT: Info: 0
@@ -62,8 +62,8 @@ zed:
 // CHECK-NEXT:   SHF_MERGE
 // CHECK-NEXT:   SHF_STRINGS
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x124
-// CHECK-NEXT: Offset: 0x124
+// CHECK-NEXT: Address: 0x15C
+// CHECK-NEXT: Offset: 0x15C
 // CHECK-NEXT: Size: 4
 // CHECK-NEXT: Link: 0
 // CHECK-NEXT: Info: 0
@@ -75,11 +75,11 @@ zed:
 
 
 // CHECK:      Name:    bar
-// CHECK-NEXT: Value:   0x121
+// CHECK-NEXT: Value:   0x159
 
 // CHECK:      Name:    foo
-// CHECK-NEXT: Value:   0x120
+// CHECK-NEXT: Value:   0x158
 
 // CHECK:      Name: zed
-// CHECK-NEXT: Value: 0x124
+// CHECK-NEXT: Value: 0x15C
 // CHECK-NEXT: Size: 0

Modified: lld/trunk/test/elf2/merge-sym.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/merge-sym.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/merge-sym.s (original)
+++ lld/trunk/test/elf2/merge-sym.s Tue Nov  3 16:08:08 2015
@@ -15,7 +15,7 @@ foo:
 // CHECK-NEXT:   SHF_ALLOC
 // CHECK-NEXT:   SHF_MERGE
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x120
+// CHECK-NEXT: Address: 0x158
 
 // CHECK:      Name: foo
-// CHECK-NEXT: Value: 0x122
+// CHECK-NEXT: Value: 0x15A

Modified: lld/trunk/test/elf2/program-header-layout.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/program-header-layout.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/program-header-layout.s (original)
+++ lld/trunk/test/elf2/program-header-layout.s Tue Nov  3 16:08:08 2015
@@ -23,7 +23,7 @@ _start:
 # CHECK-NEXT:     SHF_ALLOC
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   Address:
-# CHECK-NEXT:   Offset: 0xE8
+# CHECK-NEXT:   Offset: 0x120
 # CHECK-NEXT:   Size:
 # CHECK-NEXT:   Link:
 # CHECK-NEXT:   Info:
@@ -37,8 +37,8 @@ _start:
 # CHECK-NEXT:     Offset: 0x40
 # CHECK-NEXT:     VirtualAddress: 0x10040
 # CHECK-NEXT:     PhysicalAddress: 0x10040
-# CHECK-NEXT:     FileSize: 168
-# CHECK-NEXT:     MemSize: 168
+# CHECK-NEXT:     FileSize: 224
+# CHECK-NEXT:     MemSize: 224
 # CHECK-NEXT:     Flags [ (0x4)
 # CHECK-NEXT:       PF_R (0x4)
 # CHECK-NEXT:     ]
@@ -49,13 +49,26 @@ _start:
 # CHECK-NEXT:     Offset: 0x0
 # CHECK-NEXT:     VirtualAddress:
 # CHECK-NEXT:     PhysicalAddress:
-# CHECK-NEXT:     FileSize: 240
-# CHECK-NEXT:     MemSize: 240
+# CHECK-NEXT:     FileSize: 296
+# CHECK-NEXT:     MemSize: 296
 # CHECK-NEXT:     Flags [
 # CHECK-NEXT:       PF_R
 # CHECK-NEXT:     ]
 # CHECK-NEXT:     Alignment:
 # CHECK-NEXT:   }
+# CHECK-NEXT:   ProgramHeader {
+# CHECK-NEXT:     Type: PT_LOAD
+# CHECK-NEXT:     Offset:
+# CHECK-NEXT:     VirtualAddress:
+# CHECK-NEXT:     PhysicalAddress:
+# CHECK-NEXT:     FileSize: 0
+# CHECK-NEXT:     MemSize: 0
+# CHECK-NEXT:     Flags [
+# CHECK-NEXT:       PF_R
+# CHECK-NEXT:       PF_X
+# CHECK-NEXT:     ]
+# CHECK-NEXT:     Alignment:
+# CHECK-NEXT:   }
 # CHECK-NEXT:   ProgramHeader {
 # CHECK-NEXT:     Type: PT_LOAD
 # CHECK-NEXT:     Offset:

Modified: lld/trunk/test/elf2/string-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/string-table.s?rev=251988&r1=251987&r2=251988&view=diff
==============================================================================
--- lld/trunk/test/elf2/string-table.s (original)
+++ lld/trunk/test/elf2/string-table.s Tue Nov  3 16:08:08 2015
@@ -19,7 +19,7 @@ _start:
 // CHECK-NEXT: Flags [
 // CHECK-NEXT:  SHF_ALLOC
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x100B0
+// CHECK-NEXT: Address: 0x100E8
 
 // CHECK:      Name: foobar
 // CHECK-NEXT: Type: SHT_PROGBITS




More information about the llvm-commits mailing list