mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-24 21:42:54 +02:00
6d86bc6f79
Android libc provides a fixed TLS slot for the unsafe stack pointer, and this change implements direct access to that slot on AArch64 via __builtin_thread_pointer() + offset. This change also moves more code into TargetLowering and its target-specific subclasses to get rid of target-specific codegen in SafeStackPass. This change does not touch the ARM backend because ARM lowers builting_thread_pointer as aeabi_read_tp, which is not available on Android. The previous iteration of this change was reverted in r250461. This version leaves the generic, compiler-rt based implementation in SafeStack.cpp instead of moving it to TargetLoweringBase in order to allow testing without a TargetMachine. llvm-svn: 251324
21 lines
612 B
LLVM
21 lines
612 B
LLVM
; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
|
|
|
|
|
|
define void @foo() nounwind uwtable safestack {
|
|
entry:
|
|
; CHECK: %[[TP:.*]] = call i8* @llvm.aarch64.thread.pointer()
|
|
; CHECK: %[[SPA0:.*]] = getelementptr i8, i8* %[[TP]], i32 72
|
|
; CHECK: %[[SPA:.*]] = bitcast i8* %[[SPA0]] to i8**
|
|
; 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*)
|