2 ; RUN: rm -rf %t; split-file %s %t
4 ;; Test that a weak symbol in a direct .o file wins over
5 ;; a weak symbol in a .a file.
6 ;; Like weak-definition-in-main-file.s, but in bitcode.
8 ; RUN: llvm-as %t/test.ll -o %t/test.o
9 ; RUN: llvm-as %t/weakfoo.ll -o %t/weakfoo.o
11 ; RUN: llvm-ar --format=darwin rcs %t/weakfoo.a %t/weakfoo.o
13 ; PREFER-DIRECT-OBJECT-NOT: O __TEXT,weak _foo
15 ; RUN: %lld -lSystem -o %t/out %t/weakfoo.a %t/test.o
16 ; RUN: llvm-objdump --syms %t/out | FileCheck %s --check-prefix=PREFER-DIRECT-OBJECT
19 target triple = "x86_64-apple-macosx10.15.0"
20 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
22 define void @baz() noinline optnone {
26 define weak void @foo() noinline optnone section "__TEXT,weak" {
31 target triple = "x86_64-apple-macosx10.15.0"
32 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
36 define weak void @foo() noinline optnone {
41 ; This pulls in weakfoo.a due to the __baz undef, but __foo should
42 ; still be resolved against the weak symbol in this file.