Skip to content

Commit bec85f3

Browse files
authored
[LLD] [COFF] [test] Readd lto-late-arm.ll (#143494)
This testcase was removed in 4cafd28, as a082f66 had made it no longer trigger the error that it was supposed to do. (Because the latter of those two commits makes the symbol "__rt_sdiv" be included among the potential libcalls listed by lto::LTO::getRuntimeLibcallSymbols().) Readd the test as a positive test, making sure that such libcalls can get linked. We do have preexisting test coverage for LTO libcalls overall in libcall-archive.ll, but readd this test to cover specifically the ARM division helper functions as well.
1 parent 2efff47 commit bec85f3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

lld/test/COFF/lto-late-arm.ll

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
; REQUIRES: arm
2+
3+
;; A bitcode file can generate undefined references to symbols that weren't
4+
;; listed as undefined on the bitcode file itself, when lowering produces
5+
;; calls to e.g. builtin helper functions. Ideally all those functions are
6+
;; listed by lto::LTO::getRuntimeLibcallSymbols(), then we successfully
7+
;; can link cases when the helper functions are provided as bitcode too.
8+
;; (In practice, compiler-rt builtins are always compiled with -fno-lto, so
9+
;; this shouldn't really happen anyway.)
10+
11+
; RUN: rm -rf %t.dir
12+
; RUN: split-file %s %t.dir
13+
; RUN: llvm-as %t.dir/main.ll -o %t.main.obj
14+
; RUN: llvm-as %t.dir/sdiv.ll -o %t.sdiv.obj
15+
; RUN: llvm-ar rcs %t.sdiv.lib %t.sdiv.obj
16+
17+
; RUN: lld-link /entry:entry %t.main.obj %t.sdiv.lib /out:%t.exe /subsystem:console
18+
19+
;--- main.ll
20+
target datalayout = "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
21+
target triple = "thumbv7-w64-windows-gnu"
22+
23+
@num = dso_local global i32 100
24+
25+
define dso_local arm_aapcs_vfpcc i32 @entry(i32 %param) {
26+
entry:
27+
%0 = load i32, ptr @num
28+
%div = sdiv i32 %0, %param
29+
ret i32 %div
30+
}
31+
;--- sdiv.ll
32+
target datalayout = "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
33+
target triple = "thumbv7-w64-windows-gnu"
34+
35+
define dso_local arm_aapcs_vfpcc void @__rt_sdiv() {
36+
entry:
37+
ret void
38+
}

0 commit comments

Comments
 (0)