75 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/g.s -o %t/g.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/f1.s -o %t/f1.o5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/f2.s -o %t/f2.o6# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/fg.s -o %t/fg.o7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o8# RUN: %lld -dylib -o %t/libf1.dylib %t/f1.o -lSystem9 10# RUN: llvm-ar rcs %t/libf2_g.a %t/f2.o %t/g.o11# RUN: llvm-ar rcs %t/libfg.a %t/fg.o12 13## (Strong) dylib symbols and archive symbols have equal precedence.14 15# RUN: %lld %t/libf1.dylib %t/libf2_g.a %t/test.o -o %t/test.out -lSystem16# RUN: llvm-objdump --syms --macho --lazy-bind %t/test.out | FileCheck %s --check-prefix DYLIB-FIRST17# DYLIB-FIRST: SYMBOL TABLE:18# DYLIB-FIRST-DAG: __TEXT,test_g g19# DYLIB-FIRST: Lazy bind table:20# DYLIB-FIRST-NEXT: segment section address dylib symbol21# DYLIB-FIRST-NEXT: __DATA __la_symbol_ptr {{[0-9a-z]+}} libf1 f22 23# RUN: %lld %t/libf2_g.a %t/libf1.dylib %t/test.o -o %t/test.out -lSystem24# RUN: llvm-objdump --syms --macho --lazy-bind %t/test.out | FileCheck %s --check-prefix ARCHIVE-FIRST25# ARCHIVE-FIRST: SYMBOL TABLE:26# ARCHIVE-FIRST-DAG: __TEXT,test_f2 f27# ARCHIVE-FIRST-DAG: __TEXT,test_g g28# ARCHIVE-FIRST: Lazy bind table:29# ARCHIVE-FIRST-NEXT: segment section address dylib symbol30# ARCHIVE-FIRST-EMPTY:31 32## Once an archive member is fetched, all the extern symbols in that member33## take precedence over dylib symbols of the same name.34# RUN: %lld %t/libf1.dylib %t/libfg.a %t/test.o -o %t/test.out -lSystem35# RUN: llvm-objdump --syms --macho --lazy-bind %t/test.out | FileCheck %s --check-prefix ARCHIVE-PRIORITY36# ARCHIVE-PRIORITY: SYMBOL TABLE:37# ARCHIVE-PRIORITY-DAG: __TEXT,test_fg f38# ARCHIVE-PRIORITY-DAG: __TEXT,test_fg g39# ARCHIVE-PRIORITY: Lazy bind table:40# ARCHIVE-PRIORITY-NEXT: segment section address dylib symbol41# ARCHIVE-PRIORITY-EMPTY:42 43#--- g.s44.global f, g45.section __TEXT,test_g46g:47 callq f48 49#--- f1.s50.global f51.section __TEXT,test_f152f:53 ret54 55#--- f2.s56.global f57.section __TEXT,test_f258f:59 ret60 61#--- fg.s62.global f, g63.section __TEXT,test_fg64f:65 ret66g:67 callq f68 69#--- test.s70.global g71.global _main72_main:73 callq g74 ret75