[lld] r335477 - [ELF] - ICF: add one more test case #2.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 07:28:40 PDT 2018


Author: grimar
Date: Mon Jun 25 07:28:40 2018
New Revision: 335477

URL: http://llvm.org/viewvc/llvm-project?rev=335477&view=rev
Log:
[ELF] - ICF: add one more test case #2.

Check that ICF does not merge sections which relocations
have equal addends, but different target values.

This covers the following line, which was uncovered:
https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L278

Added:
    lld/trunk/test/ELF/icf15.s

Added: lld/trunk/test/ELF/icf15.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf15.s?rev=335477&view=auto
==============================================================================
--- lld/trunk/test/ELF/icf15.s (added)
+++ lld/trunk/test/ELF/icf15.s Mon Jun 25 07:28:40 2018
@@ -0,0 +1,23 @@
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
+# RUN: ld.lld %t1 -o %t --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s
+
+## Check that ICF does not merge sections which relocations have equal addends,
+## but different target values.
+
+# CHECK-NOT: selected
+
+.globl und
+
+.section .text
+.globl foo
+foo:
+  .byte 0
+.globl bar
+bar:
+  .byte 0
+
+.section .text.foo, "ax"
+.quad foo
+
+.section .text.bar, "ax"
+.quad bar




More information about the llvm-commits mailing list