From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 277493851A87 for ; Tue, 13 Sep 2022 12:59:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 277493851A87 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 75D9B300089; Tue, 13 Sep 2022 12:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1663073989; bh=cdV1LY1sVEa3P+FEUabzFj43kcWgEjC8uhSA/rOP0PE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=MN7K1RaE00dpcoBPFeECmaeXcafNLhRGlHvm3hvP4OLsrRLTFBRbWbl5hj/tej47Q 8MkdTAcy+7Yh9MPD5sWfu49j7ualR/d14XHkrtAxTGQYPaA6W3wfvuuJUH2ahP1gIe QXsbhrd0XwumG9st+S+EQWcZZOB0DPZ1T2ahXZqs= From: Tsukasa OI To: Tsukasa OI , Nick Clifton , Jan Beulich Cc: binutils@sourceware.org Subject: [PATCH 1/1] bfd: Stop using -Wstack-usage=262144 when built with Clang Date: Tue, 13 Sep 2022 12:59:36 +0000 Message-Id: <9edb72a280d3be93753afd29cfc2084d8a27fc14.1663073944.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. --- bfd/configure | 18 ++++++++++++++++++ bfd/warning.m4 | 6 ++++-- binutils/configure | 18 ++++++++++++++++++ gas/configure | 18 ++++++++++++++++++ gold/configure | 18 ++++++++++++++++++ gprof/configure | 18 ++++++++++++++++++ ld/configure | 18 ++++++++++++++++++ opcodes/configure | 18 ++++++++++++++++++ 8 files changed, 130 insertions(+), 2 deletions(-) diff --git a/bfd/configure b/bfd/configure index 6afdce94fe8..075d2ee0a1b 100755 --- a/bfd/configure +++ b/bfd/configure @@ -12093,10 +12093,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="" @@ -12138,10 +12147,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 : diff --git a/bfd/warning.m4 b/bfd/warning.m4 index 6f3e190b81c..0435c664472 100644 --- a/bfd/warning.m4 +++ b/bfd/warning.m4 @@ -50,7 +50,8 @@ GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" AC_EGREP_CPP([(^[0-3]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow") # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -AC_EGREP_CPP([(^[0-4]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144") +AC_EGREP_CPP([(^[0-4]$|^__GNUC__$)],[__GNUC__],,dnl +[AC_EGREP_CPP([^__clang__$],[__clang__],[GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"],)]) # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -62,7 +63,8 @@ AC_EGREP_CPP([(^[0-3]$|^__GNUC__$)],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-stri AC_EGREP_CPP_FOR_BUILD([(^[0-3]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow") # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -AC_EGREP_CPP_FOR_BUILD([(^[0-4]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144") +AC_EGREP_CPP_FOR_BUILD([(^[0-4]$|^__GNUC__$)],[__GNUC__],,dnl +[AC_EGREP_CPP_FOR_BUILD([^__clang__$],[__clang__],[GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"],)]) AC_ARG_ENABLE(werror, [ --enable-werror treat compile warnings as errors], diff --git a/binutils/configure b/binutils/configure index 542c832be18..1c518227f57 100755 --- a/binutils/configure +++ b/binutils/configure @@ -11932,10 +11932,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="" @@ -11977,10 +11986,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 : diff --git a/gas/configure b/gas/configure index 97bcf62ec3d..d0449a1d7ab 100755 --- a/gas/configure +++ b/gas/configure @@ -11588,10 +11588,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="" @@ -11633,10 +11642,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 : diff --git a/gold/configure b/gold/configure index 84c413fecd2..85f62a92fcd 100755 --- a/gold/configure +++ b/gold/configure @@ -7938,10 +7938,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="" @@ -7983,10 +7992,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 : diff --git a/gprof/configure b/gprof/configure index b4001641d2d..cb150353050 100755 --- a/gprof/configure +++ b/gprof/configure @@ -11890,10 +11890,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="" @@ -11935,10 +11944,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 : diff --git a/ld/configure b/ld/configure index 1c2b64870b1..a1a07005400 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 : diff --git a/opcodes/configure b/opcodes/configure index a5951b9b362..08c57a33855 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -11445,10 +11445,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="" @@ -11490,10 +11499,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 : -- 2.34.1