• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test codegen pipeline for SafeStack + StackProtector combination.
2; RUN: llc -mtriple=i386-linux < %s -o - | FileCheck --check-prefix=LINUX-I386 %s
3; RUN: llc -mtriple=x86_64-linux < %s -o - | FileCheck --check-prefix=LINUX-X64 %s
4; RUN: llc -mtriple=x86_64-fuchsia < %s -o - | FileCheck --check-prefix=FUCHSIA-X64 %s
5
6define void @_Z1fv() safestack sspreq {
7entry:
8  %x = alloca i32, align 4
9  %0 = bitcast i32* %x to i8*
10  call void @_Z7CapturePi(i32* nonnull %x)
11  ret void
12}
13
14declare void @_Z7CapturePi(i32*)
15
16; LINUX-X64-DAG: movq __safestack_unsafe_stack_ptr@GOTTPOFF(%rip), %[[A:.*]]
17; LINUX-X64-DAG: movq %fs:(%[[A]]), %[[B:.*]]
18; LINUX-X64-DAG: movq %fs:40, %[[COOKIE:.*]]
19; LINUX-X64-DAG: leaq -16(%[[B]]), %[[C:.*]]
20; LINUX-X64-DAG: movq %[[C]], %fs:(%[[A]])
21; LINUX-X64-DAG: movq %[[COOKIE]], -8(%[[B]])
22
23; LINUX-I386-DAG: movl __safestack_unsafe_stack_ptr@INDNTPOFF, %[[A:.*]]
24; LINUX-I386-DAG: movl %gs:(%[[A]]), %[[B:.*]]
25; LINUX-I386-DAG: movl %gs:20, %[[COOKIE:.*]]
26; LINUX-I386-DAG: leal -16(%[[B]]), %[[C:.*]]
27; LINUX-I386-DAG: movl %[[C]], %gs:(%[[A]])
28; LINUX-I386-DAG: movl %[[COOKIE]], -4(%[[B]])
29
30; FUCHSIA-X64-DAG: movq %fs:24, %[[B:.*]]
31; FUCHSIA-X64-DAG: movq %fs:16, %[[COOKIE:.*]]
32; FUCHSIA-X64-DAG: leaq -16(%[[B]]), %[[C:.*]]
33; FUCHSIA-X64-DAG: movq %[[C]], %fs:24
34; FUCHSIA-X64-DAG: movq %[[COOKIE]], -8(%[[B]])
35