2 # RUN: rm -fr %t && split-file %s %t
4 ## Build an object with a trivial main function
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/main.s -o %t1.o
7 ## Build %t.a which defines a global 'foo'
8 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/archive.s -o %t2.o
10 # RUN: llvm-ar rc %t2.a %t2.o
12 ## Build %t.so that has a reference to 'foo'
13 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/shlib.s -o %t3.o
14 # RUN: ld.lld %t3.o -o %t3.so -shared
16 ## Test that 'foo' from %t2.a is fetched to define 'foo' needed by %t3.so.
17 ## Test both cases where the archive is before or after the shared library in
20 # RUN: ld.lld %t1.o %t2.a %t3.so -o %t.exe
21 # RUN: llvm-readelf --dyn-symbols %t.exe | FileCheck %s --check-prefix=CHECK-FETCH
23 # RUN: ld.lld %t1.o %t3.so %t2.a -o %t.exe
24 # RUN: llvm-readelf --dyn-symbols %t.exe | FileCheck %s --check-prefix=CHECK-FETCH
26 # CHECK-FETCH: GLOBAL DEFAULT {{[0-9]+}} foo
31 .type _start,@function