From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 92C1F38560A9; Fri, 23 Sep 2022 14:32:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 92C1F38560A9 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 28NEWipA013263 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Sep 2022 10:32:48 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 28NEWipA013263 Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 0B6F91E0D3; Fri, 23 Sep 2022 10:32:44 -0400 (EDT) Message-ID: <7eadf897-9370-5a00-ae57-8e07251b8702@polymtl.ca> Date: Fri, 23 Sep 2022 10:32:43 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v3] binutils, gdb: support zstd compressed debug sections Content-Language: en-US To: Fangrui Song , Alan Modra , Jan Beulich , Nick Clifton Cc: binutils@sourceware.org, gdb-patches@sourceware.org References: <20220923040837.550160-1-maskray@google.com> From: Simon Marchi In-Reply-To: <20220923040837.550160-1-maskray@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 23 Sep 2022 14:32:44 +0000 X-Spam-Status: No, score=-3032.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2022 14:32:55 -0000 On 2022-09-23 00:08, Fangrui Song wrote: > PR29397 PR29563: The new configure option --with-zstd defaults to auto. > If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support zstd > compressed debug sections for most tools. > > * bfd: for addr2line, objdump --dwarf, gdb, etc > * gas: support --compress-debug-sections=zstd > * ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd > * objcopy: support ELFCOMPRESS_ZSTD input for > --decompress-debug-sections and --compress-debug-sections=zstd > * gdb: support ELFCOMPRESS_ZSTD input. The bfd change references zstd > symbols, so gdb has to link against -lzstd in this patch. > > If zstd is not supported, ELFCOMPRESS_ZSTD input triggers an error. We > can avoid HAVE_ZSTD if binutils-gdb imports zstd/ like zlib/, but this > is too heavyweight, so don't do it for now. > > ``` > % ld/ld-new a.o > ld/ld-new: a.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support > ... > > % ld/ld-new a.o --compress-debug-sections=zstd > ld/ld-new: --compress-debug-sections=zstd: ld is not built with zstd support > > % binutils/objcopy --compress-debug-sections=zstd a.o b.o > binutils/objcopy: --compress-debug-sections=zstd: binutils is not built with zstd support > > % binutils/objcopy b.o --decompress-debug-sections > binutils/objcopy: zstd.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support > ... > ``` > --- > Changes from v1: > * use PKG_CHECK_MODULES to check libzstd.pc > > Changes from v2: > * Improve PKG_CHECK_MODULES, autoreconf -vf > * objcopy: check --compress-debug-sections=zstd in a !HAVE_ZSTD build Just one question: you moved PKG_PROG_PKG_CONFIG up in ld/configure.ac, which I think is ok. But what about the other configure.ac files, don't they need PKG_PROG_PKG_CONFIG too? gdb/configure.ac, for instance, uses pkg-config for debuginfod. So if the user passes --without-debuginfod --with-zstd, I expect things to fail, as the pkg-config will be skipped. binutils/configure.ac probably has the same problem, since it uses PKG_CHECK_MODULES for msgpack. I would suggest using PKG_PROG_PKG_CONFIG at the top of all configure.ac that use AM_ZSTD, out of precaution. Simon