summaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2018-06-22 15:21:38 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2018-06-22 15:21:38 +0000
commita7b35af325fbbb8ab1ae8c6a294c1bb59b649b23 (patch)
treedbe01ae9c79c551c2c3cb239f930dff6e901de94 /lld
parente5100f22c6608bba8984c36342347de0c6d2a810 (diff)
[ELF] - ICF: test we do not merge sections which relocations differs only in addend.
This is to test the following `return false` line which was uncovered by our tests earlier: https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L255
Diffstat (limited to 'lld')
-rw-r--r--lld/test/ELF/icf12.s20
1 files changed, 20 insertions, 0 deletions
diff --git a/lld/test/ELF/icf12.s b/lld/test/ELF/icf12.s
new file mode 100644
index 00000000000..749c00ddc2e
--- /dev/null
+++ b/lld/test/ELF/icf12.s
@@ -0,0 +1,20 @@
+# REQUIRES: x86
+
+# 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 2 sections which relocations
+# differs in addend only.
+
+# CHECK-NOT: selected
+
+.section .text
+.globl _start
+_start:
+ ret
+
+.section .text.foo, "ax"
+.quad _start + 1
+
+.section .text.bar, "ax"
+.quad _start + 2