1# REQUIRES: x86 2# RUN: rm -rf %t; split-file %s %t 3 4## Test that a weak symbol in a direct .o file wins over 5## a weak symbol in a .a file. 6 7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o 8# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/weakfoo.s -o %t/weakfoo.o 9 10# RUN: llvm-ar --format=darwin rcs %t/weakfoo.a %t/weakfoo.o 11 12# PREFER-DIRECT-OBJECT-NOT: O __TEXT,weak __foo 13 14# RUN: %lld -lSystem -o %t/out %t/weakfoo.a %t/test.o 15# RUN: llvm-objdump --syms %t/out | FileCheck %s --check-prefix=PREFER-DIRECT-OBJECT 16 17#--- weakfoo.s 18.globl __baz 19__baz: 20 ret 21 22.section __TEXT,weak 23.weak_definition __foo 24.globl __foo 25__foo: 26 ret 27 28.subsections_via_symbols 29 30#--- test.s 31.globl __foo 32.weak_definition __foo 33__foo: 34 ret 35 36.globl _main 37_main: 38 # This pulls in weakfoo.a due to the __baz undef, but __foo should 39 # still be resolved against the weak symbol in this file. 40 callq __baz 41 callq __foo 42 ret 43 44.subsections_via_symbols 45