[PATCH] D34678: [LLD][ELF] Consolidate .ARM.extab.* sections into .ARM.extab

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 04:09:36 PDT 2017


peter.smith created this revision.
Herald added subscribers: kristof.beyls, javed.absar, emaste, aemerson.

When -ffunction-sections and ARM C++ exceptions are used each .text.suffix section will have at least one .ARM.exidx.suffix section and may have an additional .ARM.extab.suffix section if the unwinding instructions are too large to inline into the .ARM.exidx table entry. For a large program without a linker script this can lead to a large number of section header table entries that can increase the size of the ELF file.

      

This change introduces a default rule for .ARM.extab.* to be placed in a single output section called .ARM.extab . This follows the behavior of ld.gold and ld.bfd.

      

fixes pr33407


https://reviews.llvm.org/D34678

Files:
  ELF/Writer.cpp
  test/ELF/arm-exidx-canunwind.s
  test/ELF/arm-exidx-gc.s
  test/ELF/arm-exidx-shared.s


Index: test/ELF/arm-exidx-shared.s
===================================================================
--- test/ELF/arm-exidx-shared.s
+++ test/ELF/arm-exidx-shared.s
@@ -40,6 +40,6 @@
 // CHECK-NEXT:   Section (6) .rel.plt {
 // CHECK-NEXT:     0x200C R_ARM_JUMP_SLOT __gxx_personality_v0
 
-// CHECK-EXTAB: Contents of section .ARM.extab.text.func2:
+// CHECK-EXTAB: Contents of section .ARM.extab:
 // 014c + 0ed8 = 0x1024 = __gxx_personality_v0(PLT)
 // CHECK-EXTAB-NEXT:  014c d80e0000 b0b0b000 00000000
Index: test/ELF/arm-exidx-gc.s
===================================================================
--- test/ELF/arm-exidx-gc.s
+++ test/ELF/arm-exidx-gc.s
@@ -110,16 +110,15 @@
 // CHECK-NOT: unusedfunc2
 // CHECK-NOT: __gxx_personality_v1
 
-// CHECK-EXIDX-NOT: Contents of section .ARM.extab.text.unusedfunc2:
 // CHECK-EXIDX: Contents of section .ARM.exidx:
 // 100d4 + f38 = 1100c = func1
-// 100dc + f34 = 11010 = func2 (100e0 + 1c = 100fc = .ARM.extab.text.func2)
+// 100dc + f34 = 11010 = func2 (100e0 + 1c = 100fc = .ARM.extab)
 // CHECK-EXIDX-NEXT: 100d4 380f0000 08849780 340f0000 1c000000
 // 100e4 + f30 = 11014 = __gxx_personality_v0
 // 100ec + f2c = 11018 = __aeabi_unwind_cpp_pr0
 // CHECK-EXIDX-NEXT: 100e4 300f0000 01000000 2c0f0000 01000000
 // 100f4 + f28 = 1101c = __aeabi_unwind_cpp_pr0 + sizeof(__aeabi_unwind_cpp_pr0)
 // CHECK-EXIDX-NEXT: 100f4 280f0000 01000000
-// CHECK-EXIDX-NEXT: Contents of section .ARM.extab.text.func2:
+// CHECK-EXIDX-NEXT: Contents of section .ARM.extab:
 // 100fc + f18 = 11014 = __gxx_personality_v0
 // CHECK-EXIDX-NEXT: 100fc 180f0000 b0b0b000
Index: test/ELF/arm-exidx-canunwind.s
===================================================================
--- test/ELF/arm-exidx-canunwind.s
+++ test/ELF/arm-exidx-canunwind.s
@@ -72,7 +72,7 @@
 // CHECK-EXIDX-NEXT: 100d4 380f0000 08849780 340f0000 0c000000
 // 100e4 + f30 = 11014 = terminate = func2 + sizeof(func2)
 // CHECK-EXIDX-NEXT: 100e4 300f0000 01000000
-// CHECK-EXIDX-NEXT: Contents of section .ARM.extab.text.func2:
+// CHECK-EXIDX-NEXT: Contents of section .ARM.extab:
 // 100ec + f28 = 11014 = __gxx_personality_v0
 // CHECK-EXIDX-NEXT: 100ec 280f0000 b0b0b000 00000000
 
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -104,7 +104,7 @@
   for (StringRef V :
        {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.rel.ro.",
         ".bss.", ".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.",
-        ".gcc_except_table.", ".tdata.", ".ARM.exidx."}) {
+        ".gcc_except_table.", ".tdata.", ".ARM.exidx.", ".ARM.extab."}) {
     StringRef Prefix = V.drop_back();
     if (Name.startswith(V) || Name == Prefix)
       return Prefix;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34678.104130.patch
Type: text/x-patch
Size: 2765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170627/bb80e3c2/attachment.bin>


More information about the llvm-commits mailing list