Index: lib/asan/asan_mapping.h =================================================================== --- lib/asan/asan_mapping.h +++ lib/asan/asan_mapping.h @@ -87,11 +87,7 @@ 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 Index: lib/sanitizer_common/sanitizer_posix.cc =================================================================== --- lib/sanitizer_common/sanitizer_posix.cc +++ lib/sanitizer_common/sanitizer_posix.cc @@ -78,15 +78,15 @@ uptr GetMaxVirtualAddress() { #if SANITIZER_WORDSIZE == 64 -# if defined(__powerpc64__) && defined(__BIG_ENDIAN__) +# if defined(__powerpc64__) // On PowerPC64 we have two different address space layouts: 44- and 46-bit. // We somehow need to figure out which one we are using now and choose // one of 0x00000fffffffffffUL and 0x00003fffffffffffUL. // Note that with 'ulimit -s unlimited' the stack is moved away from the top // of the address space, so simply checking the stack address is not enough. - return (1ULL << 44) - 1; // 0x00000fffffffffffUL -# elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) - return (1ULL << 46) - 1; // 0x00003fffffffffffUL + // Using helper macros to determine the frame and handle the bit-shifting. + // This should work for both PowerPC64 Endian modes. + return (1ULL << (MostSignificantSetBitIndex(GET_CURRENT_FRAME())+1)) -1; # elif defined(__aarch64__) return (1ULL << 39) - 1; # else