[compiler-rt] r337037 - SafeStack: Add builtins to read unsafe stack top/bottom

Vlad Tsyrklevich via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 13 12:48:35 PDT 2018


Author: vlad.tsyrklevich
Date: Fri Jul 13 12:48:35 2018
New Revision: 337037

URL: http://llvm.org/viewvc/llvm-project?rev=337037&view=rev
Log:
SafeStack: Add builtins to read unsafe stack top/bottom

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

Modified:
    compiler-rt/trunk/lib/safestack/safestack.cc

Modified: compiler-rt/trunk/lib/safestack/safestack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/safestack/safestack.cc?rev=337037&r1=337036&r2=337037&view=diff
==============================================================================
--- compiler-rt/trunk/lib/safestack/safestack.cc (original)
+++ compiler-rt/trunk/lib/safestack/safestack.cc Fri Jul 13 12:48:35 2018
@@ -257,11 +257,20 @@ __attribute__((section(".preinit_array")
 #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;
 }




More information about the llvm-commits mailing list