51 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/libresolution.s -o %t/libresolution.o4# RUN: %lld -dylib -install_name \5# RUN: @executable_path/libresolution.dylib %t/libresolution.o -o %t/libresolution.dylib6# RUN: %lld -dylib -install_name \7# RUN: @executable_path/libresolution2.dylib %t/libresolution.o -o %t/libresolution2.dylib8# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/resolution.s -o %t/resolution.o9 10## Check that we select the symbol defined in the first dylib passed on the11## command line.12# RUN: %lld -o %t/dylib-first -L%t -lresolution -lresolution2 %t/resolution.o13# RUN: llvm-objdump --macho --bind %t/dylib-first | FileCheck %s --check-prefix=DYLIB-FIRST14# DYLIB-FIRST: libresolution _foo15 16# RUN: %lld -o %t/dylib2-first -L%t -lresolution2 -lresolution %t/resolution.o17# RUN: llvm-objdump --macho --bind %t/dylib2-first | FileCheck %s --check-prefix=DYLIB2-FIRST18# DYLIB2-FIRST: libresolution2 _foo19 20## Also check that defined symbols take precedence over dylib symbols.21# DYLIB-FIRST-NOT: libresolution _bar22# DYLIB-FIRST-NOT: libresolution _baz23 24## Check that we pick the dylib symbol over the undefined symbol in the object25## file, even if the object file appears first on the command line.26# RUN: %lld -o %t/obj-first -L%t %t/resolution.o -lresolution27# RUN: llvm-objdump --macho --bind %t/obj-first | FileCheck %s --check-prefix=OBJ-FIRST28# OBJ-FIRST: libresolution _foo29## But defined symbols should still take precedence.30# OBJ-FIRST-NOT: libresolution _bar31# OBJ-FIRST-NOT: libresolution _baz32 33#--- libresolution.s34.globl _foo, _bar, _baz35_foo:36_bar:37_baz:38 39#--- resolution.s40.globl _main, _bar41# Global defined symbol42_bar:43# Local defined symbol44_baz:45 46_main:47 movq _foo@GOTPCREL(%rip), %rsi48 movq _bar@GOTPCREL(%rip), %rsi49 movq _baz@GOTPCREL(%rip), %rsi50 ret51