[PATCH] D58431: SanitizerCommon: fixes for unwinding & backtrace on SPARC
Eric Botcazou via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 21 06:18:48 PST 2019
ebotcazou marked 2 inline comments as done.
ebotcazou added inline comments.
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc:35
+ // on the SPARC and not the return address, so we need to compensate.
+ trace_buffer[0] = GetNextInstructionPc(pc);
+#else
----------------
vitalybuka wrote:
> I am not sure that we need to compensate here
> usually it's from GetStackTrace which pass the current PC or PC from signal
Yes, we do, the backtrace does GetPreviousInstructionPc in every case so, if you don' t do it there too, then the backtrace is wrong.
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:139
+#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.
----------------
vitalybuka wrote:
> that's strange
> is this know issue?
Yes, it's a known historical quirk on the SPARC. The root cause is probably that, in 32-bit mode, the return address is either %o7+8 or %o7+12 depending on the return type and the correct case isn't always easy to spot. That's not the case in 64-bit mode, but the usage was preserved, for the sake of consistency I presume.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58431/new/
https://reviews.llvm.org/D58431
More information about the llvm-commits
mailing list