[Bug,tools/29719] New: eu-readelf -s=section is confusing
Commit Message
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'
You are on the CC list for the bug.
Comments
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.
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).
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.
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
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.
@@ -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: