[lld] r335453 - [ELF] - ICF: test we do not merge sectinons which relocations points to symbols of the different types.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 04:37:27 PDT 2018


Author: grimar
Date: Mon Jun 25 04:37:27 2018
New Revision: 335453

URL: http://llvm.org/viewvc/llvm-project?rev=335453&view=rev
Log:
[ELF] - ICF: test we do not merge sectinons which relocations points to symbols of the different types.

This test case covers the following line of code:
https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L261

Previously it was uncovered.

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

Added: lld/trunk/test/ELF/icf13.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf13.s?rev=335453&view=auto
==============================================================================
--- lld/trunk/test/ELF/icf13.s (added)
+++ lld/trunk/test/ELF/icf13.s Mon Jun 25 04:37:27 2018
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
+# RUN: ld.lld -shared -z notext %t1 -o %t --icf=all --print-icf-sections 2>&1 | FileCheck -allow-empty %s
+
+## Check ICF does not collect sections which relocations point to symbols
+## of the different types. Like to defined and undefined symbols in this test case.
+
+# CHECK-NOT: selected
+
+.globl und
+
+.section .text
+.globl _start
+_start:
+  ret
+
+.section .text.foo, "ax"
+.quad _start
+
+.section .text.bar, "ax"
+.quad und




More information about the llvm-commits mailing list