Re: Compile problems w/gcc 9.4.0 in linux-next

From: Ingo Molnar
Date: Fri Mar 21 2025 - 03:37:26 EST



* Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:

> > Interestingly, if DYNAMIC_BMI2 in
> > lib/zstd/common/portability_macros.h is changed on line 61 to
> > always be defined as 0, the compile problem in huf_compress.c goes
> > away.
>
> Without having looked at the crashing code, I suspect that the only
> meaningful course of action here is to tweak the conditional logic
> that defines DYNAMIC_BMI2 to only enable it for GCC >= 10.1 (assuming
> those are unaffected) In any case, GCC 9.4 is not going to get fixed
> in the field, so even if this gets fixed on the GCC side, we will
> have to deal with it here.

Apparently all GCC < 11.0 versions are crashing.

Would something like the fix below work?

Thanks,

Ingo

===============>

lib/zstd/common/portability_macros.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/zstd/common/portability_macros.h b/lib/zstd/common/portability_macros.h
index 0e3b2c0a527d..0dde8bf56595 100644
--- a/lib/zstd/common/portability_macros.h
+++ b/lib/zstd/common/portability_macros.h
@@ -55,7 +55,7 @@
#ifndef DYNAMIC_BMI2
#if ((defined(__clang__) && __has_attribute(__target__)) \
|| (defined(__GNUC__) \
- && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
+ && (__GNUC__ >= 11))) \
&& (defined(__x86_64__) || defined(_M_X64)) \
&& !defined(__BMI2__)
# define DYNAMIC_BMI2 1