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

Reply via email to