[PATCH] D49152: SafeStack: Add builtins to read unsafe stack top/bottom
Vlad Tsyrklevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 10 13:54:20 PDT 2018
vlad.tsyrklevich created this revision.
vlad.tsyrklevich added a reviewer: pcc.
Herald added a subscriber: llvm-commits.
Introduce built-ins to read the unsafe stack top and bottom. The unsafe
stack top is required to implement garbage collection scanning for
Oilpan. Currently there is already a built-in 'get_unsafe_stack_start'
to read the bottom of the unsafe stack, but I chose to duplicate this
API because 'start' is ambiguous (e.g. Oilpan uses WTF::GetStackStart to
read the safe stack top.)
Repository:
rL LLVM
https://reviews.llvm.org/D49152
Files:
clang/docs/SafeStack.rst
clang/include/clang/Basic/Builtins.def
compiler-rt/lib/safestack/safestack.cc
Index: compiler-rt/lib/safestack/safestack.cc
===================================================================
--- compiler-rt/lib/safestack/safestack.cc
+++ compiler-rt/lib/safestack/safestack.cc
@@ -257,10 +257,19 @@
#endif
extern "C"
- __attribute__((visibility("default"))) void *__get_unsafe_stack_start() {
+ __attribute__((visibility("default"))) void *__get_unsafe_stack_bottom() {
return unsafe_stack_start;
}
+extern "C"
+ __attribute__((visibility("default"))) void *__get_unsafe_stack_top() {
+ return (char*)unsafe_stack_start + unsafe_stack_size;
+}
+
+extern "C"
+ __attribute__((visibility("default"), alias("__get_unsafe_stack_bottom")))
+ void *__get_unsafe_stack_start();
+
extern "C"
__attribute__((visibility("default"))) void *__get_unsafe_stack_ptr() {
return __safestack_unsafe_stack_ptr;
Index: clang/include/clang/Basic/Builtins.def
===================================================================
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -1412,6 +1412,8 @@
// Safestack builtins
BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn")
+BUILTIN(__builtin___get_unsafe_stack_bottom, "v*", "Fn")
+BUILTIN(__builtin___get_unsafe_stack_top, "v*", "Fn")
BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn")
// Nontemporal loads/stores builtins
Index: clang/docs/SafeStack.rst
===================================================================
--- clang/docs/SafeStack.rst
+++ clang/docs/SafeStack.rst
@@ -165,11 +165,23 @@
This builtin function returns current unsafe stack pointer of the current
thread.
+``__builtin___get_unsafe_stack_bottom()``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This builtin function returns a pointer to the bottom of the unsafe stack of the
+current thread.
+
+``__builtin___get_unsafe_stack_top()``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This builtin function returns a pointer to the top of the unsafe stack of the
+current thread.
+
``__builtin___get_unsafe_stack_start()``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-This builtin function returns a pointer to the start of the unsafe stack of the
-current thread.
+Deprecated: This builtin function is an alias for
+``__builtin___get_unsafe_stack_bottom()``.
Design
======
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49152.154874.patch
Type: text/x-patch
Size: 2295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180710/991e1bb0/attachment.bin>
More information about the llvm-commits
mailing list