From patchwork Thu Sep 22 11:10:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 57893 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 625373857431 for ; Thu, 22 Sep 2022 11:11:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 61D073858029 for ; Thu, 22 Sep 2022 11:10:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 61D073858029 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 48D5B21A3F; Thu, 22 Sep 2022 11:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1663845047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=u1C0+c+oz+f3aIwXg2dzeQ+mG8JDj4bNKSxLItNeQMA=; b=GOnv5kE75nJENhtYbBJREbAd5MZ8aLevkgISFdHzniLrlW+n/1T1/2EuFmf3tZi/HlKOjQ pdsPCWCdtrj08GymQMJMSppRVBxON2YcD7M+k4rPxh9A7QDL7QtdJ2OfbM/1mB1myfQb3T v7uoGPxo6Y2Q4mdFszkUzi7aQlg3LHo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1663845047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=u1C0+c+oz+f3aIwXg2dzeQ+mG8JDj4bNKSxLItNeQMA=; b=MA++ccTKEBqsjUj71xIiRlw40EkyieD8lYM2nPIOU6VTBGi2N6X6rKYO1iIZwEmrXS1MRx nHt6YIWVYehQULCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2337013AA5; Thu, 22 Sep 2022 11:10:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id pyZoB7dCLGMmMgAAMHmgww (envelope-from ); Thu, 22 Sep 2022 11:10:47 +0000 Message-ID: <5e5b1311-2db1-656f-d9de-c180224802ac@suse.cz> Date: Thu, 22 Sep 2022 13:10:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: [PATCH] remove -gz=zlib-gnu option value To: Richard Biener References: <20220701065725.3839926-1-maskray@google.com> <20220701072057.f2ojdm4pdm5257ni@google.com> <6cfedac0-06b5-47d9-e2f8-0cc5b8c19244@suse.cz> Content-Language: en-US From: =?utf-8?q?Martin_Li=C5=A1ka?= In-Reply-To: X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fangrui Song , GCC Patches Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" On 9/21/22 11:35, Richard Biener wrote: > On Wed, Sep 21, 2022 at 9:49 AM Martin Liška wrote: >> >> On 9/21/22 09:36, Richard Biener wrote: >>> If it's all configure time what's the point in >>> "deprecating" it? >> >> Note it's one of our options -gz where 'zlib-gnu' is one of the possible option values. > > I see. Not sure if deprecating is really necessary, you need to keep > recognizing > zlib-gnu as no-op anyway. So I'd just go ahead and remove support for it. Hi. I'm sending patch that makes it no-op and simplifies more the configure.ac detection. Tested with both ld.bfd and mold: $ ./xgcc -B. ~/Programming/testcases/a.c -c -gz=zlib --save-temps --verbose 2>&1 | grep =zlib | grep -v COLLECT_GCC_OPTIONS ./cc1 -fpreprocessed a.i -quiet -dumpbase a.c -dumpbase-ext .c -mtune=generic -march=x86-64 -gz=zlib -version -o a.s ./as -v --compress-debug-sections=zlib --64 -o a.o a.s $ ./xgcc -B. ~/Programming/testcases/a.c -c -gz=zlib-gnu --save-temps --verbose 2>&1 | grep =zlib | grep -v COLLECT_GCC_OPTIONS ./cc1 -fpreprocessed a.i -quiet -dumpbase a.c -dumpbase-ext .c -mtune=generic -march=x86-64 -gz=zlib-gnu -version -o a.s Ready after it finishes tests? Thanks, Martin > >> Martin From 979ab57b853cee002d29d1ac9199021a1866e4fb Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 22 Sep 2022 13:04:57 +0200 Subject: [PATCH] remove -gz=zlib-gnu option value The option value is legacy and probably not used at all, thus ignore it. gcc/ChangeLog: * configure: Regenerate. * configure.ac: Simplify to gcc_cv_ld_compress_debug={0,1} and gcc_cv_as_compress_debug={0,1}. * doc/invoke.texi: Document the removal. * gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Simplify and ignore zlib-gnu. (ASM_COMPRESS_DEBUG_SPEC): Likewise. Co-Authored-By: Fangrui Song --- gcc/configure | 39 +++++++++------------------------------ gcc/configure.ac | 39 +++++++++------------------------------ gcc/doc/invoke.texi | 11 +++++------ gcc/gcc.cc | 26 +++++--------------------- 4 files changed, 28 insertions(+), 87 deletions(-) diff --git a/gcc/configure b/gcc/configure index 817d765568e..3cea801d5a7 100755 --- a/gcc/configure +++ b/gcc/configure @@ -29727,16 +29727,9 @@ else if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null then gcc_cv_as_compress_debug=0 - # Since binutils 2.26, gas supports --compress-debug-sections=type, + # Since binutils 2.26, gas supports --compress-debug-sections=zlib, # defaulting to the ELF gABI format. - elif $gcc_cv_as --compress-debug-sections=zlib-gnu -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_compress_debug=2 - gcc_cv_as_compress_debug_option="--compress-debug-sections" - gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections" - # Before binutils 2.26, gas only supported --compress-debug-options and - # emitted the traditional GNU format. - elif $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s > /dev/null 2>&1 + elif $gcc_cv_as --compress-debug-sections=zlib -o conftest.o conftest.s > /dev/null 2>&1 then gcc_cv_as_compress_debug=1 gcc_cv_as_compress_debug_option="--compress-debug-sections" @@ -30254,40 +30247,26 @@ $as_echo "$gcc_cv_ld_eh_gc_sections_bug" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker for compressed debug sections" >&5 $as_echo_n "checking linker for compressed debug sections... " >&6; } -# gold/gld support compressed debug sections since binutils 2.19/2.21 -# In binutils 2.26, gld gained support for the ELF gABI format. +# GNU ld/gold support --compressed-debug-sections=zlib since binutils 2.26. if test $in_tree_ld = yes ; then gcc_cv_ld_compress_debug=0 if test $ld_is_mold = yes; then - gcc_cv_ld_compress_debug=3 - gcc_cv_ld_compress_debug_option="--compress-debug-sections" - elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 19 -o "$gcc_cv_gld_major_version" -gt 2 \ - && test $in_tree_ld_is_elf = yes && test $ld_is_gold = yes; then - gcc_cv_ld_compress_debug=2 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="--compress-debug-sections" elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 26 -o "$gcc_cv_gld_major_version" -gt 2 \ && test $in_tree_ld_is_elf = yes && test $ld_is_gold = no; then - gcc_cv_ld_compress_debug=3 - gcc_cv_ld_compress_debug_option="--compress-debug-sections" - elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2 \ - && test $in_tree_ld_is_elf = yes; then gcc_cv_ld_compress_debug=1 + gcc_cv_ld_compress_debug_option="--compress-debug-sections" fi elif echo "$ld_ver" | grep GNU > /dev/null; then if test $ld_is_mold = yes; then - gcc_cv_ld_compress_debug=3 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="--compress-debug-sections" elif test "$ld_vers_major" -lt 2 \ - || test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then + || test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then gcc_cv_ld_compress_debug=0 - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then - gcc_cv_ld_compress_debug=1 else - gcc_cv_ld_compress_debug=3 - gcc_cv_ld_compress_debug_option="--compress-debug-sections" - fi - if test $ld_is_gold = yes; then - gcc_cv_ld_compress_debug=2 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="--compress-debug-sections" fi else @@ -30295,7 +30274,7 @@ else *-*-solaris2*) # Introduced in Solaris 11.2. if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then - gcc_cv_ld_compress_debug=3 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="-z compress-sections" else gcc_cv_ld_compress_debug=0 diff --git a/gcc/configure.ac b/gcc/configure.ac index 59f205a1781..b9a39d62d30 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5732,16 +5732,9 @@ gcc_GAS_CHECK_FEATURE([compressed debug sections], if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null then gcc_cv_as_compress_debug=0 - # Since binutils 2.26, gas supports --compress-debug-sections=type, + # Since binutils 2.26, gas supports --compress-debug-sections=zlib, # defaulting to the ELF gABI format. - elif $gcc_cv_as --compress-debug-sections=zlib-gnu -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_compress_debug=2 - gcc_cv_as_compress_debug_option="--compress-debug-sections" - gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections" - # Before binutils 2.26, gas only supported --compress-debug-options and - # emitted the traditional GNU format. - elif $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s > /dev/null 2>&1 + elif $gcc_cv_as --compress-debug-sections=zlib -o conftest.o conftest.s > /dev/null 2>&1 then gcc_cv_as_compress_debug=1 gcc_cv_as_compress_debug_option="--compress-debug-sections" @@ -6130,40 +6123,26 @@ fi AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug) AC_MSG_CHECKING(linker for compressed debug sections) -# gold/gld support compressed debug sections since binutils 2.19/2.21 -# In binutils 2.26, gld gained support for the ELF gABI format. +# GNU ld/gold support --compressed-debug-sections=zlib since binutils 2.26. if test $in_tree_ld = yes ; then gcc_cv_ld_compress_debug=0 if test $ld_is_mold = yes; then - gcc_cv_ld_compress_debug=3 - gcc_cv_ld_compress_debug_option="--compress-debug-sections" - elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 19 -o "$gcc_cv_gld_major_version" -gt 2 \ - && test $in_tree_ld_is_elf = yes && test $ld_is_gold = yes; then - gcc_cv_ld_compress_debug=2 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="--compress-debug-sections" elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 26 -o "$gcc_cv_gld_major_version" -gt 2 \ && test $in_tree_ld_is_elf = yes && test $ld_is_gold = no; then - gcc_cv_ld_compress_debug=3 - gcc_cv_ld_compress_debug_option="--compress-debug-sections" - elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2 \ - && test $in_tree_ld_is_elf = yes; then gcc_cv_ld_compress_debug=1 + gcc_cv_ld_compress_debug_option="--compress-debug-sections" fi elif echo "$ld_ver" | grep GNU > /dev/null; then if test $ld_is_mold = yes; then - gcc_cv_ld_compress_debug=3 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="--compress-debug-sections" elif test "$ld_vers_major" -lt 2 \ - || test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then + || test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then gcc_cv_ld_compress_debug=0 - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then - gcc_cv_ld_compress_debug=1 else - gcc_cv_ld_compress_debug=3 - gcc_cv_ld_compress_debug_option="--compress-debug-sections" - fi - if test $ld_is_gold = yes; then - gcc_cv_ld_compress_debug=2 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="--compress-debug-sections" fi else @@ -6172,7 +6151,7 @@ changequote(,)dnl *-*-solaris2*) # Introduced in Solaris 11.2. if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; then - gcc_cv_ld_compress_debug=3 + gcc_cv_ld_compress_debug=1 gcc_cv_ld_compress_debug_option="-z compress-sections" else gcc_cv_ld_compress_debug=0 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index aa5655764a0..9fdcb5f60d9 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -11077,12 +11077,11 @@ location views are enabled. Produce compressed debug sections in DWARF format, if that is supported. If @var{type} is not given, the default type depends on the capabilities of the assembler and linker used. @var{type} may be one of -@samp{none} (don't compress debug sections), @samp{zlib} (use zlib -compression in ELF gABI format), or @samp{zlib-gnu} (use zlib -compression in traditional GNU format). If the linker doesn't support -writing compressed debug sections, the option is rejected. Otherwise, -if the assembler does not support them, @option{-gz} is silently ignored -when producing object files. +@samp{none} (don't compress debug sections), or @samp{zlib} (use zlib +compression in ELF gABI format). If the linker doesn't support writing +compressed debug sections, the option is rejected. Otherwise, if the +assembler does not support them, @option{-gz} is silently ignored when +producing object files. @item -femit-struct-debug-baseonly @opindex femit-struct-debug-baseonly diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 15846116795..7578988efa9 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -831,21 +831,11 @@ proper position among the other output files. */ #define LINK_COMPRESS_DEBUG_SPEC \ " %{gz*:%e-gz is not supported in this configuration} " #elif HAVE_LD_COMPRESS_DEBUG == 1 -/* GNU style on input, GNU ld options. Reject, not useful. */ -#define LINK_COMPRESS_DEBUG_SPEC \ - " %{gz*:%e-gz is not supported in this configuration} " -#elif HAVE_LD_COMPRESS_DEBUG == 2 -/* GNU style, GNU gold options. */ -#define LINK_COMPRESS_DEBUG_SPEC \ - " %{gz|gz=zlib-gnu:" LD_COMPRESS_DEBUG_OPTION "=zlib}" \ - " %{gz=none:" LD_COMPRESS_DEBUG_OPTION "=none}" \ - " %{gz=zlib:%e-gz=zlib is not supported in this configuration} " -#elif HAVE_LD_COMPRESS_DEBUG == 3 /* ELF gABI style. */ #define LINK_COMPRESS_DEBUG_SPEC \ " %{gz|gz=zlib:" LD_COMPRESS_DEBUG_OPTION "=zlib}" \ " %{gz=none:" LD_COMPRESS_DEBUG_OPTION "=none}" \ - " %{gz=zlib-gnu:" LD_COMPRESS_DEBUG_OPTION "=zlib-gnu} " + " %{gz=zlib-gnu:}" /* Ignore silently zlib-gnu option value. */ #else #error Unknown value for HAVE_LD_COMPRESS_DEBUG. #endif @@ -885,31 +875,25 @@ proper position among the other output files. */ #endif /* Assembler options for compressed debug sections. */ -#if HAVE_LD_COMPRESS_DEBUG < 2 +#if HAVE_LD_COMPRESS_DEBUG == 0 /* Reject if the linker cannot write compressed debug sections. */ #define ASM_COMPRESS_DEBUG_SPEC \ " %{gz*:%e-gz is not supported in this configuration} " -#else /* HAVE_LD_COMPRESS_DEBUG >= 2 */ +#else /* HAVE_LD_COMPRESS_DEBUG >= 1 */ #if HAVE_AS_COMPRESS_DEBUG == 0 /* No assembler support. Ignore silently. */ #define ASM_COMPRESS_DEBUG_SPEC \ " %{gz*:} " #elif HAVE_AS_COMPRESS_DEBUG == 1 -/* GNU style, GNU as options. */ -#define ASM_COMPRESS_DEBUG_SPEC \ - " %{gz|gz=zlib-gnu:" AS_COMPRESS_DEBUG_OPTION "}" \ - " %{gz=none:" AS_NO_COMPRESS_DEBUG_OPTION "}" \ - " %{gz=zlib:%e-gz=zlib is not supported in this configuration} " -#elif HAVE_AS_COMPRESS_DEBUG == 2 /* ELF gABI style. */ #define ASM_COMPRESS_DEBUG_SPEC \ " %{gz|gz=zlib:" AS_COMPRESS_DEBUG_OPTION "=zlib}" \ " %{gz=none:" AS_COMPRESS_DEBUG_OPTION "=none}" \ - " %{gz=zlib-gnu:" AS_COMPRESS_DEBUG_OPTION "=zlib-gnu} " + " %{gz=zlib-gnu:}" /* Ignore silently zlib-gnu option value. */ #else #error Unknown value for HAVE_AS_COMPRESS_DEBUG. #endif -#endif /* HAVE_LD_COMPRESS_DEBUG >= 2 */ +#endif /* HAVE_LD_COMPRESS_DEBUG >= 1 */ /* Define ASM_DEBUG_SPEC to be a spec suitable for translating '-g' to the assembler, when compiling assembly sources only. */ -- 2.37.3