[llvm-branch-commits] [compiler-rt-branch] r197360 - Merging r-196802:
Bill Wendling
isanbard at gmail.com
Sun Dec 15 18:36:46 PST 2013
Author: void
Date: Sun Dec 15 20:36:46 2013
New Revision: 197360
URL: http://llvm.org/viewvc/llvm-project?rev=197360&view=rev
Log:
Merging r-196802:
------------------------------------------------------------------------
r196802 | chandlerc | 2013-12-09 11:25:51 -0800 (Mon, 09 Dec 2013) | 11 lines
Revert three patches which were committed without explicit contribution
by their authors.
This may break builds where others added code relying on these patches,
but please *do not* revert this commit. Instead, we will prepare patches
which fix the failures.
Reverts the following commits:
r168306: "[asan] support x32 mode in the fast stack unwinder. Patch by H.J. Lu"
r168356: "[asan] more support for powerpc, patch by Peter Bergner"
r196489: "[sanitizer] fix the ppc32 build (patch by Jakub Jelinek)"
------------------------------------------------------------------------
Modified:
compiler-rt/branches/release_34/ (props changed)
compiler-rt/branches/release_34/lib/asan/asan_linux.cc
compiler-rt/branches/release_34/lib/asan/asan_mapping.h
compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_common.h
compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_internal_defs.h
compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h
compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_stacktrace.cc
Propchange: compiler-rt/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Dec 15 20:36:46 2013
@@ -1 +1 @@
-/compiler-rt/trunk:195427,195433-195434,195436,195442,195570,195642-195643,195652,195791,196501,196612,196779,196799,196802,196809
+/compiler-rt/trunk:195427,195433-195434,195436,195442,195570,195642-195643,195652,195791,196501,196612,196779,196799,196809
Modified: compiler-rt/branches/release_34/lib/asan/asan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/asan/asan_linux.cc?rev=197360&r1=197359&r2=197360&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/asan/asan_linux.cc (original)
+++ compiler-rt/branches/release_34/lib/asan/asan_linux.cc Sun Dec 15 20:36:46 2013
@@ -74,6 +74,13 @@ void GetPcSpBp(void *context, uptr *pc,
*pc = ucontext->uc_mcontext.gregs[REG_EIP];
*bp = ucontext->uc_mcontext.gregs[REG_EBP];
*sp = ucontext->uc_mcontext.gregs[REG_ESP];
+# elif defined(__powerpc__) || defined(__powerpc64__)
+ ucontext_t *ucontext = (ucontext_t*)context;
+ *pc = ucontext->uc_mcontext.regs->nip;
+ *sp = ucontext->uc_mcontext.regs->gpr[PT_R1];
+ // The powerpc{,64}-linux ABIs do not specify r31 as the frame
+ // pointer, but GCC always uses r31 when we need a frame pointer.
+ *bp = ucontext->uc_mcontext.regs->gpr[PT_R31];
# elif defined(__sparc__)
ucontext_t *ucontext = (ucontext_t*)context;
uptr *stk_ptr;
Modified: compiler-rt/branches/release_34/lib/asan/asan_mapping.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/asan/asan_mapping.h?rev=197360&r1=197359&r2=197360&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/asan/asan_mapping.h (original)
+++ compiler-rt/branches/release_34/lib/asan/asan_mapping.h Sun Dec 15 20:36:46 2013
@@ -61,6 +61,7 @@ static const u64 kDefaultShadowScale = 3
static const u64 kDefaultShadowOffset32 = 1ULL << 29;
static const u64 kDefaultShadowOffset64 = 1ULL << 44;
static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G.
+static const u64 kPPC64_ShadowOffset64 = 1ULL << 41;
static const u64 kMIPS32_ShadowOffset32 = 0x0aaa8000;
#if ASAN_FLEXIBLE_MAPPING_AND_OFFSET == 1
@@ -80,7 +81,9 @@ extern SANITIZER_INTERFACE_ATTRIBUTE upt
# define SHADOW_OFFSET kDefaultShadowOffset32
# endif
# else
-# if SANITIZER_MAC
+# if defined(__powerpc64__)
+# define SHADOW_OFFSET kPPC64_ShadowOffset64
+# elif SANITIZER_MAC
# define SHADOW_OFFSET kDefaultShadowOffset64
# else
# define SHADOW_OFFSET kDefaultShort64bitShadowOffset
Modified: compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_common.h?rev=197360&r1=197359&r2=197360&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_common.h Sun Dec 15 20:36:46 2013
@@ -27,7 +27,11 @@ struct StackTrace;
const uptr kWordSize = SANITIZER_WORDSIZE / 8;
const uptr kWordSizeInBits = 8 * kWordSize;
+#if defined(__powerpc__) || defined(__powerpc64__)
+const uptr kCacheLineSize = 128;
+#else
const uptr kCacheLineSize = 64;
+#endif
const uptr kMaxPathLength = 512;
Modified: compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_internal_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_internal_defs.h?rev=197360&r1=197359&r2=197360&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_internal_defs.h (original)
+++ compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_internal_defs.h Sun Dec 15 20:36:46 2013
@@ -58,6 +58,13 @@ typedef signed long long sptr; // NOL
typedef unsigned long uptr; // NOLINT
typedef signed long sptr; // NOLINT
#endif // defined(_WIN64)
+#if defined(__x86_64__)
+// Since x32 uses ILP32 data model in 64-bit hardware mode, we must use
+// 64-bit pointer to unwind stack frame.
+typedef unsigned long long uhwptr; // NOLINT
+#else
+typedef uptr uhwptr; // NOLINT
+#endif
typedef unsigned char u8;
typedef unsigned short u16; // NOLINT
typedef unsigned int u32;
Modified: compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=197360&r1=197359&r2=197360&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)
+++ compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_platform_limits_posix.h Sun Dec 15 20:36:46 2013
@@ -134,23 +134,32 @@ namespace __sanitizer {
int gid;
int cuid;
int cgid;
-#ifdef __powerpc64__
+#ifdef __powerpc__
unsigned mode;
unsigned __seq;
+ u64 __unused1;
+ u64 __unused2;
#else
unsigned short mode;
unsigned short __pad1;
unsigned short __seq;
unsigned short __pad2;
+#if defined(__x86_64__) && !defined(_LP64)
+ u64 __unused1;
+ u64 __unused2;
+#else
+ unsigned long __unused1;
+ unsigned long __unused2;
+#endif
#endif
- uptr __unused1;
- uptr __unused2;
};
struct __sanitizer_shmid_ds {
__sanitizer_ipc_perm shm_perm;
#ifndef __powerpc__
uptr shm_segsz;
+ #elif !defined(__powerpc64__)
+ uptr __unused0;
#endif
uptr shm_atime;
#ifndef _LP64
@@ -280,17 +289,20 @@ namespace __sanitizer {
#endif
#if SANITIZER_LINUX
-#if defined(_LP64) || defined(__x86_64__)
+#if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)
typedef unsigned __sanitizer___kernel_uid_t;
typedef unsigned __sanitizer___kernel_gid_t;
- typedef long long __sanitizer___kernel_off_t;
#else
typedef unsigned short __sanitizer___kernel_uid_t;
typedef unsigned short __sanitizer___kernel_gid_t;
+#endif
+#if defined(__x86_64__) && !defined(_LP64)
+ typedef long long __sanitizer___kernel_off_t;
+#else
typedef long __sanitizer___kernel_off_t;
#endif
-#if defined(__powerpc64__)
+#if defined(__powerpc__)
typedef unsigned int __sanitizer___kernel_old_uid_t;
typedef unsigned int __sanitizer___kernel_old_gid_t;
#else
Modified: compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_stacktrace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=197360&r1=197359&r2=197360&view=diff
==============================================================================
--- compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_stacktrace.cc (original)
+++ compiler-rt/branches/release_34/lib/sanitizer_common/sanitizer_stacktrace.cc Sun Dec 15 20:36:46 2013
@@ -24,7 +24,10 @@ uptr StackTrace::GetPreviousInstructionP
// Cancel Thumb bit.
pc = pc & (~1);
#endif
-#if defined(__sparc__)
+#if defined(__powerpc__) || defined(__powerpc64__)
+ // PCs are always 4 byte aligned.
+ return pc - 4;
+#elif defined(__sparc__)
return pc - 8;
#else
return pc - 1;
@@ -125,21 +128,29 @@ void StackTrace::FastUnwindStack(uptr pc
}
trace[0] = pc;
size = 1;
- uptr *frame = (uptr *)bp;
- uptr *prev_frame = frame - 1;
+ uhwptr *frame = (uhwptr *)bp;
+ uhwptr *prev_frame = frame - 1;
if (stack_top < 4096) return; // Sanity check for stack top.
// Avoid infinite loop when frame == frame[0] by using frame > prev_frame.
while (frame > prev_frame &&
- frame < (uptr *)stack_top - 2 &&
- frame > (uptr *)stack_bottom &&
+ frame < (uhwptr *)stack_top - 2 &&
+ frame > (uhwptr *)stack_bottom &&
IsAligned((uptr)frame, sizeof(*frame)) &&
size < max_depth) {
- uptr pc1 = frame[1];
+ uhwptr pc1 = frame[1];
if (pc1 != pc) {
- trace[size++] = pc1;
+ trace[size++] = (uptr) pc1;
}
prev_frame = frame;
- frame = (uptr*)frame[0];
+ frame = (uhwptr *)frame[0];
+ }
+}
+
+void StackTrace::PopStackFrames(uptr count) {
+ CHECK(size >= count);
+ size -= count;
+ for (uptr i = 0; i < size; i++) {
+ trace[i] = trace[i + count];
}
}
More information about the llvm-branch-commits
mailing list