[lld] r335475 - [ELF] - ICF: add one more test case.

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


Author: grimar
Date: Mon Jun 25 07:00:05 2018
New Revision: 335475

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

This test case check that ICF does not merge 2 sections which relocations
efer to symbols that live in sections of the different types
(regular input section and mergeable input sections in this case).

It covers the following line of code, which was uncovered previously:
https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L271

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

Added: lld/trunk/test/ELF/icf14.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf14.s?rev=335475&view=auto
==============================================================================
--- lld/trunk/test/ELF/icf14.s (added)
+++ lld/trunk/test/ELF/icf14.s Mon Jun 25 07:00:05 2018
@@ -0,0 +1,26 @@
+# 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
+# refer to symbols that live in sections of the different types
+# (regular input section and mergeable input sections in this case).
+
+# CHECK-NOT: selected
+
+.section .text
+.globl _start
+_start:
+  ret
+
+.section .rodata.str,"aMS", at progbits,1
+.globl rodata
+rodata:
+.asciz "foo"
+
+.section .text.foo, "ax"
+.quad rodata
+
+.section .text.bar, "ax"
+.quad _start




More information about the llvm-commits mailing list