From 4011ff535e28e5641074380acffff3378a460dac Mon Sep 17 00:00:00 2001 From: Romain Naour Date: Sun, 29 May 2022 15:18:04 +0200 Subject: [PATCH] package/gcc: disable libsanitizer for mips{el} and gcc > 12 Since [1], gcc contains a workaround for struct_kernel_stat_sz definition and apply a local patch when updating libsanitizer with upstream (llvm-project) [2]. Since gcc 12, the workaround is not enough and trigger the following error: In file included from ../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:21: ../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:75:38: error: static assertion failed 75 | COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat)); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ Disable libsanitizer for now. Note: Only glibc toolchains are affected since libsanitizer is disabled for musl and uClibc-ng toolchains [3]. Fixes: https://gitlab.com/kubu93/toolchains-builder/-/jobs/2510178606 [1] http://gcc.gnu.org/ml/gcc/2018-03/msg00133.html [2] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9f943b2446f2d0a345bbf9b4be3d3a4316372270 [3] https://git.buildroot.net/buildroot/commit/?id=5f4d658d888b539de9a6247ae5b1a0999de5d4ec Signed-off-by: Romain Naour Signed-off-by: Thomas Petazzoni --- package/gcc/gcc.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk index 3719bfb004..114e774503 100644 --- a/package/gcc/gcc.mk +++ b/package/gcc/gcc.mk @@ -142,6 +142,12 @@ ifeq ($(BR2_mips64)$(BR2_mips64el):$(BR2_MIPS_NABI32),y:y) HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer endif +# libsanitizer bundled in gcc 12 fails to build for mips32 due to +# mixing kernel and user struct stat. +ifeq ($(BR2_mips)$(BR2_mipsel):$(BR2_TOOLCHAIN_GCC_AT_LEAST_12),y:y) +HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer +endif + # The logic in libbacktrace/configure.ac to detect if __sync builtins # are available assumes they are as soon as target_subdir is not # empty, i.e when cross-compiling. However, some platforms do not have