<div dir="ltr">Looks like this broke our bot: <a href="http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/29210/">http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/29210/</a><div><br></div><div>Could you please take a look?</div><div><br></div><div>Thanks</div><div><br></div><div>Cheers,</div><div>Juergen<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 16, 2017 at 2:38 PM, Kostya Serebryany via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Bill,<div><br></div><div>* Has this been code-reviewed? In general, please do pre-commit code reviews for any code that is common between Power and other platforms. </div><div>Even if (or: especially if) there are #ifdefs involved. (I hate #ifdefs)</div><div>* Is there any chance to get rid of #ifdefs and replace them with if()? Or maybe just a separate implementation for Power? </div><div>* do the existing tests cover the problems that this change solves? </div><div><br></div><div><br></div><div>Thanks, </div><div>--kcc </div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 16, 2017 at 2:14 PM, Bill Seurer via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: seurer<br>
Date: Thu Mar 16 16:14:13 2017<br>
New Revision: 297995<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=297995&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=297995&view=rev</a><br>
Log:<br>
[PowerPC] Fix sanitizer frame unwind on 32-bit ABIs<br>
<br>
This fixes many sanitizer problems with -m32.  It is really intended<br>
for gcc but patches to the sanitizers make their way through llvm<br>
first.<br>
<br>
ref:  <a href="https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00855.html" rel="noreferrer" target="_blank">https://gcc.gnu.org/ml/gcc-pat<wbr>ches/2017-02/msg00855.html</a><br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_stacktrace.<wbr>cc<br>
<br>
Modified: compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_stacktrace.<wbr>cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=297995&r1=297994&r2=297995&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/compiler-rt/trunk/lib/sa<wbr>nitizer_common/sanitizer_stack<wbr>trace.cc?rev=297995&r1=297994&<wbr>r2=297995&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_stacktrace.<wbr>cc (original)<br>
+++ compiler-rt/trunk/lib/sanitize<wbr>r_common/sanitizer_stacktrace.<wbr>cc Thu Mar 16 16:14:13 2017<br>
@@ -79,15 +79,22 @@ void BufferedStackTrace::FastUnwind<wbr>Stack<br>
   while (IsValidFrame((uptr)frame, stack_top, bottom) &&<br>
          IsAligned((uptr)frame, sizeof(*frame)) &&<br>
          size < max_depth) {<br>
+     // PowerPC ABIs specify that the return address is saved on the<br>
+     // *caller's* stack frame.  Thus we must dereference the back chain<br>
+     // to find the caller frame before extracting it.<br>
+     uhwptr *caller_frame = (uhwptr*)frame[0];<br>
+     if (!IsValidFrame((uptr)caller_fr<wbr>ame, stack_top, bottom) ||<br>
+         !IsAligned((uptr)caller_<wbr>frame, sizeof(uhwptr)))<br>
+       break;<br>
 #ifdef __powerpc__<br>
-    // PowerPC ABIs specify that the return address is saved at offset<br>
-    // 16 of the *caller's* stack frame.  Thus we must dereference the<br>
-    // back chain to find the caller frame before extracting it.<br>
-    uhwptr *caller_frame = (uhwptr*)frame[0];<br>
-    if (!IsValidFrame((uptr)caller_fr<wbr>ame, stack_top, bottom) ||<br>
-        !IsAligned((uptr)caller_frame, sizeof(uhwptr)))<br>
-      break;<br>
+    // For most ABIs the offset where the return address is saved is two<br>
+    // register sizes.  The exception is the SVR4 ABI, which uses an<br>
+    // offset of only one register size.<br>
+#ifdef _CALL_SYSV<br>
+    uhwptr pc1 = caller_frame[1];<br>
+#else<br>
     uhwptr pc1 = caller_frame[2];<br>
+#endif<br>
 #elif defined(__s390__)<br>
     uhwptr pc1 = frame[14];<br>
 #else<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div></div>