[lld] r335357 - [ELF] - ICF: test we do not merge sections which relocations differs only in addend.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 08:21:39 PDT 2018


Author: grimar
Date: Fri Jun 22 08:21:38 2018
New Revision: 335357

URL: http://llvm.org/viewvc/llvm-project?rev=335357&view=rev
Log:
[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

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

Added: lld/trunk/test/ELF/icf12.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf12.s?rev=335357&view=auto
==============================================================================
--- lld/trunk/test/ELF/icf12.s (added)
+++ lld/trunk/test/ELF/icf12.s Fri Jun 22 08:21:38 2018
@@ -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




More information about the llvm-commits mailing list