[lld] b2559f2 - [ELF] .eh_frame: remove config->wordsize padding

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 31 23:35:48 PDT 2022


Author: Fangrui Song
Date: 2022-07-31T23:35:44-07:00
New Revision: b2559f2f5ca950e917253b156bfd08ede5577cd5

URL: https://github.com/llvm/llvm-project/commit/b2559f2f5ca950e917253b156bfd08ede5577cd5
DIFF: https://github.com/llvm/llvm-project/commit/b2559f2f5ca950e917253b156bfd08ede5577cd5.diff

LOG: [ELF] .eh_frame: remove config->wordsize padding

Linux Standard Base Core Specification says that CIE/FDE is padded to an
addressing unit size boundary, but in practice GNU assembler/LLVM integrated
assembler pad FDE/CIE to 4 and the last FDE to 8 on 64-bit systems.

In addition, GNU ld doesn't pad to 8, so let's drop excess padding, too.
If the assembler provides aligned pieces, the output will be aligned.

Noticed .eh_frame size reduction for 3 executables: 0.3% (chrome), 4.7% (clang),
7.6% (an internal program).

Added: 
    

Modified: 
    lld/ELF/SyntheticSections.cpp
    lld/test/ELF/eh-frame-hdr-icf-fde.s
    lld/test/ELF/eh-frame-hdr.s
    lld/test/ELF/eh-frame-merge.s
    lld/test/ELF/eh-frame-multiple-cie.s
    lld/test/ELF/eh-frame-negative-pcrel-sdata2.s
    lld/test/ELF/eh-frame-negative-pcrel-sdata4.s
    lld/test/ELF/eh-frame-negative-pcrel-sdata8.s
    lld/test/ELF/eh-frame-padding-no-rosegment.s
    lld/test/ELF/eh-frame-value-format7.s
    lld/test/ELF/gdb-index-gc-sections.s
    lld/test/ELF/map-file.s
    lld/test/ELF/partition-synthetic-sections.s

Removed: 
    


################################################################################
diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index f21e60e44da41..a33f79b628eb2 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -468,13 +468,8 @@ void EhFrameSection::iterateFDEWithLSDA(
 
 static void writeCieFde(uint8_t *buf, ArrayRef<uint8_t> d) {
   memcpy(buf, d.data(), d.size());
-
-  size_t aligned = alignToPowerOf2(d.size(), config->wordsize);
-  assert(std::all_of(buf + d.size(), buf + aligned,
-                     [](uint8_t c) { return c == 0; }));
-
   // Fix the size field. -4 since size does not include the size field itself.
-  write32(buf, aligned - 4);
+  write32(buf, d.size() - 4);
 }
 
 void EhFrameSection::finalizeContents() {
@@ -504,11 +499,11 @@ void EhFrameSection::finalizeContents() {
   size_t off = 0;
   for (CieRecord *rec : cieRecords) {
     rec->cie->outputOff = off;
-    off += alignToPowerOf2(rec->cie->size, config->wordsize);
+    off += rec->cie->size;
 
     for (EhSectionPiece *fde : rec->fdes) {
       fde->outputOff = off;
-      off += alignToPowerOf2(fde->size, config->wordsize);
+      off += fde->size;
     }
   }
 

diff  --git a/lld/test/ELF/eh-frame-hdr-icf-fde.s b/lld/test/ELF/eh-frame-hdr-icf-fde.s
index 0ab467e8020ae..9b821d0b87830 100644
--- a/lld/test/ELF/eh-frame-hdr-icf-fde.s
+++ b/lld/test/ELF/eh-frame-hdr-icf-fde.s
@@ -32,10 +32,10 @@
 # CHECK-NEXT:   AddressAlignment:
 # CHECK-NEXT:   EntrySize: 0
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 011B033B 1C000000 02000000 6C100000
+# CHECK-NEXT:     0000: 011B033B 1C000000 02000000 64100000
 ##                               ^        ^-- FDE(1) PC
 ##                               ^-- Number of FDEs
-# CHECK-NEXT:     0010: 38000000 6E100000 50000000
+# CHECK-NEXT:     0010: 38000000 66100000 4C000000
 ##                               ^-- FDE(2) PC
 # CHECK-NEXT:   )
 # CHECK-NEXT: }
@@ -52,17 +52,17 @@
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   Address: 0x200178
 # CHECK-NEXT:   Offset: 0x178
-# CHECK-NEXT:   Size: 76
+# CHECK-NEXT:   Size: 68
 # CHECK-NEXT:   Link: 0
 # CHECK-NEXT:   Info: 0
 # CHECK-NEXT:   AddressAlignment: 8
 # CHECK-NEXT:   EntrySize: 0
 # CHECK-NEXT:   SectionData (
 # CHECK-NEXT:     0000: 14000000 00000000 017A5200 01781001
-# CHECK-NEXT:     0010: 1B0C0708 90010000 14000000 1C000000
-# CHECK-NEXT:     0020: 2C100000 01000000 00000000 00000000
-# CHECK-NEXT:     0030: 14000000 34000000 16100000 01000000
-# CHECK-NEXT:     0040: 00000000 00000000 00000000
+# CHECK-NEXT:     0010: 1B0C0708 90010000 10000000 1C000000
+# CHECK-NEXT:     0020: 24100000 01000000 00000000 10000000
+# CHECK-NEXT:     0030: 30000000 12100000 01000000 00000000
+# CHECK-NEXT:     0040: 00000000
 # CHECK-NEXT:   )
 # CHECK-NEXT: }
 
@@ -74,7 +74,7 @@
 # CHECK-NEXT:    SHF_ALLOC
 # CHECK-NEXT:    SHF_EXECINSTR
 # CHECK-NEXT:  ]
-# CHECK-NEXT:  Address: 0x2011C4
+# CHECK-NEXT:  Address: 0x2011BC
 
 .section .text.f1, "ax"
 .cfi_startproc

diff  --git a/lld/test/ELF/eh-frame-hdr.s b/lld/test/ELF/eh-frame-hdr.s
index 0675383a611e1..dd78925ac537e 100644
--- a/lld/test/ELF/eh-frame-hdr.s
+++ b/lld/test/ELF/eh-frame-hdr.s
@@ -41,17 +41,17 @@ _start:
 // HDRDISASM:      Disassembly of section foo:
 // HDRDISASM-EMPTY:
 // HDRDISASM-NEXT: <foo>:
-// HDRDISASM-NEXT:    2011e4: 90 nop
+// HDRDISASM-NEXT:    2011dc: 90 nop
 // HDRDISASM-EMPTY:
 // HDRDISASM-NEXT: Disassembly of section bar:
 // HDRDISASM-EMPTY:
 // HDRDISASM-NEXT: <bar>:
-// HDRDISASM-NEXT:    2011e5: 90 nop
+// HDRDISASM-NEXT:    2011dd: 90 nop
 // HDRDISASM-EMPTY:
 // HDRDISASM-NEXT: Disassembly of section dah:
 // HDRDISASM-EMPTY:
 // HDRDISASM-NEXT: <dah>:
-// HDRDISASM-NEXT:    2011e6: 90 nop
+// HDRDISASM-NEXT:    2011de: 90 nop
 
 // HDR:       Section {
 // HDR:         Index:
@@ -68,9 +68,9 @@ _start:
 // HDR-NEXT:    AddressAlignment: 4
 // HDR-NEXT:    EntrySize: 0
 // HDR-NEXT:    SectionData (
-// HDR-NEXT:      0000: 011B033B 24000000 03000000 8C100000
-// HDR-NEXT:      0010: 40000000 8D100000 58000000 8E100000
-// HDR-NEXT:      0020: 70000000
+// HDR-NEXT:      0000: 011B033B 24000000 03000000 84100000
+// HDR-NEXT:      0010: 40000000 85100000 54000000 86100000
+// HDR-NEXT:      0020: 68000000
 // HDR-NEXT:    )
 //              Header (always 4 bytes): 0x011B033B
 //                 24000000 = .eh_frame(0x200180) - .eh_frame_hdr(0x200158) - 4
@@ -97,19 +97,18 @@ _start:
 // HDR-NEXT:    ]
 // HDR-NEXT:    Address: 0x200180
 // HDR-NEXT:    Offset: 0x180
-// HDR-NEXT:    Size: 100
+// HDR-NEXT:    Size: 92
 // HDR-NEXT:    Link: 0
 // HDR-NEXT:    Info: 0
 // HDR-NEXT:    AddressAlignment: 8
 // HDR-NEXT:    EntrySize: 0
 // HDR-NEXT:    SectionData (
 // HDR-NEXT:      0000: 14000000 00000000 017A5200 01781001
-// HDR-NEXT:      0010: 1B0C0708 90010000 14000000 1C000000
-// HDR-NEXT:      0020: 44100000 01000000 00000000 00000000
-// HDR-NEXT:      0030: 14000000 34000000 2D100000 01000000
-// HDR-NEXT:      0040: 00000000 00000000 14000000 4C000000
-// HDR-NEXT:      0050: 16100000 01000000 00000000 00000000
-// HDR-NEXT:      0060: 00000000
+// HDR-NEXT:      0010: 1B0C0708 90010000 10000000 1C000000
+// HDR-NEXT:      0020: 3C100000 01000000 00000000 10000000
+// HDR-NEXT:      0030: 30000000 29100000 01000000 00000000
+// HDR-NEXT:      0040: 14000000 44000000 16100000 01000000
+// HDR-NEXT:      0050: 00000000 00000000 00000000
 // HDR-NEXT:    )
 //            CIE: 14000000 00000000 017A5200 01781001 1B0C0708 90010000
 //            FDE(1): 14000000 1C000000 600E0000 01000000 00000000 00000000

diff  --git a/lld/test/ELF/eh-frame-merge.s b/lld/test/ELF/eh-frame-merge.s
index b9136b01708e8..1fc69fb629016 100644
--- a/lld/test/ELF/eh-frame-merge.s
+++ b/lld/test/ELF/eh-frame-merge.s
@@ -10,30 +10,30 @@
 # RUN: llvm-readelf -S -r %t2.so | FileCheck %s
 
 # CHECK:       Name      Type     Address              Off      Size   ES Flg Lk Inf Al
-# CHECK:      .eh_frame  PROGBITS [[#%x,]]             [[#%x,]] 000064 00   A  0   0  8
+# CHECK:      .eh_frame  PROGBITS [[#%x,]]             [[#%x,]] 000058 00   A  0   0  8
 # CHECK:      foo        PROGBITS {{0*}}[[#%x,FOO:]]   [[#%x,]] 000002 00  AX  0   0  1
 # CHECK-NEXT: bar        PROGBITS {{0*}}[[#%x,FOO+2]]  [[#%x,]] 000002 00  AX  0   0  1
 
 # RELOC:        Offset             Info     Type          Symbol's Value  Symbol's Name + Addend
 # RELOC-NEXT: {{0*}}[[#%x,OFF:]]   [[#%x,]] R_X86_64_PC32 [[#%x,]]        foo + 0
-# RELOC-NEXT: {{0*}}[[#%x,OFF+24]] [[#%x,]] R_X86_64_PC32 [[#%x,]]        bar + 0
-# RELOC-NEXT: {{0*}}[[#OFF+48]]    [[#%x,]] R_X86_64_PC32 [[#%x,]]        foo + 1
+# RELOC-NEXT: {{0*}}[[#%x,OFF+20]] [[#%x,]] R_X86_64_PC32 [[#%x,]]        bar + 0
+# RELOC-NEXT: {{0*}}[[#OFF+40]]    [[#%x,]] R_X86_64_PC32 [[#%x,]]        foo + 1
 # RELOC-NEXT: {{0*}}[[#%x,OFF-24]] [[#%x,]] R_X86_64_NONE 0{{$}}
 
 # EH:          Format:                DWARF32
-# EH:        00000018 00000014 0000001c FDE cie=00000000 pc={{0*}}[[#%x,FOO:]]...
+# EH:        00000018 00000010 0000001c FDE cie=00000000 pc={{0*}}[[#%x,FOO:]]...
 # EH-SAME:   {{0*}}[[#%x,FOO+1]]
-# EH-COUNT-7:  DW_CFA_nop:
+# EH-COUNT-3:  DW_CFA_nop:
 # EH-EMPTY:  
-# EH:        00000030 00000014 00000034 FDE cie=00000000 pc={{0*}}[[#%x,FOO+2]]...{{0*}}[[#%x,FOO+4]]
-# EH-COUNT-7:  DW_CFA_nop:
+# EH:        0000002c 00000010 00000030 FDE cie=00000000 pc={{0*}}[[#%x,FOO+2]]...{{0*}}[[#%x,FOO+4]]
+# EH-COUNT-3:  DW_CFA_nop:
 # EH-EMPTY:
-# EH:        00000048 00000014 0000004c FDE cie=00000000 pc={{0*}}[[#%x,FOO+1]]...{{0*}}[[#%x,FOO+2]]
-# EH-COUNT-7:  DW_CFA_nop:
+# EH:        00000040 00000010 00000044 FDE cie=00000000 pc={{0*}}[[#%x,FOO+1]]...{{0*}}[[#%x,FOO+2]]
+# EH-COUNT-3:  DW_CFA_nop:
 # EH-EMPTY:
 # EH-NEXT:     0x[[#%x,]]: CFA=RSP+8: RIP=[CFA-8]
 # EH-EMPTY:
-# EH-NEXT:   00000060 ZERO terminator
+# EH-NEXT:   00000054 ZERO terminator
 
         .section	foo,"ax", at progbits
 	.cfi_startproc

diff  --git a/lld/test/ELF/eh-frame-multiple-cie.s b/lld/test/ELF/eh-frame-multiple-cie.s
index 2f25673e04833..ea9ef4614f0dd 100644
--- a/lld/test/ELF/eh-frame-multiple-cie.s
+++ b/lld/test/ELF/eh-frame-multiple-cie.s
@@ -7,21 +7,21 @@
 # CHECK:        Augmentation:
 # CHECK-SAME:                "zR"
 
-# CHECK:      00000018 00000014 0000001c FDE cie=00000000 {{.*}}
+# CHECK:      00000018 00000010 0000001c FDE cie=00000000 {{.*}}
 
-# CHECK:      00000030 0000001c 00000000 CIE
+# CHECK:      0000002c 00000018 00000000 CIE
 # CHECK:        Augmentation:
 # CHECK-SAME:                "zPR"
 # CHECK:        Personality Address:
 
-# CHECK:      00000050 00000014 00000024 FDE cie=00000030 {{.*}}
+# CHECK:      00000048 00000010 00000020 FDE cie=0000002c {{.*}}
 
-# CHECK:      00000068 0000001c 00000000 CIE
+# CHECK:      0000005c 00000018 00000000 CIE
 # CHECK:        Augmentation:
 # CHECK-SAME:                "zPR"
 # CHECK:        Personality Address:
 
-# CHECK:      00000088 00000014 00000024 FDE cie=00000068 {{.*}}
+# CHECK:      00000078 00000014 00000020 FDE cie=0000005c {{.*}}
 
 foo0:
 .cfi_startproc

diff  --git a/lld/test/ELF/eh-frame-negative-pcrel-sdata2.s b/lld/test/ELF/eh-frame-negative-pcrel-sdata2.s
index dc78953ea4ff2..72325bbf14407 100644
--- a/lld/test/ELF/eh-frame-negative-pcrel-sdata2.s
+++ b/lld/test/ELF/eh-frame-negative-pcrel-sdata2.s
@@ -23,9 +23,9 @@
 # CHECK-NEXT:   AddressAlignment:
 # CHECK-NEXT:   EntrySize:
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 14000000 00000000 017A5200 01010101
-# CHECK-NEXT:     0010: 1A000000 00000000 0C000000 1C000000
-# CHECK-NEXT:     0020: DFFFFFFF
+# CHECK-NEXT:     0000: 10000000 00000000 017A5200 01010101
+# CHECK-NEXT:     0010: 1A000000 0A000000 18000000 E3FFFFFF
+# CHECK-NEXT:     0020: 00000000 0000
 #                       ^
 #   DFFFFFFF = _start(0x1000) - PC(.eh_frame(0x1001) + 0x20)
 
@@ -36,21 +36,21 @@
 # CHECK-NEXT:   Flags [
 # CHECK-NEXT:     SHF_ALLOC
 # CHECK-NEXT:   ]
-# CHECK-NEXT:   Address: 0x1030
-# CHECK-NEXT:   Offset: 0x1030
+# CHECK-NEXT:   Address: 0x1028
+# CHECK-NEXT:   Offset: 0x1028
 # CHECK-NEXT:   Size: 20
 # CHECK-NEXT:   Link: 0
 # CHECK-NEXT:   Info: 0
 # CHECK-NEXT:   AddressAlignment: 4
 # CHECK-NEXT:   EntrySize: 0
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 011B033B CDFFFFFF 01000000 D0FFFFFF
-# CHECK-NEXT:     0010: E9FFFFFF
+# CHECK-NEXT:     0000: 011B033B D5FFFFFF 01000000 D8FFFFFF
+# CHECK-NEXT:     0010: EDFFFFFF
 #   Header (always 4 bytes): 011B033B
-#   CDFFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x1030) - 4
+#   D5FFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x1028) - 4
 #   01000000 = 1 = the number of FDE pointers in the table.
-#   D0FFFFFF = _start(0x1000) - .eh_frame_hdr(0x1030)
-#   E9FFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x1030)
+#   D8FFFFFF = _start(0x1000) - .eh_frame_hdr(0x1028)
+#   EDFFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x1028)
 
 .text
 .global _start

diff  --git a/lld/test/ELF/eh-frame-negative-pcrel-sdata4.s b/lld/test/ELF/eh-frame-negative-pcrel-sdata4.s
index b9cd45323451e..9e701acffecec 100644
--- a/lld/test/ELF/eh-frame-negative-pcrel-sdata4.s
+++ b/lld/test/ELF/eh-frame-negative-pcrel-sdata4.s
@@ -23,11 +23,9 @@
 # CHECK-NEXT:   AddressAlignment:
 # CHECK-NEXT:   EntrySize:
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 14000000 00000000 017A5200 01010101
-# CHECK-NEXT:     0010: 1B000000 00000000 0C000000 1C000000
-# CHECK-NEXT:     0020: DFFFFFFF
-#                       ^
-#   DFFFFFFF = _start(0x1000) - PC(.eh_frame(0x1001) + 0x20)
+# CHECK-NEXT:     0000: 10000000 00000000 017A5200 01010101
+# CHECK-NEXT:     0010: 1B000000 0C000000 18000000 E3FFFFFF
+# CHECK-NEXT:     0020: 00000000 00000000
 
 # CHECK:      Section {
 # CHECK:        Index:
@@ -36,21 +34,21 @@
 # CHECK-NEXT:   Flags [
 # CHECK-NEXT:     SHF_ALLOC
 # CHECK-NEXT:   ]
-# CHECK-NEXT:   Address: 0x1030
-# CHECK-NEXT:   Offset: 0x1030
+# CHECK-NEXT:   Address: 0x102C
+# CHECK-NEXT:   Offset: 0x102C
 # CHECK-NEXT:   Size: 20
 # CHECK-NEXT:   Link: 0
 # CHECK-NEXT:   Info: 0
 # CHECK-NEXT:   AddressAlignment: 4
 # CHECK-NEXT:   EntrySize: 0
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 011B033B CDFFFFFF 01000000 D0FFFFFF
+# CHECK-NEXT:     0000: 011B033B D1FFFFFF 01000000 D4FFFFFF
 # CHECK-NEXT:     0010: E9FFFFFF
 #   Header (always 4 bytes): 011B033B
-#   CDFFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x1030) - 4
+#   D1FFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x102C) - 4
 #   01000000 = 1 = the number of FDE pointers in the table.
-#   D0FFFFFF = _start(0x1000) - .eh_frame_hdr(0x1030)
-#   E9FFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x1030)
+#   D4FFFFFF = _start(0x1000) - .eh_frame_hdr(0x102C)
+#   E9FFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x102C)
 
 .text
 .global _start

diff  --git a/lld/test/ELF/eh-frame-negative-pcrel-sdata8.s b/lld/test/ELF/eh-frame-negative-pcrel-sdata8.s
index 887a27ad0f55a..794258f75803f 100644
--- a/lld/test/ELF/eh-frame-negative-pcrel-sdata8.s
+++ b/lld/test/ELF/eh-frame-negative-pcrel-sdata8.s
@@ -23,11 +23,11 @@
 # CHECK-NEXT:   AddressAlignment:
 # CHECK-NEXT:   EntrySize:
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 14000000 00000000 017A5200 01010101
-# CHECK-NEXT:     0010: 1C000000 00000000 14000000 1C000000
-# CHECK-NEXT:     0020: DFFFFFFF FFFFFFFF
-#                       ^
-#   DFFFFFFF FFFFFFFF = _start(0x1000) - PC(.eh_frame(0x1001) + 0x20)
+# CHECK-NEXT:     0000: 10000000 00000000 017A5200 01010101
+# CHECK-NEXT:     0010: 1C000000 10000000 18000000 E3FFFFFF
+# CHECK-NEXT:     0020: FFFFFFFF 00000000 00000000
+#                                                  ^
+#   E3FFFFFF FFFFFFFF = _start(0x1000) - PC(.eh_frame(0x1001) + 0x1C)
 
 # CHECK:      Section {
 # CHECK:        Index:
@@ -36,21 +36,21 @@
 # CHECK-NEXT:   Flags [
 # CHECK-NEXT:     SHF_ALLOC
 # CHECK-NEXT:   ]
-# CHECK-NEXT:   Address: 0x1038
-# CHECK-NEXT:   Offset: 0x1038
+# CHECK-NEXT:   Address: 0x1030
+# CHECK-NEXT:   Offset: 0x1030
 # CHECK-NEXT:   Size: 20
 # CHECK-NEXT:   Link: 0
 # CHECK-NEXT:   Info: 0
 # CHECK-NEXT:   AddressAlignment: 4
 # CHECK-NEXT:   EntrySize: 0
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 011B033B C5FFFFFF 01000000 C8FFFFFF
-# CHECK-NEXT:     0010: E1FFFFFF
+# CHECK-NEXT:     0000: 011B033B CDFFFFFF 01000000 D0FFFFFF
+# CHECK-NEXT:     0010: E5FFFFFF
 #   Header (always 4 bytes): 011B033B
-#   C5FFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x1038) - 4
+#   CDFFFFFF = .eh_frame(0x1001) - .eh_frame_hdr(0x1030) - 4
 #   01000000 = 1 = the number of FDE pointers in the table.
-#   C8FFFFFF = _start(0x1000) - .eh_frame_hdr(0x1038)
-#   E1FFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x1038)
+#   D0FFFFFF = _start(0x1000) - .eh_frame_hdr(0x1030)
+#   E5FFFFFF = FDE(.eh_frame(0x1001) + 0x18) - .eh_frame_hdr(0x1030)
 
 .text
 .global _start

diff  --git a/lld/test/ELF/eh-frame-padding-no-rosegment.s b/lld/test/ELF/eh-frame-padding-no-rosegment.s
index fe4c312613a53..67be65895ef4d 100644
--- a/lld/test/ELF/eh-frame-padding-no-rosegment.s
+++ b/lld/test/ELF/eh-frame-padding-no-rosegment.s
@@ -57,8 +57,8 @@ bar:
 // CHECK-NEXT: AddressAlignment:
 // CHECK-NEXT: EntrySize:
 // CHECK-NEXT: SectionData (
-// CHECK-NEXT:   0000: 1C000000 00000000 017A5052 00017810
-// CHECK-NEXT:   0010: 061B2A00 00001B0C 07089001 00000000
-// CHECK-NEXT:   0020: 14000000 24000000 14000000 00000000
-// CHECK-NEXT:   0030: 00000000 00000000
+// CHECK-NEXT:   0000: 18000000 00000000 017A5052 00017810
+// CHECK-NEXT:   0010: 061B2200 00001B0C 07089001 10000000
+// CHECK-NEXT:   0020: 20000000 10000000 00000000 00000000
+// CHECK-NEXT:   0030: 00000000
 // CHECK-NEXT: )

diff  --git a/lld/test/ELF/eh-frame-value-format7.s b/lld/test/ELF/eh-frame-value-format7.s
index 3f87b2915a720..99eff108026a2 100644
--- a/lld/test/ELF/eh-frame-value-format7.s
+++ b/lld/test/ELF/eh-frame-value-format7.s
@@ -22,7 +22,7 @@
 # CHECK-NEXT:   EntrySize: 0
 # CHECK-NEXT:   SectionData (
 # CHECK-NEXT:     0000: 011B033B 10000000 01000000 30F2FFFF
-# CHECK-NEXT:     0010: 2C000000
+# CHECK-NEXT:     0010: 26000000
 # Header (always 4 bytes): 011B033B
 #    10000000 = .eh_frame(0x2018) - .eh_frame_hdr(0x2004) - 4
 #    01000000 = 1 = the number of FDE pointers in the table.
@@ -43,10 +43,9 @@
 # CHECK-NEXT:   AddressAlignment:
 # CHECK-NEXT:   EntrySize:
 # CHECK-NEXT:   SectionData (
-# CHECK-NEXT:     0000: 14000000 00000000 01525300 01010102
-# CHECK-NEXT:     0010: FF000000 00000000 0C000000 1C000000
-# CHECK-NEXT:     0020: 34120000 00000000 00000000
-#                       ^
+# CHECK-NEXT:     0000: 0E000000 00000000 01525300 01010102
+# CHECK-NEXT:     0010: FF000600 00001600 00003412 00000000
+#                                             ^
 #                       ---> ADDR(foo) + 0x234 = 0x1234
 
 .text
@@ -55,7 +54,7 @@ foo:
  nop
 
 .section .eh_frame,"a", at unwind
-  .long 13   # Size
+  .long 14   # Size
   .long 0x00 # ID
   .byte 0x01 # Version.
   
@@ -71,7 +70,8 @@ foo:
   .byte 0x02 # DW_EH_PE_udata2
 
   .byte 0xFF
+  .byte 0
  
   .long 0x6  # Size
-  .long 0x15 # ID
+  .long 0x16 # ID
   .short foo + 0x234

diff  --git a/lld/test/ELF/gdb-index-gc-sections.s b/lld/test/ELF/gdb-index-gc-sections.s
index cd7100ed67c50..3c4ad3ad20fb5 100644
--- a/lld/test/ELF/gdb-index-gc-sections.s
+++ b/lld/test/ELF/gdb-index-gc-sections.s
@@ -4,7 +4,7 @@
 # RUN: llvm-dwarfdump -gdb-index %t2 | FileCheck %s
 
 # CHECK: Address area offset = 0x28, has 1 entries:
-# CHECK-NEXT:    Low/High address = [0x201154, 0x201155) (Size: 0x1), CU id = 0
+# CHECK-NEXT:    Low/High address = [0x201150, 0x201151) (Size: 0x1), CU id = 0
 
 # Generated with: (clang r302976)
 # echo "void _start() {} void dead() {}" | \

diff  --git a/lld/test/ELF/map-file.s b/lld/test/ELF/map-file.s
index 4f6cd320ced68..59931409c7abd 100644
--- a/lld/test/ELF/map-file.s
+++ b/lld/test/ELF/map-file.s
@@ -62,41 +62,40 @@ labs = 0x1AB5
 # CHECK-NEXT:          200308           200308       30     8         <internal>:(.rela.dyn)
 # CHECK-NEXT:          200338           200338       30     8 .rela.plt
 # CHECK-NEXT:          200338           200338       30     8         <internal>:(.rela.plt)
-# CHECK-NEXT:          200368           200368       64     8 .eh_frame
-# CHECK-NEXT:          200368           200368       2c     1         {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x0)
-# CHECK-NEXT:          200398           200398       14     1         {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x2c)
-# CHECK-NEXT:          2003b0           2003b0       18     1         {{.*}}{{/|\\}}map-file.s.tmp2.o:(.eh_frame+0x18)
-# CHECK-NEXT:          2013cc           2013cc       35     4 .text
-# CHECK-NEXT:          2013cc           2013cc       2c     4         {{.*}}{{/|\\}}map-file.s.tmp1.o:(.text)
-# CHECK-NEXT:          2013cc           2013cc        0     1                 _start
-# CHECK-NEXT:          2013ef           2013ef        0     1                 f(int)
-# CHECK-NEXT:          2013f8           2013f8        0     1                 local
-# CHECK-NEXT:          2013f8           2013f8        2     4         {{.*}}{{/|\\}}map-file.s.tmp2.o:(.text)
-# CHECK-NEXT:          2013f8           2013f8        0     1                 foo
-# CHECK-NEXT:          2013f9           2013f9        0     1                 bar
-# CHECK-NEXT:          2013fa           2013fa        0     1         {{.*}}{{/|\\}}map-file.s.tmp2.o:(.text.zed)
-# CHECK-NEXT:          2013fa           2013fa        0     1                 zed
-# CHECK-NEXT:          2013fc           2013fc        0     4         {{.*}}{{/|\\}}map-file.s.tmp3.o:(.text)
-# CHECK-NEXT:          2013fc           2013fc        0     1                 bah
-# CHECK-NEXT:          2013fc           2013fc        1     4         {{.*}}{{/|\\}}map-file.s.tmp4.a(map-file.s.tmp4.o):(.text)
-# CHECK-NEXT:          2013fc           2013fc        0     1                 baz
-# CHECK-NEXT:          201400           201400        1     4         {{.*}}{{/|\\}}map-file.s.tmp6.a({{.*}}{{/|\\}}map-file.s.tmp6.o):(.text)
-# CHECK-NEXT:          201400           201400        0     1                 hey
-# CHECK-NEXT:          201410           201410       30    16 .plt
-# CHECK-NEXT:          201410           201410       30    16         <internal>:(.plt)
-# CHECK-NEXT:          201420           201420        0     1                 sharedFunc1
-# CHECK-NEXT:          201430           201430        0     1                 sharedFunc2
-# CHECK-NEXT:          202440           202440      100     8 .dynamic
-# CHECK-NEXT:          202440           202440      100     8         <internal>:(.dynamic)
-# CHECK-NEXT:          203540           203540       28     8 .got.plt
-# CHECK-NEXT:          203540           203540       28     8         <internal>:(.got.plt)
-# CHECK-NEXT:          203570           203570       10    16 .bss
-# CHECK-NEXT:          203570           203570        4    16         {{.*}}{{/|\\}}map-file.s.tmp1.o:(COMMON)
-# CHECK-NEXT:          203570           203570        4     1                 common
-# CHECK-NEXT:          203574           203574        4     1         <internal>:(.bss)
-# CHECK-NEXT:          203574           203574        4     1                 sharedFoo
-# CHECK-NEXT:          203578           203578        8     1         <internal>:(.bss)
-# CHECK-NEXT:          203578           203578        8     1                 sharedBar
+# CHECK-NEXT:          200368           200368       5c     8 .eh_frame
+# CHECK-NEXT:          200368           200368       40     1         {{.*}}{{/|\\}}map-file.s.tmp1.o:(.eh_frame+0x0)
+# CHECK-NEXT:          2003a8           2003a8       18     1         {{.*}}{{/|\\}}map-file.s.tmp2.o:(.eh_frame+0x18)
+# CHECK-NEXT:          2013c4           2013c4       35     4 .text
+# CHECK-NEXT:          2013c4           2013c4       2c     4         {{.*}}{{/|\\}}map-file.s.tmp1.o:(.text)
+# CHECK-NEXT:          2013c4           2013c4        0     1                 _start
+# CHECK-NEXT:          2013e7           2013e7        0     1                 f(int)
+# CHECK-NEXT:          2013f0           2013f0        0     1                 local
+# CHECK-NEXT:          2013f0           2013f0        2     4         {{.*}}{{/|\\}}map-file.s.tmp2.o:(.text)
+# CHECK-NEXT:          2013f0           2013f0        0     1                 foo
+# CHECK-NEXT:          2013f1           2013f1        0     1                 bar
+# CHECK-NEXT:          2013f2           2013f2        0     1         {{.*}}{{/|\\}}map-file.s.tmp2.o:(.text.zed)
+# CHECK-NEXT:          2013f2           2013f2        0     1                 zed
+# CHECK-NEXT:          2013f4           2013f4        0     4         {{.*}}{{/|\\}}map-file.s.tmp3.o:(.text)
+# CHECK-NEXT:          2013f4           2013f4        0     1                 bah
+# CHECK-NEXT:          2013f4           2013f4        1     4         {{.*}}{{/|\\}}map-file.s.tmp4.a(map-file.s.tmp4.o):(.text)
+# CHECK-NEXT:          2013f4           2013f4        0     1                 baz
+# CHECK-NEXT:          2013f8           2013f8        1     4         {{.*}}{{/|\\}}map-file.s.tmp6.a({{.*}}{{/|\\}}map-file.s.tmp6.o):(.text)
+# CHECK-NEXT:          2013f8           2013f8        0     1                 hey
+# CHECK-NEXT:          201400           201400       30    16 .plt
+# CHECK-NEXT:          201400           201400       30    16         <internal>:(.plt)
+# CHECK-NEXT:          201410           201410        0     1                 sharedFunc1
+# CHECK-NEXT:          201420           201420        0     1                 sharedFunc2
+# CHECK-NEXT:          202430           202430      100     8 .dynamic
+# CHECK-NEXT:          202430           202430      100     8         <internal>:(.dynamic)
+# CHECK-NEXT:          203530           203530       28     8 .got.plt
+# CHECK-NEXT:          203530           203530       28     8         <internal>:(.got.plt)
+# CHECK-NEXT:          203560           203560       10    16 .bss
+# CHECK-NEXT:          203560           203560        4    16         {{.*}}{{/|\\}}map-file.s.tmp1.o:(COMMON)
+# CHECK-NEXT:          203560           203560        4     1                 common
+# CHECK-NEXT:          203564           203564        4     1         <internal>:(.bss)
+# CHECK-NEXT:          203564           203564        4     1                 sharedFoo
+# CHECK-NEXT:          203568           203568        8     1         <internal>:(.bss)
+# CHECK-NEXT:          203568           203568        8     1                 sharedBar
 # CHECK-NEXT:               0                0        8     1 .comment
 # CHECK-NEXT:               0                0        8     1         <internal>:(.comment)
 # CHECK-NEXT:               0                0      1b0     8 .symtab

diff  --git a/lld/test/ELF/partition-synthetic-sections.s b/lld/test/ELF/partition-synthetic-sections.s
index 3654b3cf5c58e..2eec08392fe68 100644
--- a/lld/test/ELF/partition-synthetic-sections.s
+++ b/lld/test/ELF/partition-synthetic-sections.s
@@ -123,7 +123,7 @@
 // CHECK: .eh_frame section
 // CHECK: 0x[[EH_FRAME_ADDR]]] CIE length=20
 // CHECK-NOT: FDE
-// CHECK: 0x[[FDE_ADDR]]] FDE length=20 cie={{.}}0x[[EH_FRAME_ADDR]]
+// CHECK: 0x[[FDE_ADDR]]] FDE length=16 cie={{.}}0x[[EH_FRAME_ADDR]]
 // CHECK-NEXT: initial_location: 0x[[TEXT_ADDR]]
 // CHECK-NOT: FDE
 // CHECK: CIE length=0
@@ -139,15 +139,15 @@
 // CHECK-EMPTY:
 
 // PART0: Symbol table '.symtab'
-// PART0: 000000000000048c     0 NOTYPE  LOCAL  HIDDEN    {{.*}} __part_index_begin
-// PART0: 0000000000000498     0 NOTYPE  LOCAL  HIDDEN    {{.*}} __part_index_end
+// PART0: 0000000000000488     0 NOTYPE  LOCAL  HIDDEN    {{.*}} __part_index_begin
+// PART0: 0000000000000494     0 NOTYPE  LOCAL  HIDDEN    {{.*}} __part_index_end
 
 // PART-INDEX: Contents of section .dynstr:
 // PART-INDEX-NEXT: 03a8 00703000 66310066 32007061 72743100 .p0.f1.f2.part1.
 // PART-INDEX: Contents of section .rodata:
 //                       0x48c + 0xffffff26 = 0x3b2
 //                                0x490 + 0x3b70 = 0x4000
-// PART-INDEX-NEXT: 048c 26ffffff 703b0000 50410000
+// PART-INDEX-NEXT: 0488 2affffff 743b0000 50410000
 
 // CHECK: Version symbols section '.gnu.version'
 // CHECK-NEXT: Addr:


        


More information about the llvm-commits mailing list