From 491cf3178f718e48d71a54e50475e37dd831a51d Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Sat, 10 Sep 2022 17:08:13 +0000 Subject: bfd: Stop using -Wstack-usage=262144 when built with Clang Some components of GNU Binutils will pass "-Wstack-usage=262144" when "GCC >= 5.0" is detected. However, Clang does not support "-Wstack-usage", despite that related configuration part in bfd/warning.m4 handles the latest Clang (15.0.0 as of this writing) as "GCC >= 5.0". The option "-Wstack-usage" was ignored when the first version of Clang is released but even this "ignoring" behavior is removed before Clang 4.0.0. So, if we give Clang "-Wstack-usage=262144", it generates a warning, making the build failure. This commit checks "__clang__" macro to prevent adding the option if the compiler is identified as Clang. bfd/ChangeLog: * warning.m4: Stop appending "-Wstack-usage=262144" option when compiled with Clang. * configure: Regenerate. binutils/ChangeLog: * configure: Regenerate. gas/ChangeLog: * configure: Regenerate. gold/ChangeLog: * configure: Regenerate. gprof/ChangeLog: * configure: Regenerate. ld/ChangeLog: * configure: Regenerate. opcodes/ChangeLog: * configure: Regenerate. --- ld/configure | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ld') diff --git a/ld/configure b/ld/configure index 1c2b648..a1a0700 100755 --- a/ld/configure +++ b/ld/configure @@ -15855,10 +15855,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__clang__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^__clang__$" >/dev/null 2>&1; then : GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" fi rm -f conftest* +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -15900,10 +15909,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__clang__ +_ACEOF +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | + $EGREP "^__clang__$" >/dev/null 2>&1; then : GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144" fi rm -f conftest* +fi +rm -f conftest* + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : -- cgit v1.1