
Add entries for_stack_chk_guard, __ssp_canary_word, __security_cookie, and __guard_local. As far as I can tell these are all just different names for the same shaped functionality on different systems. These aren't really functions, but special global variable names. They should probably be treated the same way; all the same contexts that need to know about emittable function names also need to know about this. This avoids a special case check in IRSymtab. This isn't a complete change, there's a lot more cleanup which should be done. The stack protector configuration system is a complete mess. There are multiple overlapping controls, used in 3 different places. Some of the target control implementations overlap with conditions used in the emission points, and some use correlated but not identical conditions in different contexts. i.e. useLoadStackGuardNode, getIRStackGuard, getSSPStackGuardCheck and insertSSPDeclarations are all used in inconsistent ways so I don't know if I've tracked the intention of the system correctly. The PowerPC test change is a bug fix on linux. Previously the manual conditions were based around !isOSOpenBSD, which is not the condition where __stack_chk_guard are used. Now getSDagStackGuard returns the proper global reference, resulting in LOAD_STACK_GUARD getting a MachineMemOperand which allows scheduling.
165 lines
5.4 KiB
LLVM
165 lines
5.4 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: llc -mtriple=powerpc-unknown-openbsd < %s | FileCheck -check-prefix=OPENBSD32 %s
|
|
; RUN: llc -mtriple=powerpc64-unknown-openbsd < %s | FileCheck -check-prefix=OPENBSD64 %s
|
|
; RUN: llc -mtriple=powerpc-unknown-linux < %s | FileCheck -check-prefix=LINUX32 %s
|
|
; RUN: llc -mtriple=powerpc64-unknown-linux < %s | FileCheck -check-prefix=LINUX64 %s
|
|
; RUN: llc -mtriple=powerpc-ibm-aix-xcoff < %s | FileCheck -check-prefix=AIX32 %s
|
|
; RUN: llc -mtriple=powerpc64-ibm-aix-xcoff < %s | FileCheck -check-prefix=AIX64 %s
|
|
|
|
define void @func() sspreq nounwind {
|
|
; OPENBSD32-LABEL: func:
|
|
; OPENBSD32: # %bb.0:
|
|
; OPENBSD32-NEXT: mflr 0
|
|
; OPENBSD32-NEXT: stwu 1, -32(1)
|
|
; OPENBSD32-NEXT: stw 0, 36(1)
|
|
; OPENBSD32-NEXT: stw 30, 24(1) # 4-byte Folded Spill
|
|
; OPENBSD32-NEXT: lis 30, __guard_local@ha
|
|
; OPENBSD32-NEXT: lwz 3, __guard_local@l(30)
|
|
; OPENBSD32-NEXT: stw 3, 20(1)
|
|
; OPENBSD32-NEXT: addi 3, 1, 16
|
|
; OPENBSD32-NEXT: bl capture
|
|
; OPENBSD32-NEXT: lwz 3, __guard_local@l(30)
|
|
; OPENBSD32-NEXT: lwz 4, 20(1)
|
|
; OPENBSD32-NEXT: cmplw 3, 4
|
|
; OPENBSD32-NEXT: bne- 0, .LBB0_2
|
|
; OPENBSD32-NEXT: # %bb.1: # %SP_return
|
|
; OPENBSD32-NEXT: lwz 30, 24(1) # 4-byte Folded Reload
|
|
; OPENBSD32-NEXT: lwz 0, 36(1)
|
|
; OPENBSD32-NEXT: addi 1, 1, 32
|
|
; OPENBSD32-NEXT: mtlr 0
|
|
; OPENBSD32-NEXT: blr
|
|
; OPENBSD32-NEXT: .LBB0_2: # %CallStackCheckFailBlk
|
|
; OPENBSD32-NEXT: lis 3, .LSSH@ha
|
|
; OPENBSD32-NEXT: la 3, .LSSH@l(3)
|
|
; OPENBSD32-NEXT: bl __stack_smash_handler
|
|
;
|
|
; OPENBSD64-LABEL: func:
|
|
; OPENBSD64: # %bb.0:
|
|
; OPENBSD64-NEXT: mflr 0
|
|
; OPENBSD64-NEXT: std 30, -16(1) # 8-byte Folded Spill
|
|
; OPENBSD64-NEXT: stdu 1, -64(1)
|
|
; OPENBSD64-NEXT: std 0, 80(1)
|
|
; OPENBSD64-NEXT: addis 30, 2, __guard_local@toc@ha
|
|
; OPENBSD64-NEXT: ld 3, __guard_local@toc@l(30)
|
|
; OPENBSD64-NEXT: std 3, 40(1)
|
|
; OPENBSD64-NEXT: addi 3, 1, 36
|
|
; OPENBSD64-NEXT: bl capture
|
|
; OPENBSD64-NEXT: nop
|
|
; OPENBSD64-NEXT: ld 3, __guard_local@toc@l(30)
|
|
; OPENBSD64-NEXT: ld 4, 40(1)
|
|
; OPENBSD64-NEXT: cmpld 3, 4
|
|
; OPENBSD64-NEXT: bne- 0, .LBB0_2
|
|
; OPENBSD64-NEXT: # %bb.1: # %SP_return
|
|
; OPENBSD64-NEXT: addi 1, 1, 64
|
|
; OPENBSD64-NEXT: ld 0, 16(1)
|
|
; OPENBSD64-NEXT: mtlr 0
|
|
; OPENBSD64-NEXT: ld 30, -16(1) # 8-byte Folded Reload
|
|
; OPENBSD64-NEXT: blr
|
|
; OPENBSD64-NEXT: .LBB0_2: # %CallStackCheckFailBlk
|
|
; OPENBSD64-NEXT: addis 3, 2, .LSSH@toc@ha
|
|
; OPENBSD64-NEXT: addi 3, 3, .LSSH@toc@l
|
|
; OPENBSD64-NEXT: bl __stack_smash_handler
|
|
; OPENBSD64-NEXT: nop
|
|
;
|
|
; LINUX32-LABEL: func:
|
|
; LINUX32: # %bb.0:
|
|
; LINUX32-NEXT: mflr 0
|
|
; LINUX32-NEXT: stwu 1, -16(1)
|
|
; LINUX32-NEXT: lwz 3, -28680(2)
|
|
; LINUX32-NEXT: stw 0, 20(1)
|
|
; LINUX32-NEXT: stw 3, 12(1)
|
|
; LINUX32-NEXT: addi 3, 1, 8
|
|
; LINUX32-NEXT: bl capture
|
|
; LINUX32-NEXT: lwz 3, 12(1)
|
|
; LINUX32-NEXT: lwz 4, -28680(2)
|
|
; LINUX32-NEXT: cmplw 4, 3
|
|
; LINUX32-NEXT: bne 0, .LBB0_2
|
|
; LINUX32-NEXT: # %bb.1:
|
|
; LINUX32-NEXT: lwz 0, 20(1)
|
|
; LINUX32-NEXT: addi 1, 1, 16
|
|
; LINUX32-NEXT: mtlr 0
|
|
; LINUX32-NEXT: blr
|
|
; LINUX32-NEXT: .LBB0_2:
|
|
; LINUX32-NEXT: bl __stack_chk_fail
|
|
;
|
|
; LINUX64-LABEL: func:
|
|
; LINUX64: # %bb.0:
|
|
; LINUX64-NEXT: mflr 0
|
|
; LINUX64-NEXT: stdu 1, -128(1)
|
|
; LINUX64-NEXT: ld 3, -28688(13)
|
|
; LINUX64-NEXT: std 0, 144(1)
|
|
; LINUX64-NEXT: std 3, 120(1)
|
|
; LINUX64-NEXT: addi 3, 1, 116
|
|
; LINUX64-NEXT: bl capture
|
|
; LINUX64-NEXT: nop
|
|
; LINUX64-NEXT: ld 3, 120(1)
|
|
; LINUX64-NEXT: ld 4, -28688(13)
|
|
; LINUX64-NEXT: cmpld 4, 3
|
|
; LINUX64-NEXT: bne 0, .LBB0_2
|
|
; LINUX64-NEXT: # %bb.1:
|
|
; LINUX64-NEXT: addi 1, 1, 128
|
|
; LINUX64-NEXT: ld 0, 16(1)
|
|
; LINUX64-NEXT: mtlr 0
|
|
; LINUX64-NEXT: blr
|
|
; LINUX64-NEXT: .LBB0_2:
|
|
; LINUX64-NEXT: bl __stack_chk_fail
|
|
; LINUX64-NEXT: nop
|
|
;
|
|
; AIX32-LABEL: func:
|
|
; AIX32: # %bb.0:
|
|
; AIX32-NEXT: mflr 0
|
|
; AIX32-NEXT: stwu 1, -80(1)
|
|
; AIX32-NEXT: stw 0, 88(1)
|
|
; AIX32-NEXT: stw 31, 76(1) # 4-byte Folded Spill
|
|
; AIX32-NEXT: lwz 31, L..C0(2) # @__ssp_canary_word
|
|
; AIX32-NEXT: lwz 3, 0(31)
|
|
; AIX32-NEXT: stw 3, 72(1)
|
|
; AIX32-NEXT: addi 3, 1, 68
|
|
; AIX32-NEXT: bl .capture[PR]
|
|
; AIX32-NEXT: nop
|
|
; AIX32-NEXT: lwz 3, 0(31)
|
|
; AIX32-NEXT: lwz 4, 72(1)
|
|
; AIX32-NEXT: cmplw 3, 4
|
|
; AIX32-NEXT: bne 0, L..BB0_2
|
|
; AIX32-NEXT: # %bb.1:
|
|
; AIX32-NEXT: lwz 31, 76(1) # 4-byte Folded Reload
|
|
; AIX32-NEXT: addi 1, 1, 80
|
|
; AIX32-NEXT: lwz 0, 8(1)
|
|
; AIX32-NEXT: mtlr 0
|
|
; AIX32-NEXT: blr
|
|
; AIX32-NEXT: L..BB0_2:
|
|
; AIX32-NEXT: bl .__stack_chk_fail[PR]
|
|
; AIX32-NEXT: nop
|
|
;
|
|
; AIX64-LABEL: func:
|
|
; AIX64: # %bb.0:
|
|
; AIX64-NEXT: mflr 0
|
|
; AIX64-NEXT: stdu 1, -144(1)
|
|
; AIX64-NEXT: std 0, 160(1)
|
|
; AIX64-NEXT: std 31, 136(1) # 8-byte Folded Spill
|
|
; AIX64-NEXT: ld 31, L..C0(2) # @__ssp_canary_word
|
|
; AIX64-NEXT: ld 3, 0(31)
|
|
; AIX64-NEXT: std 3, 128(1)
|
|
; AIX64-NEXT: addi 3, 1, 124
|
|
; AIX64-NEXT: bl .capture[PR]
|
|
; AIX64-NEXT: nop
|
|
; AIX64-NEXT: ld 3, 0(31)
|
|
; AIX64-NEXT: ld 4, 128(1)
|
|
; AIX64-NEXT: cmpld 3, 4
|
|
; AIX64-NEXT: bne 0, L..BB0_2
|
|
; AIX64-NEXT: # %bb.1:
|
|
; AIX64-NEXT: ld 31, 136(1) # 8-byte Folded Reload
|
|
; AIX64-NEXT: addi 1, 1, 144
|
|
; AIX64-NEXT: ld 0, 16(1)
|
|
; AIX64-NEXT: mtlr 0
|
|
; AIX64-NEXT: blr
|
|
; AIX64-NEXT: L..BB0_2:
|
|
; AIX64-NEXT: bl .__stack_chk_fail[PR]
|
|
; AIX64-NEXT: nop
|
|
%alloca = alloca i32, align 4
|
|
call void @capture(ptr %alloca)
|
|
ret void
|
|
}
|
|
|
|
declare void @capture(ptr)
|