Skip to content

Commit b31b594

Browse files
committed
riscv: Add codegen test for TLS stack canary
Make sure the code generated for a TLS-relative stack guard canary references the right location before and after intervening function code. Signed-off-by: Keith Packard <[email protected]>
1 parent 85ed8be commit b31b594

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: llc -mtriple=riscv64-unknown-elf < %s | \
2+
; RUN: FileCheck %s
3+
4+
declare void @baz(ptr)
5+
6+
define void @foo(i64 %t) sspstrong {
7+
%vla = alloca i32, i64 %t, align 4
8+
call void @baz(ptr nonnull %vla)
9+
ret void
10+
}
11+
12+
!llvm.module.flags = !{!0, !1, !2}
13+
!0 = !{i32 2, !"stack-protector-guard", !"tls"}
14+
!1 = !{i32 1, !"stack-protector-guard-reg", !"tp"}
15+
!2 = !{i32 2, !"stack-protector-guard-offset", i32 500}
16+
17+
; CHECK: ld [[REG1:.*]], 500(tp)
18+
; CHECK: call baz
19+
; CHECK: ld [[REG2:.*]], 500(tp)

0 commit comments

Comments
 (0)