xref: /llvm-project/llvm/test/CodeGen/X86/stack-protector-target.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; Test target-specific stack cookie location.
2; RUN: llc -mtriple=i386-linux < %s -o - | FileCheck --check-prefix=I386-TLS %s
3; RUN: llc -mtriple=x86_64-linux < %s -o - | FileCheck --check-prefix=X64-TLS %s
4
5; RUN: llc -mtriple=i386-linux-android < %s -o - | FileCheck --check-prefix=I386 %s
6; RUN: llc -mtriple=i386-linux-android16 < %s -o - | FileCheck --check-prefix=I386 %s
7; RUN: llc -mtriple=i386-linux-android17 < %s -o - | FileCheck --check-prefix=I386-TLS %s
8; RUN: llc -mtriple=i386-linux-android24 < %s -o - | FileCheck --check-prefix=I386-TLS %s
9; RUN: llc -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefix=X64-TLS %s
10; RUN: llc -mtriple=x86_64-linux-android17 < %s -o - | FileCheck --check-prefix=X64-TLS %s
11; RUN: llc -mtriple=x86_64-linux-android24 < %s -o - | FileCheck --check-prefix=X64-TLS %s
12
13; RUN: llc -mtriple=i386-kfreebsd < %s -o - | FileCheck --check-prefix=I386-TLS %s
14; RUN: llc -mtriple=x86_64-kfreebsd < %s -o - | FileCheck --check-prefix=X64-TLS %s
15
16define void @_Z1fv() sspreq {
17entry:
18  %x = alloca i32, align 4
19  call void @_Z7CapturePi(ptr nonnull %x)
20  ret void
21}
22
23declare void @_Z7CapturePi(ptr)
24
25; X64-TLS: movq %fs:40, %[[B:.*]]
26; X64-TLS: movq %[[B]], 16(%rsp)
27; X64-TLS: movq %fs:40, %[[C:.*]]
28; X64-TLS: cmpq 16(%rsp), %[[C]]
29
30; I386: movl __stack_chk_guard, %[[B:.*]]
31; I386: movl %[[B]], 8(%esp)
32; I386: movl __stack_chk_guard, %[[C:.*]]
33; I386: cmpl 8(%esp), %[[C]]
34
35; I386-TLS: movl %gs:20, %[[B:.*]]
36; I386-TLS: movl %[[B]], 8(%esp)
37; I386-TLS: movl %gs:20, %[[C:.*]]
38; I386-TLS: cmpl 8(%esp), %[[C]]
39