1# REQUIRES: x86 2# RUN: split-file %s %t 3 4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/libweak-defines.s -o %t/libweak-defines.o 5# RUN: %lld -dylib %t/libweak-defines.o -o %t/libweak-defines.dylib 6# RUN: llvm-readobj --file-headers %t/libweak-defines.dylib | FileCheck %s --check-prefix=WEAK-DEFINES-AND-BINDS 7 8# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/binds-to-weak.s -o %t/binds-to-weak.o 9# RUN: %lld -lSystem -L%t -lweak-defines -o %t/binds-to-weak %t/binds-to-weak.o 10# RUN: llvm-readobj --file-headers %t/binds-to-weak | FileCheck %s --check-prefix=WEAK-BINDS-ONLY 11 12# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/overrides-weak.s -o %t/overrides-weak.o 13# RUN: %lld -lSystem -L%t -lweak-defines -o %t/overrides-weak %t/overrides-weak.o 14# RUN: llvm-readobj --file-headers %t/overrides-weak | FileCheck %s --check-prefix=WEAK-DEFINES-ONLY 15 16# WEAK-DEFINES-AND-BINDS: MH_BINDS_TO_WEAK 17# WEAK-DEFINES-AND-BINDS: MH_WEAK_DEFINES 18 19# WEAK-BINDS-ONLY-NOT: MH_WEAK_DEFINES 20# WEAK-BINDS-ONLY: MH_BINDS_TO_WEAK 21# WEAK-BINDS-ONLY-NOT: MH_WEAK_DEFINES 22 23# WEAK-DEFINES-ONLY-NOT: MH_BINDS_TO_WEAK 24# WEAK-DEFINES-ONLY: MH_WEAK_DEFINES 25# WEAK-DEFINES-ONLY-NOT: MH_BINDS_TO_WEAK 26 27#--- libweak-defines.s 28 29.globl _foo 30.weak_definition _foo 31_foo: 32 ret 33 34#--- binds-to-weak.s 35 36.globl _main 37_main: 38 callq _foo 39 ret 40 41## Don't generate MH_WEAK_DEFINES for weak locals 42.weak_definition _weak_local 43_weak_local: 44 45#--- overrides-weak.s 46 47.globl _main, _foo 48_foo: 49 50_main: 51 ret 52