From: Richard Biener <richard.guenther@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] support -gz=zstd for both linker and assembler
Date: Wed, 28 Sep 2022 21:21:52 +0200 [thread overview]
Message-ID: <CAFiYyc1Rt2vOkbxPWrKafE+_-H7R=KY008XN45dAtajAqxwoBA@mail.gmail.com> (raw)
In-Reply-To: <371a05eb-ea48-9626-8375-ce100706c617@suse.cz>
On Tue, Sep 27, 2022 at 3:54 PM Martin Liška <mliska@suse.cz> wrote:
>
> PING^1
OK
Thanks,
Richard.
> On 9/22/22 14:51, Martin Liška wrote:
> > Hi.
> >
> > Tested with Fangrui's patch set sent to binutils ML and mold linker.
> >
> > $ gcc -g -gz=zstd a.c --save-temps --verbose 2>&1 | grep debug-sections
> > /home/marxin/Programming/binutils/objdir/gas/as-new -v --gdwarf-5 --compress-debug-sections=zstd --64 -o a.o a.s
> > /home/marxin/bin/gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/collect2 -plugin /home/marxin/bin/gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/liblto_plugin.so -plugin-opt=/home/marxin/bin/gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper -plugin-opt=-fresolution=a.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 --compress-debug-sections=zstd /lib/../lib64/crt1.o /lib/../lib64/crti.o /home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/13.0.0/crtbegin.o -L/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/13.0.0 -L/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/13.0.0/../../.. a.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/13.0.0/crtend.o /lib/../lib64/crtn.o
> >
> > $ gdb a.out
> > ...
> > BFD: /home/marxin/Programming/testcases/a.out: unable to initialize decompress status for section .debug_abbrev
> > BFD: /home/marxin/Programming/testcases/a.out: unable to initialize decompress status for section .debug_abbrev
> > "/home/marxin/Programming/testcases/a.out": not in executable format: file format not recognized
> >
> > So it's really compressed with zstd. I'm going to write ChangeLog entry for zlib-gnu once this gets merged as well.
> >
> > Ready to be installed?
> > Thanks,
> > Martin
> >
> > PR driver/106897
> >
> > gcc/ChangeLog:
> >
> > * common.opt: Add -gz=zstd value.
> > * configure.ac: Detect --compress-debug-sections=zstd
> > for both linker and assembler.
> > * configure: Regenerate.
> > * gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Handle -gz=zstd.
> > (ASM_COMPRESS_DEBUG_SPEC): Likewise.
> > ---
> > gcc/common.opt | 5 ++++-
> > gcc/configure | 11 +++++++++--
> > gcc/configure.ac | 11 +++++++++--
> > gcc/gcc.cc | 15 +++++++++++++++
> > 4 files changed, 37 insertions(+), 5 deletions(-)
> >
> > diff --git a/gcc/common.opt b/gcc/common.opt
> > index 06ef768ab78..68370db816b 100644
> > --- a/gcc/common.opt
> > +++ b/gcc/common.opt
> > @@ -3419,7 +3419,10 @@ EnumValue
> > Enum(compressed_debug_sections) String(zlib) Value(1)
> >
> > EnumValue
> > -Enum(compressed_debug_sections) String(zlib-gnu) Value(2)
> > +Enum(compressed_debug_sections) String(zstd) Value(2)
> > +
> > +EnumValue
> > +Enum(compressed_debug_sections) String(zlib-gnu) Value(3)
> >
> > gz
> > Common Driver
> > diff --git a/gcc/configure b/gcc/configure
> > index 70a013e9a30..ce4e1859e1f 100755
> > --- a/gcc/configure
> > +++ b/gcc/configure
> > @@ -29727,13 +29727,16 @@ 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=zlib,
> > - # defaulting to the ELF gABI format.
> > 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"
> > gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections"
> > + # Since binutils 2.40, gas supports --compress-debug-sections=zstd.
> > + if $gcc_cv_as --compress-debug-sections=zstd -o conftest.o conftest.s > /dev/null 2>&1
> > + then
> > + gcc_cv_as_compress_debug=2
> > + fi
> > else
> > gcc_cv_as_compress_debug=0
> > fi
> > @@ -30251,6 +30254,10 @@ $as_echo_n "checking linker for compressed debug sections... " >&6; }
> > if $gcc_cv_ld --help 2>&1 | grep -- '--compress-debug-sections.*\<zlib-gabi\>' > /dev/null; then
> > gcc_cv_ld_compress_debug=1
> > gcc_cv_ld_compress_debug_option="--compress-debug-sections"
> > + # Detect zstd debug section compression support
> > + if $gcc_cv_ld --help 2>&1 | grep -- '--compress-debug-sections.*\<zstd\>' > /dev/null; then
> > + gcc_cv_ld_compress_debug=2
> > + fi
> > else
> > case "${target}" in
> > *-*-solaris2*)
> > diff --git a/gcc/configure.ac b/gcc/configure.ac
> > index 96e10d7c194..b6bafa8b7d6 100644
> > --- a/gcc/configure.ac
> > +++ b/gcc/configure.ac
> > @@ -5732,13 +5732,16 @@ 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=zlib,
> > - # defaulting to the ELF gABI format.
> > 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"
> > gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections"
> > + # Since binutils 2.40, gas supports --compress-debug-sections=zstd.
> > + if $gcc_cv_as --compress-debug-sections=zstd -o conftest.o conftest.s > /dev/null 2>&1
> > + then
> > + gcc_cv_as_compress_debug=2
> > + fi
> > else
> > gcc_cv_as_compress_debug=0
> > fi])
> > @@ -6127,6 +6130,10 @@ AC_MSG_CHECKING(linker for compressed debug sections)
> > if $gcc_cv_ld --help 2>&1 | grep -- '--compress-debug-sections.*\<zlib-gabi\>' > /dev/null; then
> > gcc_cv_ld_compress_debug=1
> > gcc_cv_ld_compress_debug_option="--compress-debug-sections"
> > + # Detect zstd debug section compression support
> > + if $gcc_cv_ld --help 2>&1 | grep -- '--compress-debug-sections.*\<zstd\>' > /dev/null; then
> > + gcc_cv_ld_compress_debug=2
> > + fi
> > else
> > changequote(,)dnl
> > case "${target}" in
> > diff --git a/gcc/gcc.cc b/gcc/gcc.cc
> > index 7578988efa9..2ffbbc0bf2a 100644
> > --- a/gcc/gcc.cc
> > +++ b/gcc/gcc.cc
> > @@ -835,6 +835,14 @@ proper position among the other output files. */
> > #define LINK_COMPRESS_DEBUG_SPEC \
> > " %{gz|gz=zlib:" LD_COMPRESS_DEBUG_OPTION "=zlib}" \
> > " %{gz=none:" LD_COMPRESS_DEBUG_OPTION "=none}" \
> > + " %{gz*:%e-gz=zstd is not supported in this configuration} " \
> > + " %{gz=zlib-gnu:}" /* Ignore silently zlib-gnu option value. */
> > +#elif HAVE_LD_COMPRESS_DEBUG == 2
> > +/* ELF gABI style and ZSTD. */
> > +#define LINK_COMPRESS_DEBUG_SPEC \
> > + " %{gz|gz=zlib:" LD_COMPRESS_DEBUG_OPTION "=zlib}" \
> > + " %{gz=none:" LD_COMPRESS_DEBUG_OPTION "=none}" \
> > + " %{gz=zstd:" LD_COMPRESS_DEBUG_OPTION "=zstd}" \
> > " %{gz=zlib-gnu:}" /* Ignore silently zlib-gnu option value. */
> > #else
> > #error Unknown value for HAVE_LD_COMPRESS_DEBUG.
> > @@ -890,6 +898,13 @@ proper position among the other output files. */
> > " %{gz|gz=zlib:" AS_COMPRESS_DEBUG_OPTION "=zlib}" \
> > " %{gz=none:" AS_COMPRESS_DEBUG_OPTION "=none}" \
> > " %{gz=zlib-gnu:}" /* Ignore silently zlib-gnu option value. */
> > +#elif HAVE_AS_COMPRESS_DEBUG == 2
> > +/* ELF gABI style and ZSTD. */
> > +#define ASM_COMPRESS_DEBUG_SPEC \
> > + " %{gz|gz=zlib:" AS_COMPRESS_DEBUG_OPTION "=zlib}" \
> > + " %{gz=none:" AS_COMPRESS_DEBUG_OPTION "=none}" \
> > + " %{gz=zstd:" AS_COMPRESS_DEBUG_OPTION "=zstd}" \
> > + " %{gz=zlib-gnu:}" /* Ignore silently zlib-gnu option value. */
> > #else
> > #error Unknown value for HAVE_AS_COMPRESS_DEBUG.
> > #endif
>
prev parent reply other threads:[~2022-09-28 19:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-01 6:57 [PATCH] Remove legacy -gz=zlib-gnu Fangrui Song
2022-07-01 7:03 ` Andrew Pinski
2022-07-01 7:20 ` Fangrui Song
2022-09-20 12:55 ` Martin Liška
2022-09-21 7:36 ` Richard Biener
2022-09-21 7:45 ` Fangrui Song
2022-09-21 7:49 ` Martin Liška
2022-09-21 9:35 ` Richard Biener
2022-09-22 11:10 ` [PATCH] remove -gz=zlib-gnu option value Martin Liška
2022-09-22 12:26 ` [PATCH v2] " Martin Liška
2022-09-22 12:35 ` Richard Biener
2022-09-22 12:51 ` [PATCH] support -gz=zstd for both linker and assembler Martin Liška
2022-09-27 13:54 ` Martin Liška
2022-09-28 19:21 ` Richard Biener [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFiYyc1Rt2vOkbxPWrKafE+_-H7R=KY008XN45dAtajAqxwoBA@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).