[PATCH] D49716: ELF: Do not ICF SHF_LINK_ORDER sections.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 25 14:41:15 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337967: ELF: Do not ICF SHF_LINK_ORDER sections. (authored by pcc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D49716?vs=156963&id=157367#toc
Repository:
rL LLVM
https://reviews.llvm.org/D49716
Files:
lld/trunk/ELF/ICF.cpp
lld/trunk/test/ELF/icf-link-order.s
Index: lld/trunk/ELF/ICF.cpp
===================================================================
--- lld/trunk/ELF/ICF.cpp
+++ lld/trunk/ELF/ICF.cpp
@@ -172,6 +172,11 @@
!S->Name.startswith(".data.rel.ro."))
return false;
+ // SHF_LINK_ORDER sections are ICF'd as a unit with their dependent sections,
+ // so we don't consider them for ICF individually.
+ if (S->Flags & SHF_LINK_ORDER)
+ return false;
+
// Don't merge synthetic sections as their Data member is not valid and empty.
// The Data member needs to be valid for ICF as it is used by ICF to determine
// the equality of section contents.
Index: lld/trunk/test/ELF/icf-link-order.s
===================================================================
--- lld/trunk/test/ELF/icf-link-order.s
+++ lld/trunk/test/ELF/icf-link-order.s
@@ -0,0 +1,18 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld %t.o -o %t --icf=all --print-icf-sections | count 0
+
+.section .foo,"a", at progbits,unique,1
+foo1:
+.byte 1
+
+.section .foo,"a", at progbits,unique,2
+foo2:
+.byte 2
+
+.section .bar,"ao", at progbits,foo1,unique,1
+.byte 3
+
+.section .bar,"ao", at progbits,foo2,unique,2
+.byte 3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49716.157367.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180725/a17af489/attachment.bin>
More information about the llvm-commits
mailing list