3 ;; Test linking of weak symbols with LTO. The weak symbol may be defined
4 ;; by another object file, or may be left undefined. When compiling the
5 ;; IR with an undefined weak symbol, the emitted object file will contain
6 ;; a weak alias pointing at an absolute symbol for the address null.
7 ;; Make sure both cases can be linked correctly.
9 ; RUN: split-file %s %t.dir
10 ; RUN: llvm-as %t.dir/main.ll -o %t.main.obj
11 ; RUN: llvm-as %t.dir/optional.ll -o %t.optional.obj
13 ; RUN: lld-link /entry:main %t.main.obj /out:%t-undef.exe
14 ; RUN: lld-link /entry:main %t.main.obj %t.optional.obj /out:%t-def.exe
17 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
18 target triple = "x86_64-pc-windows-msvc"
20 define dso_local i32 @main() {
22 %cmp = icmp ne ptr @optionalFunc, null
23 br i1 %cmp, label %if.then, label %if.end
26 tail call void @optionalFunc()
33 declare extern_weak void @optionalFunc()
36 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
37 target triple = "x86_64-pc-windows-msvc"
39 define void @optionalFunc() {