[PATCH] D36519: [ELF] - Add a test for --gc-sections --undefined=foo combination.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 06:52:22 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

GC code contains following logic uncovered by tests:
(nothing fails if I remove these 2 lines)

  for (StringRef S : Config->Undefined)
    MarkSymbol(Symtab->find(S));

As far I can tell we never had test for that before,
patch fixes it.


https://reviews.llvm.org/D36519

Files:
  test/ELF/gc-sections-undefined.s


Index: test/ELF/gc-sections-undefined.s
===================================================================
--- test/ELF/gc-sections-undefined.s
+++ test/ELF/gc-sections-undefined.s
@@ -0,0 +1,20 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: ld.lld %t -o %t1 --gc-sections --undefined=foo --undefined=bar
+# RUN: llvm-readobj -t %t1 | FileCheck %s
+
+# CHECK: bar
+# CHECK: foo
+
+.section .foo,"ax"
+.global foo
+foo:
+
+.section .bar,"ax"
+.global bar
+bar:
+
+.section .text,"ax"
+.globl _start
+_start:
+ .quad foo


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36519.110383.patch
Type: text/x-patch
Size: 569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170809/2cc62bd1/attachment.bin>


More information about the llvm-commits mailing list