1# REQUIRES: x86 2# RUN: rm -fr %t && split-file %s %t 3 4## Build an object with a trivial main function 5# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/main.s -o %t1.o 6 7## Build %t.a which defines a global 'foo' 8# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/archive.s -o %t2.o 9# RUN: rm -f %t2.a 10# RUN: llvm-ar rc %t2.a %t2.o 11 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 15 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 18## link order. 19 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 22 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 25 26# CHECK-FETCH: GLOBAL DEFAULT {{[0-9]+}} foo 27 28#--- main.s 29.text 30.globl _start 31.type _start,@function 32_start: 33 ret 34 35#--- archive.s 36.global foo 37foo: 38 39#--- shlib.s 40.global foo 41