Allow libsanitizer on architectures that support it

libsanitizer is only supported on selected architectures. Add
ARCH_SUPPORTS_LIBSANITIZER and have architectures select this option
based on the list of supported configurations from GCC's
libsanitizer/configure.tgt. Support for mips64 was added in GCC12 so
this is an additional condition for the mips architecture.

Fixes #1733

Signed-off-by: Chris Packham <judge.packham@gmail.com>
This commit is contained in:
Chris Packham 2022-06-30 21:15:25 +12:00
parent bcb053baf6
commit f5e0d33ab4
10 changed files with 25 additions and 7 deletions

View File

@ -16,6 +16,7 @@
## select ARCH_SUPPORTS_WITH_FLOAT if ARCH_32 && !MULTILIB
## select ARCH_SUPPORTS_WITH_FPU if ARCH_32 && !MULTILIB
## select ARCH_SUPPORTS_SOFTFP if ARCH_32 && !MULTILIB
## select ARCH_SUPPORTS_LIBSANITIZER
## select LINUX_REQUIRE_3_7_or_later if ARCH_64 && KERNEL_LINUX
## help The ARM architecture, as defined by:

View File

@ -10,6 +10,7 @@
## select ARCH_SUPPORTS_WITH_ARCH
## select ARCH_SUPPORTS_WITH_TUNE
## select ARCH_SUPPORTS_WITH_FLOAT
## select ARCH_SUPPORTS_LIBSANITIZER if (!ARCH_64 || GCC_12_or_later)
## help The MIPS architecture, as defined by:
## help http://www.mips.com/

View File

@ -12,6 +12,7 @@
## select ARCH_SUPPORTS_WITH_TUNE
## select ARCH_SUPPORTS_WITH_FLOAT
## select ARCH_SUPPORTS_WITH_32_64
## select ARCH_SUPPORTS_LIBSANITIZER
##
## help The PowerPC architecture, as defined by:
## help http://www.ibm.com/developerworks/eserver/articles/archguide.html

View File

@ -10,6 +10,7 @@
## select ARCH_SUPPORTS_WITH_ABI
## select ARCH_SUPPORTS_WITH_ARCH
## select ARCH_SUPPORTS_WITH_TUNE
## select ARCH_SUPPORTS_LIBSANITIZER if ARCH_64
## select GCC_REQUIRE_7_or_later
## select BINUTILS_REQUIRE_2_28_or_later
## select GDB_REQUIRE_8_0_or_later if DEBUG_GDB

View File

@ -6,6 +6,7 @@
## select ARCH_DEFAULT_32
## select ARCH_USE_MMU
## select ARCH_SUPPORTS_WITH_FPU
## select ARCH_SUPPORTS_LIBSANITIZER
##
## help Defined by IBM in:
## help 32-bit ESA/390 : http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/dz9ar008/CCONTENTS

View File

@ -11,6 +11,7 @@
## select ARCH_SUPPORTS_WITH_TUNE
## select ARCH_SUPPORTS_WITH_FLOAT
## select ARCH_SUPPORTS_WITH_32_64 if GCC_6_or_later
## select ARCH_SUPPORTS_LIBSANITIZER
##
## help The SUN SPARC architecture, as defined by:
## help 32 bit: http://www.sparc.org/standards/V8.pdf

View File

@ -9,6 +9,7 @@
## select ARCH_SUPPORTS_WITH_CPU
## select ARCH_SUPPORTS_WITH_TUNE
## select ARCH_SUPPORTS_WITH_32_64
## select ARCH_SUPPORTS_LIBSANITIZER if ARCH_64
##
## help The x86 architecture, as defined by:
## help 32-bit (ia32) : http://www.intel.com/

View File

@ -258,17 +258,24 @@ config CC_GCC_LIBQUADMATH
The default is 'N'. Say 'Y' if you need it, and report success/failure.
config CC_GCC_LIBSANITIZER
bool
tristate
prompt "Compile libsanitizer"
depends on THREADS_NATIVE
depends on !LIBC_UCLIBC_NG && !LIBC_MUSL # Currently lacks required headers (like netrom.h)
depends on ARCH_SUPPORTS_LIBSANITIZER
help
libsanitizer is a library which provides run-time sanitising of either
or both of:
- memory access patterns (out-of-bonds, use-after-free)
- racy data accesses (in multi-threaded programs)
The default is 'N'. Say 'Y' if you need it, and report success/failure.
Option | libsanitizer | Associated ./configure switch
---------+--------------------+--------------------------------
Y | forcibly used | --enable-libsanitizer
M | auto | (none, ./configure decides)
N | forcibly not used | --disable-libsanitizer
The default is 'N'. Say 'Y' or 'M' if you need it, and report success/failure.
config CC_GCC_LIBMPX
bool

View File

@ -111,6 +111,10 @@ config ARCH_USE_MMU
config ARCH_SUPPORTS_FLAT_FORMAT
bool
#--------------------------------------
config ARCH_SUPPORTS_LIBSANITIZER
bool
#--------------------------------------
config ARCH_SUPPORTS_EITHER_ENDIAN
bool

View File

@ -1004,11 +1004,11 @@ do_gcc_backend() {
extra_config+=(--disable-libquadmath-support)
fi
if [ "${CT_CC_GCC_LIBSANITIZER}" = "y" ]; then
extra_config+=(--enable-libsanitizer)
else
extra_config+=(--disable-libsanitizer)
fi
case "${CT_CC_GCC_LIBSANITIZER}" in
y) extra_config+=(--enable-libsanitizer);;
m) ;;
"") extra_config+=(--disable-libsanitizer);;
esac
if [ "${CT_CC_GCC_HAS_LIBMPX}" = "y" ]; then
if [ "${CT_CC_GCC_LIBMPX}" = "y" ]; then