[PATCH] D156504: [sanitizer_common] Remove hacks for __builtin_return_address abuse on SPARC
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 3 07:07:54 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG679c076ae446: [sanitizer_common] Remove hacks for __builtin_return_address abuse on SPARC (authored by ro).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156504/new/
https://reviews.llvm.org/D156504
Files:
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp
compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
Index: compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
+++ compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp
@@ -139,13 +139,7 @@
if (to_pop == 0 && size > 1)
to_pop = 1;
PopStackFrames(to_pop);
-#if defined(__GNUC__) && defined(__sparc__)
- // __builtin_return_address returns the address of the call instruction
- // on the SPARC and not the return address, so we need to compensate.
- trace_buffer[0] = GetNextInstructionPc(pc);
-#else
trace_buffer[0] = pc;
-#endif
}
void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) {
Index: compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp
+++ compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp
@@ -30,13 +30,7 @@
// TODO(yln): add arg sanity check for stack_top/stack_bottom
CHECK_GE(max_depth, 2);
const uptr kPageSize = GetPageSizeCached();
-#if defined(__GNUC__)
- // __builtin_return_address returns the address of the call instruction
- // on the SPARC and not the return address, so we need to compensate.
- trace_buffer[0] = GetNextInstructionPc(pc);
-#else
trace_buffer[0] = pc;
-#endif
size = 1;
if (stack_top < 4096) return; // Sanity check for stack top.
// Flush register windows to memory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156504.546849.patch
Type: text/x-patch
Size: 1555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230803/179812cb/attachment.bin>
More information about the llvm-commits
mailing list