67 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/2.s -o %t/2.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/3.s -o %t/3.o5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/4.s -o %t/4.o6# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/main.s -o %t/main.o7 8# RUN: llvm-ar rcs %t/test.a %t/2.o %t/3.o %t/4.o9# RUN: %lld %t/main.o %t/test.a -o %t/test.out10 11## TODO: Run llvm-nm -p to validate symbol order12# RUN: llvm-nm %t/test.out | FileCheck %s13# CHECK: T _bar14# CHECK: T _boo15# CHECK: T _main16 17## Linking with the archive first in the command line shouldn't change anything18# RUN: %lld %t/test.a %t/main.o -o %t/test.out19# RUN: llvm-nm %t/test.out | FileCheck %s --check-prefix ARCHIVE-FIRST20# ARCHIVE-FIRST: T _bar21# ARCHIVE-FIRST: T _boo22# ARCHIVE-FIRST: T _main23 24# RUN: llvm-nm %t/test.out | FileCheck %s --check-prefix VISIBLE25# VISIBLE-NOT: T _undefined26# VISIBLE-NOT: T _unused27 28# RUN: %lld %t/test.a %t/main.o -o %t/all-load -noall_load -all_load29# RUN: llvm-nm %t/all-load | FileCheck %s --check-prefix ALL-LOAD30# ALL-LOAD: T _bar31# ALL-LOAD: T _boo32# ALL-LOAD: T _main33# ALL-LOAD: T _unused34 35# RUN: %lld %t/test.a %t/main.o -o %t/no-all-load -all_load -noall_load36# RUN: llvm-nm %t/no-all-load | FileCheck %s --check-prefix NO-ALL-LOAD37# RUN: %lld %t/test.a %t/main.o -o %t/no-all-load-only -noall_load38# RUN: llvm-nm %t/no-all-load-only | FileCheck %s --check-prefix NO-ALL-LOAD39# NO-ALL-LOAD-NOT: T _unused40 41## Multiple archives defining the same symbols aren't an issue, due to lazy42## loading43# RUN: cp %t/test.a %t/test2.a44# RUN: %lld %t/test.a %t/test2.a %t/main.o -o /dev/null45 46#--- 2.s47.globl _boo48_boo:49 ret50 51#--- 3.s52.globl _bar53_bar:54 ret55 56#--- 4.s57.globl _undefined, _unused58_unused:59 ret60 61#--- main.s62.globl _main63_main:64 callq _boo65 callq _bar66 ret67