[lld] r279617 - Canonicalize output section name for .ARM.exidx sections

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 02:08:55 PDT 2016


Author: psmith
Date: Wed Aug 24 04:08:54 2016
New Revision: 279617

URL: http://llvm.org/viewvc/llvm-project?rev=279617&view=rev
Log:
Canonicalize output section name for .ARM.exidx sections
    
The ARM Exception handling ABI requires that all ARM exception index
table sections have a prefix of .ARM.exidx and are combined into a
single contiguous block either in their own output section or as part
of another output section.
    
In general clang will output a single .ARM.exidx section per object,
but will use .ARM.exidx.<section name> when -ffunction-sections is used.
    
This change canonicalizes the names of sections with the .ARM.exidx
prefix to just .ARM.exidx, which ensures that there is only a single
output section.

Differential Revision: https://reviews.llvm.org/D23775


Added:
    lld/trunk/test/ELF/arm-exidx-output.s   (with props)
Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=279617&r1=279616&r2=279617&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Aug 24 04:08:54 2016
@@ -90,7 +90,7 @@ StringRef elf::getOutputSectionName(Inpu
   StringRef Name = S->getSectionName();
   for (StringRef V : {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.",
                       ".init_array.", ".fini_array.", ".ctors.", ".dtors.",
-                      ".tbss.", ".gcc_except_table.", ".tdata."})
+                      ".tbss.", ".gcc_except_table.", ".tdata.", ".ARM.exidx."})
     if (Name.startswith(V))
       return V.drop_back();
   return Name;

Added: lld/trunk/test/ELF/arm-exidx-output.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-exidx-output.s?rev=279617&view=auto
==============================================================================
--- lld/trunk/test/ELF/arm-exidx-output.s (added)
+++ lld/trunk/test/ELF/arm-exidx-output.s Wed Aug 24 04:08:54 2016
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
+// RUN: ld.lld %t -o %t2 2>&1
+// RUN: llvm-readobj -sections %t2 | FileCheck %s
+// REQUIRES: arm
+
+// Check that only a single .ARM.exidx output section is created when
+// there are input sections of the form .ARM.exidx.<section-name>. The
+// assembler creates the .ARM.exidx input sections with the .cantunwind
+// directive
+ .syntax unified
+ .section .text, "ax",%progbits
+ .globl _start
+ .align 2
+ .type _start,%function
+_start:
+ .fnstart
+ bx lr
+ .cantunwind
+ .fnend
+
+ .section .text.f1, "ax", %progbits
+ .globl f1
+ .align 2
+ .type f1,%function
+f1:
+ .fnstart
+ bx lr
+ .cantunwind
+ .fnend
+
+ .section .text.f2, "ax", %progbits
+ .globl f2
+ .align 2
+ .type f2,%function
+f2:
+ .fnstart
+ bx lr
+ .cantunwind
+ .fnend
+
+// CHECK:         Section {
+// CHECK:         Name: .ARM.exidx
+// CHECK-NEXT:    Type: SHT_ARM_EXIDX (0x70000001)
+// CHECK-NEXT:    Flags [ (0x82)
+// CHECK-NEXT:      SHF_ALLOC (0x2)
+// CHECK-NEXT:      SHF_LINK_ORDER (0x80)
+// CHECK-NEXT:    ]
+
+// CHECK-NOT:     Name: .ARM.exidx.text.f1
+// CHECK-NOT:     Name: .ARM.exidx.text.f2

Propchange: lld/trunk/test/ELF/arm-exidx-output.s
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lld/trunk/test/ELF/arm-exidx-output.s
------------------------------------------------------------------------------
    svn:keywords = Rev Date Author URL Id




More information about the llvm-commits mailing list