[PATCH] D31932: [LLD][ELF] Mark ARM Exceptions that refer to folded code as not live

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 02:05:46 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL300182: [ELF] Mark ARM Exceptions that refer to folded code as not live (authored by psmith).

Changed prior to commit:
  https://reviews.llvm.org/D31932?vs=94806&id=95087#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31932

Files:
  lld/trunk/ELF/ICF.cpp
  lld/trunk/test/ELF/arm-icf-exidx.s


Index: lld/trunk/ELF/ICF.cpp
===================================================================
--- lld/trunk/ELF/ICF.cpp
+++ lld/trunk/ELF/ICF.cpp
@@ -375,6 +375,15 @@
       Sections[Begin]->replace(Sections[I]);
     }
   });
+
+  // Mark ARM Exception Index table sections that refer to folded code
+  // sections as not live. These sections have an implict dependency
+  // via the link order dependency.
+  if (Config->EMachine == EM_ARM)
+    for (InputSectionBase *Sec : InputSections)
+      if (auto *S = dyn_cast<InputSection>(Sec))
+        if (S->Flags & SHF_LINK_ORDER)
+          S->Live = S->getLinkOrderDep()->Live;
 }
 
 // ICF entry point function.
Index: lld/trunk/test/ELF/arm-icf-exidx.s
===================================================================
--- lld/trunk/test/ELF/arm-icf-exidx.s
+++ lld/trunk/test/ELF/arm-icf-exidx.s
@@ -0,0 +1,31 @@
+// REQUIRES: arm
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
+// RUN: ld.lld %t -o %t2 --icf=all
+// RUN: llvm-objdump -s -d -triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s
+
+ .syntax unified
+ .section        .text.f,"axG",%progbits,f,comdat
+f:
+ .fnstart
+ bx      lr
+ .fnend
+
+ .section        .text.g,"axG",%progbits,g,comdat
+g:
+ .fnstart
+ bx      lr
+ .fnend
+
+ .section .text.h
+ .global __aeabi_unwind_cpp_pr0
+__aeabi_unwind_cpp_pr0:
+ bx lr
+
+// CHECK: Disassembly of section .text:
+// CHECK-NEXT: f:
+// CHECK-NEXT:    11000:        1e ff 2f e1     bx      lr
+// CHECK: __aeabi_unwind_cpp_pr0:
+// CHECK-NEXT:    11004:        1e ff 2f e1     bx      lr
+
+// CHECK: Contents of section .ARM.exidx:
+// CHECK-NEXT:  100d4 2c0f0000 b0b0b080 280f0000 01000000


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31932.95087.patch
Type: text/x-patch
Size: 1689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170413/a808cd97/attachment.bin>


More information about the llvm-commits mailing list