diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-03-13 09:11:46 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-03-13 09:11:46 +0000 |
commit | 36b50aeb4e6f4ed3ab12346c7d3d18215f1acf7a (patch) | |
tree | 3d779a999394813083c48c558bb4269c859204b5 /libsanitizer | |
parent | 017abbe3620072dbb527c31d83c6529f9ec128bb (diff) | |
download | gcc-36b50aeb4e6f4ed3ab12346c7d3d18215f1acf7a.zip gcc-36b50aeb4e6f4ed3ab12346c7d3d18215f1acf7a.tar.gz gcc-36b50aeb4e6f4ed3ab12346c7d3d18215f1acf7a.tar.bz2 |
re PR sanitizer/80953 (Support libsanitizer on Solaris)
PR sanitizer/80953
Merge from LLVM revision 355978
* sanitizer_common/sanitizer_allocator_primary32.h
(class SizeClassAllocator32): Assert that kSpaceSize is power of 2 if
SANITIZER_SIGN_EXTENDED_ADDRESSES is set.
(PointerIsMine): Deal with SANITIZER_SIGN_EXTENDED_ADDRESSES.
(ComputeRegionId): Likewise.
* sanitizer_common/sanitizer_linux.cc (GetMaxVirtualAddress): Return
appropriate value for SPARC 64-bit.
* sanitizer_common/sanitizer_platform.h (SANITIZER_MMAP_RANGE_SIZE):
Define for SPARC.
(SANITIZER_SIGN_EXTENDED_ADDRESSES): Define to 1 for SPARC 64-bit.
From-SVN: r269639
Diffstat (limited to 'libsanitizer')
-rw-r--r-- | libsanitizer/ChangeLog | 15 | ||||
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_allocator_primary32.h | 7 | ||||
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_linux.cc | 2 | ||||
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_platform.h | 11 |
4 files changed, 35 insertions, 0 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 3293fe0..65df77e 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,6 +1,21 @@ 2019-03-13 Eric Botcazou <ebotcazou@adacore.com> PR sanitizer/80953 + Merge from LLVM revision 355978 + * sanitizer_common/sanitizer_allocator_primary32.h + (class SizeClassAllocator32): Assert that kSpaceSize is power of 2 if + SANITIZER_SIGN_EXTENDED_ADDRESSES is set. + (PointerIsMine): Deal with SANITIZER_SIGN_EXTENDED_ADDRESSES. + (ComputeRegionId): Likewise. + * sanitizer_common/sanitizer_linux.cc (GetMaxVirtualAddress): Return + appropriate value for SPARC 64-bit. + * sanitizer_common/sanitizer_platform.h (SANITIZER_MMAP_RANGE_SIZE): + Define for SPARC. + (SANITIZER_SIGN_EXTENDED_ADDRESSES): Define to 1 for SPARC 64-bit. + +2019-03-13 Eric Botcazou <ebotcazou@adacore.com> + + PR sanitizer/80953 Merge from LLVM revision 355965 * sanitizer_common/sanitizer_linux.cc (GetWriteFlag): Implement for SPARC/Linux. diff --git a/libsanitizer/sanitizer_common/sanitizer_allocator_primary32.h b/libsanitizer/sanitizer_common/sanitizer_allocator_primary32.h index bdea498..de16cf2 100644 --- a/libsanitizer/sanitizer_common/sanitizer_allocator_primary32.h +++ b/libsanitizer/sanitizer_common/sanitizer_allocator_primary32.h @@ -54,6 +54,9 @@ class SizeClassAllocator32 { typedef typename Params::ByteMap ByteMap; typedef typename Params::MapUnmapCallback MapUnmapCallback; + COMPILER_CHECK(!SANITIZER_SIGN_EXTENDED_ADDRESSES || + (kSpaceSize & (kSpaceSize - 1)) == 0); + static const bool kRandomShuffleChunks = Params::kFlags & SizeClassAllocator32FlagMasks::kRandomShuffleChunks; static const bool kUseSeparateSizeClassForBatch = Params::kFlags & @@ -175,6 +178,8 @@ class SizeClassAllocator32 { bool PointerIsMine(const void *p) { uptr mem = reinterpret_cast<uptr>(p); + if (SANITIZER_SIGN_EXTENDED_ADDRESSES) + mem &= (kSpaceSize - 1); if (mem < kSpaceBeg || mem >= kSpaceBeg + kSpaceSize) return false; return GetSizeClass(p) != 0; @@ -267,6 +272,8 @@ class SizeClassAllocator32 { COMPILER_CHECK(sizeof(SizeClassInfo) % kCacheLineSize == 0); uptr ComputeRegionId(uptr mem) { + if (SANITIZER_SIGN_EXTENDED_ADDRESSES) + mem &= (kSpaceSize - 1); const uptr res = mem >> kRegionSizeLog; CHECK_LT(res, kNumPossibleRegions); return res; diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc index 84c81a4..dc1e984 100644 --- a/libsanitizer/sanitizer_common/sanitizer_linux.cc +++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc @@ -1064,6 +1064,8 @@ uptr GetMaxVirtualAddress() { return (1ULL << 40) - 1; // 0x000000ffffffffffUL; # elif defined(__s390x__) return (1ULL << 53) - 1; // 0x001fffffffffffffUL; +# elif defined(__sparc__) + return ~(uptr)0; # else return (1ULL << 47) - 1; // 0x00007fffffffffffUL; # endif diff --git a/libsanitizer/sanitizer_common/sanitizer_platform.h b/libsanitizer/sanitizer_common/sanitizer_platform.h index 1926679..cc72d52 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform.h @@ -239,10 +239,21 @@ # else # define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 48) # endif +#elif defined(__sparc__) +# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 52) #else # define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 47) #endif +// Whether the addresses are sign-extended from the VMA range to the word. +// The SPARC64 Linux port implements this to split the VMA space into two +// non-contiguous halves with a huge hole in the middle. +#if defined(__sparc__) && SANITIZER_WORDSIZE == 64 +# define SANITIZER_SIGN_EXTENDED_ADDRESSES 1 +#else +# define SANITIZER_SIGN_EXTENDED_ADDRESSES 0 +#endif + // The AArch64 linux port uses the canonical syscall set as mandated by // the upstream linux community for all new ports. Other ports may still // use legacy syscalls. |