46 lines · plain
1; REQUIRES: x862 3; RUN: rm -rf %t; split-file %s %t4 5; RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/dylib.s -o %t/dylib.o6; RUN: %lld -dylib -lSystem %t/dylib.o -o %t/dylib.dylib7 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.o10; RUN: %lld -dylib -lSystem %t/obj.o %t/dylib.dylib -o %t/test.obj11; RUN: llvm-objdump --macho --syms %t/test.obj | FileCheck %s --check-prefixes=WEAK-REF12 13;; Check that we get the same behavior compiling the .ll file to a bitcode .o14;; file and linking that.15; RUN: opt -module-summary %t/weak-ref.ll -o %t/bitcode.o16; RUN: %lld -dylib -lSystem %t/bitcode.o %t/dylib.dylib -o %t/test.lto17; RUN: llvm-objdump --macho --syms %t/test.lto | FileCheck %s --check-prefixes=WEAK-REF18 19; WEAK-REF: SYMBOL TABLE:20; WEAK-REF: w *UND* _my_weak_extern_function21 22;--- dylib.s23 24.globl _my_weak_extern_function25_my_weak_extern_function:26 ret27 28;--- weak-ref.ll29target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"30target triple = "x86_64-apple-macosx10.15.0"31 32declare extern_weak void @my_weak_extern_function()33 34; Function Attrs: noinline nounwind optnone ssp uwtable35define i32 @bar(i1 zeroext %0) {36entry:37 br i1 %0, label %if.then, label %if.end38 39if.then: ; preds = %entry40 call void @my_weak_extern_function()41 br label %if.end42 43if.end: ; preds = %if.then, %entry44 ret i32 045}46