95 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/weak-ref-only.s -o %t/weak-ref-only.o5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/weak-ref-sub-library.s -o %t/weak-ref-sub-library.o6# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/mixed-ref.s -o %t/mixed-ref.o7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o8# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/bar.s -o %t/bar.o9# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/weak-reexport.s -o %t/weak-reexport.o10 11# RUN: %lld -lSystem -dylib %t/bar.o -o %t/libbar.dylib12# RUN: %lld -lSystem -dylib %t/foo.o %t/libbar.dylib -sub_library libbar -o %t/libfoo.dylib13 14# RUN: %lld -weak-lSystem %t/test.o -weak_framework CoreFoundation -weak_library %t/libfoo.dylib -o %t/basic15# RUN: llvm-objdump --macho --all-headers %t/basic | FileCheck %s -DDIR=%t --check-prefixes=WEAK-SYS,WEAK-FOO16# RUN: %lld -weak-lSystem %t/test.o \17# RUN: -framework CoreFoundation -weak_framework CoreFoundation -framework CoreFoundation \18# RUN: %t/libfoo.dylib -weak_library %t/libfoo.dylib %t/libfoo.dylib -o %t/basic-weak-strong19# RUN: llvm-objdump --macho --all-headers %t/basic-weak-strong | FileCheck %s -DDIR=%t --check-prefixes=WEAK-SYS,WEAK-FOO20# RUN: %lld -lSystem -dylib %t/libfoo.dylib %t/weak-ref-only.o -o %t/weak-ref-only21# RUN: llvm-objdump --macho --all-headers %t/weak-ref-only | FileCheck %s -DDIR=%t --check-prefixes=SYS,WEAK-FOO22# RUN: %lld -lSystem -dylib %t/libfoo.dylib %t/weak-ref-sub-library.o -o %t/weak-ref-sub-library23# RUN: llvm-objdump --macho --all-headers %t/weak-ref-sub-library | FileCheck %s -DDIR=%t --check-prefixes=SYS,WEAK-FOO24# RUN: %lld -lSystem -dylib %t/libfoo.dylib %t/mixed-ref.o -o %t/mixed-ref25# RUN: llvm-objdump --macho --all-headers %t/mixed-ref | FileCheck %s -DDIR=%t --check-prefixes=SYS,FOO26 27# RUN: %lld -framework CoreFoundation %t/test.o -weak_framework CoreFoundation -o %t/strong-weak-import.out28# RUN: llvm-objdump --macho --bind %t/strong-weak-import.out | FileCheck %s --check-prefix=WEAK-IMP29# RUN: llvm-objdump --macho --bind %t/basic-weak-strong | FileCheck %s --check-prefix=WEAK-IMP30 31## This references the gxx_personality_v0 symbol, which is defined in libc++abi, which is then32## reexported by libc++.33## Check that reexported symbols from weak libraries are also weakly-referenced.34# RUN: %lld -weak-lc++ %t/weak-reexport.o -o %t/weak-reexport.out35# RUN: llvm-objdump --macho --bind %t/weak-reexport.out | FileCheck %s --check-prefix=WEAK-REEXPORT36 37# WEAK-SYS: cmd LC_LOAD_WEAK_DYLIB38# WEAK-SYS-NEXT: cmdsize39# WEAK-SYS-NEXT: name /usr/lib/libSystem.dylib40 41# WEAK-SYS: cmd LC_LOAD_WEAK_DYLIB42# WEAK-SYS-NEXT: cmdsize43# WEAK-SYS-NEXT: name /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation44 45# SYS: cmd LC_LOAD_DYLIB46# SYS-NEXT: cmdsize47# SYS-NEXT: name /usr/lib/libSystem.dylib48 49# WEAK-FOO: cmd LC_LOAD_WEAK_DYLIB50# WEAK-FOO-NEXT: cmdsize51# WEAK-FOO-NEXT: name [[DIR]]/libfoo.dylib52 53# FOO: cmd LC_LOAD_DYLIB54# FOO-NEXT: cmdsize55# FOO-NEXT: name [[DIR]]/libfoo.dylib56 57# WEAK-IMP: {{.+}} pointer 0 CoreFoundation __CFBigNumGetInt128 (weak_import)58# WEAK-REEXPORT: {{.+}} pointer 0 libc++abi ___gxx_personality_v0 (weak_import)59#--- foo.s60.globl _foo61_foo:62 63#--- bar.s64.globl _bar65_bar:66 67#--- weak-ref-only.s68.weak_reference _foo69.data70.quad _foo71 72#--- weak-ref-sub-library.s73.weak_reference _bar74.data75.quad _bar76 77#--- mixed-ref.s78.weak_definition _foo79.data80.quad _foo81.quad _bar82 83#--- test.s84.globl _main85_main:86 movq __CFBigNumGetInt128@GOTPCREL(%rip), %rax87 ret88 89#--- weak-reexport.s90.globl _main91_main:92 93.data94.quad ___gxx_personality_v095