]> granicus.if.org Git - clang/commitdiff
SafeStack: Add builtins to read unsafe stack top/bottom
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Fri, 13 Jul 2018 19:48:35 +0000 (19:48 +0000)
committerVlad Tsyrklevich <vlad@tsyrklevich.net>
Fri, 13 Jul 2018 19:48:35 +0000 (19:48 +0000)
Summary:
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.)

Reviewers: pcc

Reviewed By: pcc

Subscribers: llvm-commits, kcc

Differential Revision: https://reviews.llvm.org/D49152

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337037 91177308-0d34-0410-b5e6-96231b3b80d8

docs/SafeStack.rst
include/clang/Basic/Builtins.def

index f01b75f5cb37c76fb344ecde459c32ea6753d164..866a8060aa40eb2840f1b6a24af5d6ffea3bdb68 100644 (file)
@@ -165,11 +165,23 @@ never be stored on the heap, as it would leak the location of the SafeStack.
 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
 ======
index 39105a9b372bc0038621d5bdad60e0656a94e140..edd823754a3745360b16b00b6bf5a111213c5fe7 100644 (file)
@@ -1412,6 +1412,8 @@ BUILTIN(__builtin_dump_struct, "ivC*v*", "tn")
 
 // 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