[compiler-rt] r243470 - Add commentary explaining PPC access to return address

Bill Schmidt wschmidt at linux.vnet.ibm.com
Tue Jul 28 13:05:06 PDT 2015


Author: wschmidt
Date: Tue Jul 28 15:05:06 2015
New Revision: 243470

URL: http://llvm.org/viewvc/llvm-project?rev=243470&view=rev
Log:
Add commentary explaining PPC access to return address

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=243470&r1=243469&r2=243470&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc Tue Jul 28 15:05:06 2015
@@ -84,6 +84,9 @@ void BufferedStackTrace::FastUnwindStack
          IsAligned((uptr)frame, sizeof(*frame)) &&
          size < max_depth) {
 #ifdef __powerpc__
+    // PowerPC ABIs specify that the return address is saved at offset
+    // 16 of the *caller's* stack frame.  Thus we must dereference the
+    // back chain to find the caller frame before extracting it.
     uhwptr *caller_frame = (uhwptr*)frame[0];
     if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
         !IsAligned((uptr)caller_frame, sizeof(uhwptr)))





More information about the llvm-commits mailing list