File: ps4-ssp-nop.ll

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (39 lines) | stat: -rw-r--r-- 1,496 bytes parent folder | download | duplicates (10)
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
; 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-scei-ps4 -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-scei-ps4 -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(i8* %input) nounwind uwtable ssp {
entry:
  %input.addr = alloca i8*, align 8
  %buf = alloca [16 x i8], align 16
  store i8* %input, i8** %input.addr, align 8
  %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0
  %0 = load i8*, i8** %input.addr, align 8
  %call = call i8* @strcpy(i8* %arraydecay, i8* %0) nounwind
  %arrayidx = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i64 0
  %1 = load i8, i8* %arrayidx, align 1
  ret i8 %1
}

declare i8* @strcpy(i8*, i8*) nounwind

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