summaryrefslogtreecommitdiff
path: root/lib/asan
diff options
context:
space:
mode:
authorWill Schmidt <will_schmidt@vnet.ibm.com>2014-10-15 18:34:04 +0000
committerWill Schmidt <will_schmidt@vnet.ibm.com>2014-10-15 18:34:04 +0000
commitc57a8a6547299f9b65dadcab02dde232b88fb31d (patch)
treeddd6e456b02329fa09a848507f68aaf4d247dda8 /lib/asan
parent1d7819bcce8836dc543e200d6acc1fac8ded0a36 (diff)
[compiler-rt] Enable ASAN for powerpc64le-linux
Whitespace update for lint check by myself (Will). Otherwise code and comments by Peter Bergner, as previously seen on llvm-commits. The following patch gets ASAN somewhat working on powerpc64le-linux. It currently assumes the LE kernel uses 46-bit addressing, which is true, but it doesn't solve the case for BE where it may be 44 or 46 bits. That can be fixed with a follow on patch. There are some test suite fails even with this patch that I haven't had time to solve yet, but this is better than the state it is in now. The limited debugging of those test suite fails seems to show that the address map for 46-bit addressing has changed and so we'll need to modify the shadow memory location slightly. Again, that can be fixed with a follow on patch. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@219827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r--lib/asan/asan_mapping.h4
-rw-r--r--lib/asan/asan_report.cc4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/asan/asan_mapping.h b/lib/asan/asan_mapping.h
index 8acc99a1f..68428e1f5 100644
--- a/lib/asan/asan_mapping.h
+++ b/lib/asan/asan_mapping.h
@@ -87,7 +87,11 @@ static const u64 kDefaultShadowOffset64 = 1ULL << 44;
static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G.
static const u64 kAArch64_ShadowOffset64 = 1ULL << 36;
static const u64 kMIPS32_ShadowOffset32 = 0x0aaa8000;
+#if defined(__powerpc64__) && defined(__BIG_ENDIAN__)
static const u64 kPPC64_ShadowOffset64 = 1ULL << 41;
+#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
+static const u64 kPPC64_ShadowOffset64 = 1ULL << 43;
+#endif
static const u64 kFreeBSD_ShadowOffset32 = 1ULL << 30; // 0x40000000
static const u64 kFreeBSD_ShadowOffset64 = 1ULL << 46; // 0x400000000000
diff --git a/lib/asan/asan_report.cc b/lib/asan/asan_report.cc
index 7dd1006bf..7e79adb70 100644
--- a/lib/asan/asan_report.cc
+++ b/lib/asan/asan_report.cc
@@ -437,8 +437,8 @@ bool DescribeAddressIfStack(uptr addr, uptr access_size) {
// especially given that the alloca may be from entirely different place
// (e.g. use-after-scope, or different thread's stack).
StackTrace alloca_stack;
-#ifdef __powerpc64__
- // On PowerPC64, the address of a function actually points to a
+#if defined(__powerpc64__) and defined(__BIG_ENDIAN__)
+ // On PowerPC64 ELFv1, the address of a function actually points to a
// three-doubleword data structure with the first field containing
// the address of the function's code.
access.frame_pc = *reinterpret_cast<uptr *>(access.frame_pc);