mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-16 10:26:23 +00:00

Add two new ways of accessing the unsafe stack pointer: * At a fixed offset from the thread TLS base. This is very similar to StackProtector cookies, but we plan to extend it to other backends (ARM in particular) soon. Bionic-side implementation here: https://android-review.googlesource.com/170988. * Via a function call, as a fallback for platforms that provide neither a fixed TLS slot, nor a reasonable TLS implementation (i.e. not emutls). This is a re-commit of a change in r248357 that was reverted in r248358. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248405 91177308-0d34-0410-b5e6-96231b3b80d8
19 lines
495 B
LLVM
19 lines
495 B
LLVM
; RUN: opt -safe-stack -S -mtriple=arm-linux-android < %s -o - | FileCheck %s
|
|
|
|
|
|
define void @foo() nounwind uwtable safestack {
|
|
entry:
|
|
; CHECK: %[[SPA:.*]] = call i8** @__safestack_pointer_address()
|
|
; CHECK: %[[USP:.*]] = load i8*, i8** %[[SPA]]
|
|
; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
|
|
; CHECK: store i8* %[[USST]], i8** %[[SPA]]
|
|
|
|
%a = alloca i8, align 8
|
|
call void @Capture(i8* %a)
|
|
|
|
; CHECK: store i8* %[[USP]], i8** %[[SPA]]
|
|
ret void
|
|
}
|
|
|
|
declare void @Capture(i8*)
|