rs6000: Fix sanitizer frame unwind on 32-bit ABIs
This fixes more than half of our testcase failures on BE. libsanitizer/ * sanitizer_common/sanitizer_stacktrace.cc (BufferedStackTrace::FastUnwindStack): Use the correct frame offset for PowerPC SYSV ABI. From-SVN: r258525
This commit is contained in:
parent
def703386a
commit
1422855a40
|
@ -1,3 +1,9 @@
|
||||||
|
2018-03-14 Segher Boessenkool <segher@kernel.crashing.org>
|
||||||
|
|
||||||
|
* sanitizer_common/sanitizer_stacktrace.cc
|
||||||
|
(BufferedStackTrace::FastUnwindStack): Use the correct frame offset
|
||||||
|
for PowerPC SYSV ABI.
|
||||||
|
|
||||||
2018-02-14 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
|
2018-02-14 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
|
||||||
|
|
||||||
PR target/84148
|
PR target/84148
|
||||||
|
|
|
@ -78,14 +78,21 @@ void BufferedStackTrace::FastUnwindStack(uptr pc, uptr bp, uptr stack_top,
|
||||||
IsAligned((uptr)frame, sizeof(*frame)) &&
|
IsAligned((uptr)frame, sizeof(*frame)) &&
|
||||||
size < max_depth) {
|
size < max_depth) {
|
||||||
#ifdef __powerpc__
|
#ifdef __powerpc__
|
||||||
// PowerPC ABIs specify that the return address is saved at offset
|
// PowerPC ABIs specify that the return address is saved on the
|
||||||
// 16 of the *caller's* stack frame. Thus we must dereference the
|
// *caller's* stack frame. Thus we must dereference the back chain
|
||||||
// back chain to find the caller frame before extracting it.
|
// to find the caller frame before extracting it.
|
||||||
uhwptr *caller_frame = (uhwptr*)frame[0];
|
uhwptr *caller_frame = (uhwptr*)frame[0];
|
||||||
if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
|
if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
|
||||||
!IsAligned((uptr)caller_frame, sizeof(uhwptr)))
|
!IsAligned((uptr)caller_frame, sizeof(uhwptr)))
|
||||||
break;
|
break;
|
||||||
|
// For most ABIs the offset where the return address is saved is two
|
||||||
|
// register sizes. The exception is the SVR4 ABI, which uses an
|
||||||
|
// offset of only one register size.
|
||||||
|
#ifdef _CALL_SYSV
|
||||||
|
uhwptr pc1 = caller_frame[1];
|
||||||
|
#else
|
||||||
uhwptr pc1 = caller_frame[2];
|
uhwptr pc1 = caller_frame[2];
|
||||||
|
#endif
|
||||||
#elif defined(__s390__)
|
#elif defined(__s390__)
|
||||||
uhwptr pc1 = frame[14];
|
uhwptr pc1 = frame[14];
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue