summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SafeStack/ARM
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-23 18:07:56 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-23 18:07:56 +0000
commita2002b08f7bd0e165a14a91322acf917bb6c52ea (patch)
tree4c769bbd2e49b5618af12131e59539102908680a /llvm/test/Transforms/SafeStack/ARM
parentb14ecd34f73d8d5414dd6705d0d365eb873889ab (diff)
downloadbcm5719-llvm-a2002b08f7bd0e165a14a91322acf917bb6c52ea.tar.gz
bcm5719-llvm-a2002b08f7bd0e165a14a91322acf917bb6c52ea.zip
Android support for SafeStack.
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. llvm-svn: 248405
Diffstat (limited to 'llvm/test/Transforms/SafeStack/ARM')
-rw-r--r--llvm/test/Transforms/SafeStack/ARM/abi.ll18
-rw-r--r--llvm/test/Transforms/SafeStack/ARM/lit.local.cfg3
2 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SafeStack/ARM/abi.ll b/llvm/test/Transforms/SafeStack/ARM/abi.ll
new file mode 100644
index 00000000000..e33c913ae91
--- /dev/null
+++ b/llvm/test/Transforms/SafeStack/ARM/abi.ll
@@ -0,0 +1,18 @@
+; 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*)
diff --git a/llvm/test/Transforms/SafeStack/ARM/lit.local.cfg b/llvm/test/Transforms/SafeStack/ARM/lit.local.cfg
new file mode 100644
index 00000000000..98c6700c209
--- /dev/null
+++ b/llvm/test/Transforms/SafeStack/ARM/lit.local.cfg
@@ -0,0 +1,3 @@
+if not 'ARM' in config.root.targets:
+ config.unsupported = True
+
OpenPOWER on IntegriCloud