File: ps4-ssp-nop.ll

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (41 lines) | stat: -rw-r--r-- 1,642 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
; Verify that a ud2 is generated after the call to __stack_chk_fail.

; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=false -O0 -o - | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-sie-ps5  -enable-selectiondag-sp=false -O0 -o - | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=false -O2 -o - | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-sie-ps5  -enable-selectiondag-sp=false -O2 -o - | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=true  -O0 -o - | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-sie-ps5  -enable-selectiondag-sp=true  -O0 -o - | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=true  -O2 -o - | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-sie-ps5  -enable-selectiondag-sp=true  -O2 -o - | FileCheck %s


; CHECK: check_input:
; CHECK: callq __stack_chk_fail
; CHECK-NEXT: ud2
; CHECK: .size	check_input
; CHECK-NEXT: .cfi_endproc

@.str = private unnamed_addr constant [37 x i8] c"????????????????????????????????????\00", align 1

define signext i8 @check_input(ptr %input) nounwind uwtable ssp {
entry:
  %input.addr = alloca ptr, align 8
  %buf = alloca [16 x i8], align 16
  store ptr %input, ptr %input.addr, align 8
  %0 = load ptr, ptr %input.addr, align 8
  %call = call ptr @strcpy(ptr %buf, ptr %0) nounwind
  %1 = load i8, ptr %buf, align 1
  ret i8 %1
}

declare ptr @strcpy(ptr, ptr) nounwind

define i32 @main() nounwind uwtable ssp {
entry:
  %retval = alloca i32, align 4
  store i32 0, ptr %retval
  %call = call signext i8 @check_input(ptr @.str)
  %conv = sext i8 %call to i32
  ret i32 %conv
}