brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · b790821 Raw
79 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/libfoo.s -o %t/libfoo.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/nonweakdef.s -o %t/nonweakdef.o5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/weakdef.s -o %t/weakdef.o6# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/common.s -o %t/common.o7# RUN: %lld -dylib %t/libfoo.o -o %t/libfoo.dylib8 9## Check that non-weak defined symbols override weak dylib symbols.10# RUN: %lld %t/nonweakdef.o -L%t -lfoo -o %t/nonweakdef -lSystem11# RUN: llvm-objdump --macho --weak-bind %t/nonweakdef | FileCheck %s12 13## Test loading the dylib before the obj file.14# RUN: %lld -L%t -lfoo %t/nonweakdef.o -o %t/nonweakdef -lSystem15# RUN: llvm-objdump --macho --weak-bind %t/nonweakdef | FileCheck %s16 17# CHECK:       Weak bind table:18# CHECK-NEXT:  segment  section            address     type       addend   symbol19# CHECK-NEXT:                                          strong              _weak_in_dylib20# CHECK-EMPTY:21 22## Check that weak defined symbols do not override weak dylib symbols.23# RUN: %lld %t/weakdef.o -L%t -lfoo -o %t/weakdef -lSystem24# RUN: llvm-objdump --macho --weak-bind %t/weakdef | FileCheck %s --check-prefix=NO-WEAK-OVERRIDE25 26## Test loading the dylib before the obj file.27# RUN: %lld -L%t -lfoo %t/weakdef.o -o %t/weakdef -lSystem28# RUN: llvm-objdump --macho --weak-bind %t/weakdef | FileCheck %s --check-prefix=NO-WEAK-OVERRIDE29 30# NO-WEAK-OVERRIDE:       Weak bind table:31# NO-WEAK-OVERRIDE-NEXT:  segment section address type addend symbol32# NO-WEAK-OVERRIDE-EMPTY:33 34## Check that common symbols take precedence over weak dylib symbols, but do not35## generate an overriding weak binding.36# RUN: %lld -L%t -lfoo %t/common.o -o %t/common -lSystem37# RUN: llvm-objdump --macho --weak-bind %t/common | FileCheck %s --check-prefix=NO-WEAK-OVERRIDE38# RUN: llvm-objdump --syms %t/common | FileCheck %s --check-prefix=COMMON39# COMMON-DAG: g     O __DATA,__common _nonweak_in_dylib40# COMMON-DAG: g     O __DATA,__common _weak_in_dylib41 42#--- libfoo.s43 44.globl _weak_in_dylib, _nonweak_in_dylib45.weak_definition _weak_in_dylib46 47_weak_in_dylib:48_nonweak_in_dylib:49 50#--- nonweakdef.s51 52.globl _main, _weak_in_dylib, _nonweak_in_dylib53 54_weak_in_dylib:55_nonweak_in_dylib:56 57_main:58  ret59 60#--- weakdef.s61 62.globl _main, _weak_in_dylib, _nonweak_in_dylib63.weak_definition _weak_in_dylib, _nonweak_in_dylib64 65_weak_in_dylib:66_nonweak_in_dylib:67 68_main:69  ret70 71#--- common.s72 73.globl _main74.comm _weak_in_dylib, 175.comm _nonweak_in_dylib, 176 77_main:78  ret79