brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · da32703 Raw
40 lines · plain
1; Check that files passed with the -lazy option aren't linked unless they're2; needed. The foo-ret-42.ll file, which contains only code, should not be3; needed in this -noexec case, whereas x.o, which contains a global variable4; referenced by main, should be linked (despite being passed with -lazy).5;6; RUN: rm -rf %t && mkdir -p %t7; RUN: %clang -c -o %t/foo.o %S/Inputs/foo-ret-42.ll8; RUN: %clang -c -o %t/x.o %S/Inputs/var-x-42.ll9; RUN: %clang -c -o %t/bar.o %S/Inputs/bar-ret-void-weak.ll10; RUN: %clang -c -o %t/baz.o %S/Inputs/baz-ret-void-hidden.ll11; RUN: %clang -c -o %t/main.o %s12; RUN: %llvm_jitlink -num-threads=0 -noexec -show-linked-files %t/main.o \13; RUN:               -lazy %t/foo.o -lazy %t/x.o -lazy %t/bar.o -lazy %t/baz.o \14; RUN:     | FileCheck %s15;16; UNSUPPORTED: system-windows17; REQUIRES: target={{(arm|aarch|x86_)64.*}}18;19; CHECK: Linking {{.*}}main.o20; CHECK-DAG: Linking <indirect stubs graph #1>21; CHECK-DAG: Linking {{.*}}x.o22; CHECK-NOT: Linking {{.*}}foo.o23 24declare i32 @foo()25@x = external global i3226 27declare void @bar()28declare hidden void @baz()29 30 31define i32 @main(i32 %argc, ptr %argv) {32entry:33  %foo_result = call i32 @foo()34  call void @bar()35  call void @baz()36  %x_val = load i32, ptr @x37  %result = add nsw i32 %foo_result, %x_val38  ret i32 %result39}40