Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -171,7 +171,7 @@ filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH x86_64 i386 i686 powerpc64 arm aarch64 mips mips64 mipsel mips64el) filter_available_targets(ASAN_SUPPORTED_ARCH - x86_64 i386 i686 powerpc64 arm mips mipsel) + x86_64 i386 i686 powerpc64 arm mips mipsel mips64 mips64el) filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64) filter_available_targets(LSAN_SUPPORTED_ARCH x86_64) # LSan common files should be available on all architectures supported Index: lib/asan/asan_allocator.h =================================================================== --- lib/asan/asan_allocator.h +++ lib/asan/asan_allocator.h @@ -102,6 +102,9 @@ # if defined(__powerpc64__) const uptr kAllocatorSpace = 0xa0000000000ULL; const uptr kAllocatorSize = 0x20000000000ULL; // 2T. +#elif defined(__mips64) +const uptr kAllocatorSpace = 0x4000000000ULL; +const uptr kAllocatorSize = 0x4000000000ULL; // 256GB. # else const uptr kAllocatorSpace = 0x600000000000ULL; const uptr kAllocatorSize = 0x40000000000ULL; // 4T. Index: lib/asan/asan_mapping.h =================================================================== --- lib/asan/asan_mapping.h +++ lib/asan/asan_mapping.h @@ -87,6 +87,7 @@ static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G. static const u64 kAArch64_ShadowOffset64 = 1ULL << 36; static const u64 kMIPS32_ShadowOffset32 = 0x0aaa8000; +static const u64 kMIPS64_ShadowOffset64 = 1ULL << 36; #if defined(__powerpc64__) && defined(__BIG_ENDIAN__) static const u64 kPPC64_ShadowOffset64 = 1ULL << 41; #elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) @@ -120,6 +121,8 @@ # define SHADOW_OFFSET kFreeBSD_ShadowOffset64 # elif SANITIZER_MAC # define SHADOW_OFFSET kDefaultShadowOffset64 +# elif defined(__mips64) +# define SHADOW_OFFSET kMIPS64_ShadowOffset64 # else # define SHADOW_OFFSET kDefaultShort64bitShadowOffset # endif Index: lib/sanitizer_common/sanitizer_posix.cc =================================================================== --- lib/sanitizer_common/sanitizer_posix.cc +++ lib/sanitizer_common/sanitizer_posix.cc @@ -89,6 +89,8 @@ return (1ULL << 46) - 1; // 0x00003fffffffffffUL # elif defined(__aarch64__) return (1ULL << 39) - 1; +# elif defined(__mips64) + return (1ULL << 40) - 1; # else return (1ULL << 47) - 1; // 0x00007fffffffffffUL; # endif Index: lib/sanitizer_common/sanitizer_printf.cc =================================================================== --- lib/sanitizer_common/sanitizer_printf.cc +++ lib/sanitizer_common/sanitizer_printf.cc @@ -111,9 +111,13 @@ static int AppendPointer(char **buff, const char *buff_end, u64 ptr_value) { int result = 0; +#ifdef __mips__ + int AddressLength = (SANITIZER_WORDSIZE == 64) ? 10 : 8; +#else + int AddressLength = (SANITIZER_WORDSIZE == 64) ? 12 : 8; +#endif result += AppendString(buff, buff_end, -1, "0x"); - result += AppendUnsigned(buff, buff_end, ptr_value, 16, - (SANITIZER_WORDSIZE == 64) ? 12 : 8, true); + result += AppendUnsigned(buff, buff_end, ptr_value, 16, AddressLength, true); return result; } Index: test/asan/CMakeLists.txt =================================================================== --- test/asan/CMakeLists.txt +++ test/asan/CMakeLists.txt @@ -68,7 +68,7 @@ list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/AArch64LinuxConfig) endif() - if(CAN_TARGET_x86_64 OR CAN_TARGET_powerpc64) + if(CAN_TARGET_x86_64 OR CAN_TARGET_powerpc64 OR CAN_TARGET_mips64 OR CAN_TARGET_mips64el) set(ASAN_TEST_CONFIG_SUFFIX "64") set(ASAN_TEST_BITS "64") set(ASAN_TEST_TARGET_CFLAGS ${TARGET_64_BIT_CFLAGS})