47 lines · plain
1; REQUIRES: x862; RUN: rm -rf %t; split-file %s %t3 4;; Test that a weak symbol in a direct .o file wins over5;; a weak symbol in a .a file.6;; Like weak-definition-in-main-file.s, but in bitcode.7 8; RUN: llvm-as %t/test.ll -o %t/test.o9; RUN: llvm-as %t/weakfoo.ll -o %t/weakfoo.o10 11; RUN: llvm-ar --format=darwin rcs %t/weakfoo.a %t/weakfoo.o12 13; PREFER-DIRECT-OBJECT-NOT: O __TEXT,weak _foo14 15; RUN: %lld -lSystem -o %t/out %t/weakfoo.a %t/test.o16; RUN: llvm-objdump --syms %t/out | FileCheck %s --check-prefix=PREFER-DIRECT-OBJECT17 18;--- weakfoo.ll19target triple = "x86_64-apple-macosx10.15.0"20target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"21 22define void @baz() noinline optnone {23 ret void24}25 26define weak void @foo() noinline optnone section "__TEXT,weak" {27 ret void28}29 30;--- test.ll31target triple = "x86_64-apple-macosx10.15.0"32target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"33 34declare void @baz();35 36define weak void @foo() noinline optnone {37 ret void38}39 40define void @main() {41 ; This pulls in weakfoo.a due to the __baz undef, but __foo should42 ; still be resolved against the weak symbol in this file.43 call void @baz()44 call void @foo()45 ret void46}47