xref: /llvm-project/llvm/test/CodeGen/X86/stack-protector-recursively.ll (revision fc4494dffa5422b2be5442c235554e76bed79c8a)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %s | FileCheck %s
3
4; Make sure the stack protect not infinitly check __stack_chk_fail.
5define dso_local void @__stack_chk_fail() local_unnamed_addr #0 {
6; CHECK-LABEL: __stack_chk_fail:
7; CHECK:       # %bb.0: # %entry
8; CHECK-NEXT:    pushq %rax
9; CHECK-NEXT:    movq %fs:40, %rax
10; CHECK-NEXT:    movq %rax, (%rsp)
11; CHECK-NEXT:    movq %fs:40, %rax
12; CHECK-NEXT:    cmpq (%rsp), %rax
13; CHECK-NEXT:    jne .LBB0_2
14; CHECK-NEXT:  # %bb.1: # %SP_return
15; CHECK-NEXT:    callq foo@PLT
16; CHECK-NEXT:  .LBB0_2: # %CallStackCheckFailBlk
17; CHECK-NEXT:    callq __stack_chk_fail
18entry:
19  tail call void @foo() noreturn
20  unreachable
21}
22
23declare void @foo() noreturn
24
25attributes #0 = { noreturn nounwind sspreq }
26