From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 50021384E3A5 for ; Fri, 25 Nov 2022 17:27:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 50021384E3A5 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 5072E30008BB; Fri, 25 Nov 2022 18:27:01 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 6D863403B9C9; Fri, 25 Nov 2022 18:27:00 +0100 (CET) Message-ID: Subject: Re: [PATCH] readelf: print warning for -sW From: Mark Wielaard To: Martin =?UTF-8?Q?Li=C5=A1ka?= , elfutils-devel@sourceware.org Date: Fri, 25 Nov 2022 18:27:00 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-3038.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,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 List-Id: Hi Marin, On Fri, 2022-11-25 at 14:29 +0100, Martin Li=C5=A1ka wrote: > The option -s accepts in elfutils (compared to binutils) a positional > argument that is name of a symbol table section which should be > printed. >=20 > Thus, print a reasonable warning if -sW is used: > ./src/readelf -sW a.out > WARNING: cannot find section: 'W' >=20 > Ready for master? Looks good. But one nitpick below. > src/ChangeLog: >=20 > * readelf.c (print_symtab): Change signature and return true if > something is printed. > (process_elf_file): Use it and print warning. Aha, we are processing the symbol sections twice, once for=20 SHT_DYNSYM, then for SHT_SYMTAB. And the named section should be one or the other. Good. > tests/ChangeLog: >=20 > * run-readelf-s.sh: Test -sW. Plus a new testcase. Perfect.. > diff --git a/tests/run-readelf-s.sh b/tests/run-readelf-s.sh > index ee1c0e82..c150c165 100755 > --- a/tests/run-readelf-s.sh > +++ b/tests/run-readelf-s.sh > @@ -395,4 +395,7 @@ Symbol table [27] '.symtab' contains 42 entries: > 41: 00000000004003a8 0 FUNC GLOBAL DEFAULT 11 _init > EOF > =20 > +${abs_top_builddir}/src/readelf --elf-section -sW testfilebaxmin 2>&1 \ > + | grep "WARNING: cannot find section: 'W'" >/dev/null || exit 2 > + You need to run a tests with testrun or testrun_compare so they actually run against the just build libraries (and so they run under valgrind when configured with --enable-valgrind). So in this case just add a testrun in front. -${abs_top_builddir}/src/readelf --elf-section -sW testfilebaxmin 2>&1 \ +testrun ${abs_top_builddir}/src/readelf --elf-section -sW testfilebaxmin 2= >&1 \ OK with that change. Thanks, Mark