diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h @@ -98,7 +98,7 @@ // It seems difficult to figure out the exact instruction length - // pc - 2 seems like a safe option for the purposes of stack tracing return pc - 2; -#elif SANITIZER_I386 || SANITIZER_X32 || SANITIZER_X64 +#elif SANITIZER_S390 || SANITIZER_I386 || SANITIZER_X32 || SANITIZER_X64 return pc - 1; #else return pc - 4; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp @@ -46,7 +46,7 @@ } // bail-out if could not figure out the instruction size return 0; -#elif SANITIZER_I386 || SANITIZER_X32 || SANITIZER_X64 +#elif SANITIZER_S390 || SANITIZER_I386 || SANITIZER_X32 || SANITIZER_X64 return pc + 1; #else return pc + 4; diff --git a/compiler-rt/test/tsan/test.h b/compiler-rt/test/tsan/test.h --- a/compiler-rt/test/tsan/test.h +++ b/compiler-rt/test/tsan/test.h @@ -69,13 +69,12 @@ #endif //The const kPCInc must be in sync with StackTrace::GetPreviousInstructionPc -#if defined(__powerpc64__) || defined(__arm__) || defined(__aarch64__) -// PCs are always 4 byte aligned. -const int kPCInc = 4; +#if defined(__s390__) || defined(__i386__) || defined(__x86_64__) +const int kPCInc = 1; #elif defined(__sparc__) || defined(__mips__) const int kPCInc = 8; #else -const int kPCInc = 1; +const int kPCInc = 4; #endif #ifdef __cplusplus diff --git a/llvm/tools/sancov/sancov.cpp b/llvm/tools/sancov/sancov.cpp --- a/llvm/tools/sancov/sancov.cpp +++ b/llvm/tools/sancov/sancov.cpp @@ -698,7 +698,7 @@ return PC - 8; if (TheTriple.isRISCV()) return PC - 2; - if (TheTriple.isX86()) + if (TheTriple.isX86() || TheTriple.isSystemZ()) return PC - 1; return PC - 4; }