From 65eceee701e1d8edbdc9ec553e100097942add7f Mon Sep 17 00:00:00 2001 From: George Rimar Date: Tue, 7 Aug 2018 08:41:37 +0000 Subject: [PATCH] [LLD][ELF] - Add a test case for code in Archive::fetch(). NFCI. This covers the following piece with a test. https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L830 Thanks to Peter Collingbourne for providing the reproducer sample! llvm-svn: 339114 --- lld/test/ELF/archive-fetch.s | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lld/test/ELF/archive-fetch.s diff --git a/lld/test/ELF/archive-fetch.s b/lld/test/ELF/archive-fetch.s new file mode 100644 index 000000000000..201218f4cc26 --- /dev/null +++ b/lld/test/ELF/archive-fetch.s @@ -0,0 +1,15 @@ +# REQUIRES: x86 + +# We have a code in LLD that prevents fetching the same object from archive file twice. +# This test triggers that code, without it we would fail to link output. + +# RUN: echo '.globl foo, bar; foo:' | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tfoo.o +# RUN: echo '.globl foo, bar; bar:' | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tbar.o +# RUN: rm -f %t.a +# RUN: llvm-ar rcs %t.a %tfoo.o %tbar.o + +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld %t.a %t.o -o /dev/null + +_start: +callq foo -- 2.34.1