3 ; RUN: rm -rf %t; split-file %s %t
5 ; RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/dylib.s -o %t/dylib.o
6 ; RUN: %lld -dylib -lSystem %t/dylib.o -o %t/dylib.dylib
8 ;; As baseline, compile the .ll file to a real .o file and check behavior.
9 ; RUN: llc -filetype=obj %t/weak-ref.ll -o %t/obj.o
10 ; RUN: %lld -dylib -lSystem %t/obj.o %t/dylib.dylib -o %t/test.obj
11 ; RUN: llvm-objdump --macho --syms %t/test.obj | FileCheck %s --check-prefixes=WEAK-REF
13 ;; Check that we get the same behavior compiling the .ll file to a bitcode .o
14 ;; file and linking that.
15 ; RUN: opt -module-summary %t/weak-ref.ll -o %t/bitcode.o
16 ; RUN: %lld -dylib -lSystem %t/bitcode.o %t/dylib.dylib -o %t/test.lto
17 ; RUN: llvm-objdump --macho --syms %t/test.lto | FileCheck %s --check-prefixes=WEAK-REF
19 ; WEAK-REF: SYMBOL TABLE:
20 ; WEAK-REF: w *UND* _my_weak_extern_function
24 .globl _my_weak_extern_function
25 _my_weak_extern_function:
29 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
30 target triple = "x86_64-apple-macosx10.15.0"
32 declare extern_weak void @my_weak_extern_function()
34 ; Function Attrs: noinline nounwind optnone ssp uwtable
35 define i32 @bar(i1 zeroext %0) {
37 br i1 %0, label %if.then, label %if.end
39 if.then: ; preds = %entry
40 call void @my_weak_extern_function()
43 if.end: ; preds = %if.then, %entry