[ELF] - Add a test for --gc-sections --undefined=foo combination.
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 10 Aug 2017 08:15:33 +0000 (08:15 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 10 Aug 2017 08:15:33 +0000 (08:15 +0000)
GC code contains following logic uncovered by tests:

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

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

Differential revision: https://reviews.llvm.org/D36519

llvm-svn: 310556

lld/test/ELF/gc-sections-undefined.s [new file with mode: 0644]

diff --git a/lld/test/ELF/gc-sections-undefined.s b/lld/test/ELF/gc-sections-undefined.s
new file mode 100644 (file)
index 0000000..e1ce9c7
--- /dev/null
@@ -0,0 +1,10 @@
+# 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
+# RUN: llvm-readobj -t %t1 | FileCheck %s
+
+# CHECK: foo
+
+.section .foo,"ax"
+.global foo
+foo: