1# REQUIRES: x86
2
3# RUN: split-file %s %t
4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main.o %t/main.s
5
6# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/lib.o \
7# RUN:     %t/mangled-symbol.s
8# RUN: llvm-ar csr  %t/lib.a      %t/lib.o
9# RUN: llvm-ar csrT %t/lib_thin.a %t/lib.o
10
11# RUN: %lld %t/main.o %t/lib.a -o %t/out
12# RUN: llvm-nm %t/out
13# RUN: %lld %t/main.o %t/lib_thin.a -o %t/out
14# RUN: llvm-nm %t/out
15# RUN: %lld %t/main.o -force_load %t/lib_thin.a -o %t/out
16# RUN: llvm-nm %t/out
17
18# RUN: rm %t/lib.o
19# RUN: %lld %t/main.o %t/lib.a -o %t/out
20# RUN: llvm-nm %t/out
21# RUN: not %lld %t/main.o %t/lib_thin.a -demangle -o %t/out 2>&1 | \
22# RUN:     FileCheck --check-prefix=NOOBJ %s
23# RUN: not %lld %t/main.o %t/lib_thin.a -o %t/out 2>&1 | \
24# RUN:     FileCheck --check-prefix=NOOBJNODEMANGLE %s
25
26# CHECK: __Z1fv
27# CHECK: _main
28# NOOBJ: error: {{.*}}lib_thin.a: could not get the buffer for the member defining symbol f(): '{{.*}}lib.o':
29# NOOBJNODEMANGLE: error: {{.*}}lib_thin.a: could not get the buffer for the member defining symbol __Z1fv: '{{.*}}lib.o':
30
31#--- mangled-symbol.s
32.globl  __Z1fv
33__Z1fv:
34  retq
35
36#--- main.s
37.global _main
38_main:
39  callq __Z1fv
40  mov $0, %rax
41  retq
42