public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug tools/29719] New: eu-readelf -s=section is confusing
@ 2022-10-24 12:13 mliska at suse dot cz
  2022-10-24 12:29 ` [Bug tools/29719] " mliska at suse dot cz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mliska at suse dot cz @ 2022-10-24 12:13 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29719

            Bug ID: 29719
           Summary: eu-readelf -s=section is confusing
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tools
          Assignee: unassigned at sourceware dot org
          Reporter: mliska at suse dot cz
                CC: elfutils-devel at sourceware dot org, mjw at fedoraproject dot org
  Target Milestone: ---

Note there's a difference in between binutils and elfutils where the later on
has an optional argument:

       --symbols [section name]

I have a few comments:

1) it's confusing as one expects that all symbols in "section name" will be
printed, but it's not correct. It's the name of '.symtab' section.

2) readelf -sW xxx does not print anything, while binutils does:

The reason is simple, 'W' section is not found in the binary. I would recommend
printing a warning:

./src/readelf -sW /home/marxin/Programming/linux/arch/x86/kernel/head_64.o
WARNING: cannot find section: 'W'
WARNING: cannot find section: 'W'

diff --git a/src/readelf.c b/src/readelf.c
index a206e60e..465526c4 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -2431,6 +2431,7 @@ print_symtab (Ebl *ebl, int type)
   /* Find the symbol table(s).  For this we have to search through the
      section table.  */
   Elf_Scn *scn = NULL;
+  bool symtab_handled = false;

   while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
     {
@@ -2466,8 +2467,13 @@ print_symtab (Ebl *ebl, int type)
                            elf_ndxscn (scn), elf_errmsg (-1));
            }
          handle_symtab (ebl, scn, shdr);
+         symtab_handled = true;
        }
     }
+
+  if (!symtab_handled && symbol_table_section != NULL)
+    printf ("WARNING: %s: '%s'\n", _("cannot find section"),
+           symbol_table_section);
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tools/29719] eu-readelf -s=section is confusing
  2022-10-24 12:13 [Bug tools/29719] New: eu-readelf -s=section is confusing mliska at suse dot cz
@ 2022-10-24 12:29 ` mliska at suse dot cz
  2022-10-30  0:52 ` mark at klomp dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mliska at suse dot cz @ 2022-10-24 12:29 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29719

--- Comment #1 from Martin Liska <mliska at suse dot cz> ---
3) we may want to implement the semantic: dump all symbols that live in a given
section "foo". Can be handy for sections like .hot.text and so on.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tools/29719] eu-readelf -s=section is confusing
  2022-10-24 12:13 [Bug tools/29719] New: eu-readelf -s=section is confusing mliska at suse dot cz
  2022-10-24 12:29 ` [Bug tools/29719] " mliska at suse dot cz
@ 2022-10-30  0:52 ` mark at klomp dot org
  2022-11-15 16:12 ` mliska at suse dot cz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mark at klomp dot org @ 2022-10-30  0:52 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29719

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
I like the WARNING idea. This would also help with something like:
$ eu-readelf --symbols=.dynsyms /bin/bash
Which currently says nothing, but should warn (it is .dynsym without the s).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tools/29719] eu-readelf -s=section is confusing
  2022-10-24 12:13 [Bug tools/29719] New: eu-readelf -s=section is confusing mliska at suse dot cz
  2022-10-24 12:29 ` [Bug tools/29719] " mliska at suse dot cz
  2022-10-30  0:52 ` mark at klomp dot org
@ 2022-11-15 16:12 ` mliska at suse dot cz
  2022-11-25 13:31 ` mliska at suse dot cz
  2022-11-28  9:59 ` mliska at suse dot cz
  4 siblings, 0 replies; 6+ messages in thread
From: mliska at suse dot cz @ 2022-11-15 16:12 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29719

--- Comment #3 from Martin Liska <mliska at suse dot cz> ---
(In reply to Mark Wielaard from comment #2)
> I like the WARNING idea. This would also help with something like:
> $ eu-readelf --symbols=.dynsyms /bin/bash
> Which currently says nothing, but should warn (it is .dynsym without the s).

Great, can you please take the suggested patch and add a test-case for it?
Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tools/29719] eu-readelf -s=section is confusing
  2022-10-24 12:13 [Bug tools/29719] New: eu-readelf -s=section is confusing mliska at suse dot cz
                   ` (2 preceding siblings ...)
  2022-11-15 16:12 ` mliska at suse dot cz
@ 2022-11-25 13:31 ` mliska at suse dot cz
  2022-11-28  9:59 ` mliska at suse dot cz
  4 siblings, 0 replies; 6+ messages in thread
From: mliska at suse dot cz @ 2022-11-25 13:31 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29719

Martin Liska <mliska at suse dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |mliska at suse dot cz

--- Comment #4 from Martin Liska <mliska at suse dot cz> ---
I finished the patch:
https://sourceware.org/pipermail/elfutils-devel/2022q4/005607.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tools/29719] eu-readelf -s=section is confusing
  2022-10-24 12:13 [Bug tools/29719] New: eu-readelf -s=section is confusing mliska at suse dot cz
                   ` (3 preceding siblings ...)
  2022-11-25 13:31 ` mliska at suse dot cz
@ 2022-11-28  9:59 ` mliska at suse dot cz
  4 siblings, 0 replies; 6+ messages in thread
From: mliska at suse dot cz @ 2022-11-28  9:59 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=29719

Martin Liska <mliska at suse dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Martin Liska <mliska at suse dot cz> ---
Fixed with 2e42dc4328a8944263711ae23b1a34f7f47cb37c.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-28  9:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 12:13 [Bug tools/29719] New: eu-readelf -s=section is confusing mliska at suse dot cz
2022-10-24 12:29 ` [Bug tools/29719] " mliska at suse dot cz
2022-10-30  0:52 ` mark at klomp dot org
2022-11-15 16:12 ` mliska at suse dot cz
2022-11-25 13:31 ` mliska at suse dot cz
2022-11-28  9:59 ` mliska at suse dot cz

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).