[compiler-rt] db7bca2 - [sanitizer][mips] Fix the condition to include sanitizer_atomic_clang_mips.h

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 10:20:09 PST 2022


Author: Xi Ruoyao
Date: 2022-03-09T10:20:05-08:00
New Revision: db7bca28638e86f18e5ba3b936c900144ef29b93

URL: https://github.com/llvm/llvm-project/commit/db7bca28638e86f18e5ba3b936c900144ef29b93
DIFF: https://github.com/llvm/llvm-project/commit/db7bca28638e86f18e5ba3b936c900144ef29b93.diff

LOG: [sanitizer][mips] Fix the condition to include sanitizer_atomic_clang_mips.h

The Glibc header [1] define _ABIO32 unconditionally on MIPS.  So we need
to compare _MIPS_SIM and _ABIO32 to know if we are actually building for
MIPS32.  Using sanitizer_atomic_clang_mips.h can cause test failures and
hangs on MIPS64.

[1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/sgidefs.h

Reviewed By: dvyukov, vitalybuka, MaskRay

Differential Revision: https://reviews.llvm.org/D121207

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h
index c2b22cf572a68..4318d64d16cfa 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h
@@ -95,8 +95,8 @@ inline bool atomic_compare_exchange_weak(volatile T *a,
 // This include provides explicit template instantiations for atomic_uint64_t
 // on MIPS32, which does not directly support 8 byte atomics. It has to
 // proceed the template definitions above.
-#if defined(_MIPS_SIM) && defined(_ABIO32)
-  #include "sanitizer_atomic_clang_mips.h"
+#if defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32
+#  include "sanitizer_atomic_clang_mips.h"
 #endif
 
 #undef ATOMIC_ORDER


        


More information about the llvm-commits mailing list