From: Mark Wielaard <mark@klomp.org>
To: "Martin Liška" <mliska@suse.cz>, elfutils-devel@sourceware.org
Subject: Re: [PATCH] readelf: print warning for -sW
Date: Fri, 25 Nov 2022 18:27:00 +0100 [thread overview]
Message-ID: <f41f89ce25affb6001ccec408e6349a1d48c831f.camel@klomp.org> (raw)
In-Reply-To: <fad31cad-b00b-42b3-7256-305ab44df7b3@suse.cz>
Hi Marin,
On Fri, 2022-11-25 at 14:29 +0100, Martin Liška 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.
>
> Thus, print a reasonable warning if -sW is used:
> ./src/readelf -sW a.out
> WARNING: cannot find section: 'W'
>
> Ready for master?
Looks good. But one nitpick below.
> src/ChangeLog:
>
> * 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
SHT_DYNSYM, then for SHT_SYMTAB. And the named section should be one or
the other. Good.
> tests/ChangeLog:
>
> * 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
>
> +${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
prev parent reply other threads:[~2022-11-25 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 13:29 Martin Liška
2022-11-25 17:27 ` Mark Wielaard [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=f41f89ce25affb6001ccec408e6349a1d48c831f.camel@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.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).