[compiler-rt] r243467 - PowerPC's ABIs differ from those of other architectures in that the

Hal Finkel hfinkel at anl.gov
Tue Jul 28 12:51:35 PDT 2015


----- Original Message -----
> From: "Bill Schmidt" <wschmidt at linux.vnet.ibm.com>
> To: llvm-commits at cs.uiuc.edu
> Sent: Tuesday, July 28, 2015 2:41:50 PM
> Subject: [compiler-rt] r243467 - PowerPC's ABIs differ from those of other	architectures in that the
> 
> Author: wschmidt
> Date: Tue Jul 28 14:41:49 2015
> New Revision: 243467
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=243467&view=rev
> Log:
> PowerPC's ABIs differ from those of other architectures in that the
> callee-saved return address is stored in the caller's stack frame,
> not
> the callee's.  This patch adjusts the logic to find the LR in the
> correct place for PowerPC.
> 
> Patch joint with Bill Seurer.
> 
> Modified:
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
> 
> 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=243467&r1=243466&r2=243467&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
> Tue Jul 28 14:41:49 2015
> @@ -83,7 +83,15 @@ void BufferedStackTrace::FastUnwindStack
>    while (IsValidFrame((uptr)frame, stack_top, bottom) &&
>           IsAligned((uptr)frame, sizeof(*frame)) &&
>           size < max_depth) {
> +#ifdef __powerpc__

Please add a comment explaining the rationale here as well.

Thanks,
Hal

> +    uhwptr *caller_frame = (uhwptr*)frame[0];
> +    if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
> +        !IsAligned((uptr)caller_frame, sizeof(uhwptr)))
> +      break;
> +    uhwptr pc1 = caller_frame[2];
> +#else
>      uhwptr pc1 = frame[1];
> +#endif
>      if (pc1 != pc) {
>        trace_buffer[size++] = (uptr) pc1;
>      }
> 
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h?rev=243467&r1=243466&r2=243467&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h Tue
> Jul 28 14:41:49 2015
> @@ -19,8 +19,7 @@ namespace __sanitizer {
>  
>  static const u32 kStackTraceMax = 256;
>  
> -#if SANITIZER_LINUX && (defined(__aarch64__) || defined(__powerpc__)
> || \
> -                        defined(__powerpc64__) || defined(__sparc__)
> || \
> +#if SANITIZER_LINUX && (defined(__aarch64__) || defined(__sparc__)
> || \
>                          defined(__mips__))
>  # define SANITIZER_CAN_FAST_UNWIND 0
>  #elif SANITIZER_WINDOWS
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list