[lld] r335482 - [ELF] - ICF: add one more test case #3.

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


Author: grimar
Date: Mon Jun 25 08:27:09 2018
New Revision: 335482

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

ICF is able to merge sections which relocations referring regular input sections
or mergeable sections, so it handles InputSection and MergeInputSection cases.

The following "return false" line which is executed in case of another type
of the sections is uncovered by our test cases:
https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L285
Patch fixes code coverage for this place.

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

Added: lld/trunk/test/ELF/icf16.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf16.s?rev=335482&view=auto
==============================================================================
--- lld/trunk/test/ELF/icf16.s (added)
+++ lld/trunk/test/ELF/icf16.s Mon Jun 25 08:27:09 2018
@@ -0,0 +1,23 @@
+# 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
+
+## ICF is able to merge sections which relocations referring regular input sections
+## or mergeable sections. .eh_frame is represented with a different kind of section,
+## here we check that ICF code is able to handle and will not merge sections which
+## relocations referring .eh_frame.
+
+# CHECK-NOT: selected
+
+.section ".eh_frame", "a", @progbits
+.globl foo
+foo:
+  .quad 0
+.globl bar
+bar:
+  .quad 0
+
+.section .text.foo, "ax"
+.quad foo
+
+.section .text.bar, "ax"
+.quad bar




More information about the llvm-commits mailing list