Module Name:    src
Committed By:   rin
Date:           Tue Jul  2 02:36:22 UTC 2024

Modified Files:
        src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
            sanitizer_atomic_clang.h
        src/external/gpl3/gcc/lib: Makefile.sanitizer

Log Message:
gcc: lib*san: Enable built-in 64-bit atomic ops for !__HAVE_ATOMIC64_OPS

as already done for some mips platforms by upstream.

Now, libubsan (as well as libasan if platform itself is supported)
work on some ILP32 platforms.

Fix PR port-sparc/58352.

This may be slower than another possible fix where all 64-bit atomic
variables are replaced by 32-bit ones. But, it should still be better
than having relatively large diffs to upstream; sanitizers are not
enabled for normal use, anyway.

XXX
Note that filename confusion in upstream codes:
- "sanitizer_atomic_clang.h" is used also for GCC.
- "sanitizer_atomic_clang_mips.h" has no mips specific codes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h
cvs rdiff -u -r1.18 -r1.19 src/external/gpl3/gcc/lib/Makefile.sanitizer

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h:1.4 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h:1.5
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h:1.4	Mon Jul 31 01:44:56 2023
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_atomic_clang.h	Tue Jul  2 02:36:22 2024
@@ -94,11 +94,17 @@ inline bool atomic_compare_exchange_weak
 }  // namespace __sanitizer
 
 // This include provides explicit template instantiations for atomic_uint64_t
-// on MIPS32, which does not directly support 8 byte atomics. It has to
+// on platforms, which do not directly support 8 byte atomics. It has to
 // proceed the template definitions above.
 #if defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32
 #  include "sanitizer_atomic_clang_mips.h"
 #endif
+#if SANITIZER_NETBSD
+#  include <machine/types.h>
+#  ifndef __HAVE_ATOMIC64_OPS
+#    include "sanitizer_atomic_clang_mips.h"
+#  endif
+#endif
 
 #undef ATOMIC_ORDER
 

Index: src/external/gpl3/gcc/lib/Makefile.sanitizer
diff -u src/external/gpl3/gcc/lib/Makefile.sanitizer:1.18 src/external/gpl3/gcc/lib/Makefile.sanitizer:1.19
--- src/external/gpl3/gcc/lib/Makefile.sanitizer:1.18	Sun Feb 25 06:07:28 2024
+++ src/external/gpl3/gcc/lib/Makefile.sanitizer	Tue Jul  2 02:36:22 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sanitizer,v 1.18 2024/02/25 06:07:28 mrg Exp $
+#	$NetBSD: Makefile.sanitizer,v 1.19 2024/07/02 02:36:22 rin Exp $
 
 SANITIZER=${GCCDIST}/libsanitizer
 .PATH: ${SANITIZER}/interception ${SANITIZER}/sanitizer_common
@@ -123,13 +123,3 @@ COPTS.sanitizer_symbolizer_report.cc += 
 COPTS.ubsan_diag.cc += -O1
 COPTS.ubsan_init.cc += -O1
 .endif
-
-# XXX GCC 12 sanitizers has higher minimal requirements upon some CPUs.
-# - 32-bit SPARC needs v8 to supply eg __sync_add_and_fetch_4
-# - i386 needs i586 for __sync_val_compare_and_swap_8.
-.if ${MACHINE_ARCH} == "sparc"
-COPTS+= -mcpu=v8
-.endif
-.if ${MACHINE_ARCH} == "i386"
-COPTS+= -march=i586
-.endif

Reply via email to