[PATCH] D30365: ELF ICF: Merge only functions.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 14:54:43 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296534: ELF ICF: Merge only functions. (authored by ruiu).
Changed prior to commit:
https://reviews.llvm.org/D30365?vs=89755&id=90088#toc
Repository:
rL LLVM
https://reviews.llvm.org/D30365
Files:
lld/trunk/ELF/ICF.cpp
lld/trunk/test/ELF/icf9.s
Index: lld/trunk/test/ELF/icf9.s
===================================================================
--- lld/trunk/test/ELF/icf9.s
+++ lld/trunk/test/ELF/icf9.s
@@ -0,0 +1,20 @@
+# REQUIRES: x86
+
+### Make sure that we do not merge data.
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: ld.lld %t -o %t2 --icf=all --verbose | FileCheck %s
+
+# CHECK-NOT: selected .data.d1
+# CHECK-NOT: selected .data.d2
+
+.globl _start, d1, d2
+_start:
+ ret
+
+.section .data.f1, "a"
+d1:
+ .byte 1
+
+.section .data.f2, "a"
+d2:
+ .byte 1
Index: lld/trunk/ELF/ICF.cpp
===================================================================
--- lld/trunk/ELF/ICF.cpp
+++ lld/trunk/ELF/ICF.cpp
@@ -162,8 +162,8 @@
// .init and .fini contains instructions that must be executed to
// initialize and finalize the process. They cannot and should not
// be merged.
- return S->Live && (S->Flags & SHF_ALLOC) && !(S->Flags & SHF_WRITE) &&
- S->Name != ".init" && S->Name != ".fini";
+ return S->Live && (S->Flags & SHF_ALLOC) && (S->Flags & SHF_EXECINSTR) &&
+ !(S->Flags & SHF_WRITE) && S->Name != ".init" && S->Name != ".fini";
}
// Split an equivalence class into smaller classes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30365.90088.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170228/bc9cf147/attachment.bin>
More information about the llvm-commits
mailing list