xref: /llvm-project/lld/test/MachO/thin-archive.s (revision 9065fe55911923c158e0d0e739081996d4ff86f2)
107ab597bSNico Weber# REQUIRES: x86
207ab597bSNico Weber
34b896294SGreg McGary# RUN: rm -rf %t; split-file %s %t
407ab597bSNico Weber# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main.o %t/main.s
507ab597bSNico Weber
607ab597bSNico Weber# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/lib.o \
707ab597bSNico Weber# RUN:     %t/mangled-symbol.s
807ab597bSNico Weber# RUN: llvm-ar csr  %t/lib.a      %t/lib.o
907ab597bSNico Weber# RUN: llvm-ar csrT %t/lib_thin.a %t/lib.o
1007ab597bSNico Weber
1107ab597bSNico Weber# RUN: %lld %t/main.o %t/lib.a -o %t/out
1207ab597bSNico Weber# RUN: llvm-nm %t/out
1307ab597bSNico Weber# RUN: %lld %t/main.o %t/lib_thin.a -o %t/out
1407ab597bSNico Weber# RUN: llvm-nm %t/out
15facdededSNico Weber# RUN: %lld %t/main.o -force_load %t/lib_thin.a -o %t/out
1607ab597bSNico Weber# RUN: llvm-nm %t/out
1707ab597bSNico Weber
1807ab597bSNico Weber# RUN: rm %t/lib.o
1907ab597bSNico Weber# RUN: %lld %t/main.o %t/lib.a -o %t/out
2007ab597bSNico Weber# RUN: llvm-nm %t/out
2107ab597bSNico Weber# RUN: not %lld %t/main.o %t/lib_thin.a -demangle -o %t/out 2>&1 | \
2207ab597bSNico Weber# RUN:     FileCheck --check-prefix=NOOBJ %s
2307ab597bSNico Weber# RUN: not %lld %t/main.o %t/lib_thin.a -o %t/out 2>&1 | \
2407ab597bSNico Weber# RUN:     FileCheck --check-prefix=NOOBJNODEMANGLE %s
2507ab597bSNico Weber
2607ab597bSNico Weber# CHECK: __Z1fv
2707ab597bSNico Weber# CHECK: _main
28*9065fe55SJez Ng# NOOBJ: error: {{.*}}lib_thin.a: could not get the member defining symbol f(): '{{.*}}lib.o': {{[N|n]}}o such file or directory
29*9065fe55SJez Ng# NOOBJNODEMANGLE: error: {{.*}}lib_thin.a: could not get the member defining symbol __Z1fv: '{{.*}}lib.o': {{[N|n]}}o such file or directory
3007ab597bSNico Weber
3107ab597bSNico Weber#--- mangled-symbol.s
3207ab597bSNico Weber.globl  __Z1fv
3307ab597bSNico Weber__Z1fv:
3407ab597bSNico Weber  retq
3507ab597bSNico Weber
3607ab597bSNico Weber#--- main.s
3707ab597bSNico Weber.global _main
3807ab597bSNico Weber_main:
3907ab597bSNico Weber  callq __Z1fv
4007ab597bSNico Weber  mov $0, %rax
4107ab597bSNico Weber  retq
42