From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EFE443858284; Mon, 24 Oct 2022 12:13:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EFE443858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666613630; bh=RZDtAkpL+RduiQrt5rq0nwtUmgUFvc3NYr/7M3EgA3w=; h=From:To:Subject:Date:From; b=MqKMeraLidkz9HBsAEewP3C1I0Tfw/d6Gz3N8yDMtoX/R61Y9mOiDRjIBciHKxdLw brnfKmPBOhNWIhgjni0NXg4htUUg9XBra3mpXQAHUD6sHVpLvI77DYwC/jwGZXQav0 /JefPa8xTU4Ezr0pRsRFg+8vYzMuATh7lnV/13kg= From: "mliska at suse dot cz" To: elfutils-devel@sourceware.org Subject: [Bug tools/29719] New: eu-readelf -s=section is confusing Date: Mon, 24 Oct 2022 12:13:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: tools X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mliska at suse dot cz X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29719 Bug ID: 29719 Summary: eu-readelf -s=3Dsection 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 fedoraproj= ect 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 recom= mend 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 =3D NULL; + bool symtab_handled =3D false; while ((scn =3D elf_nextscn (ebl->elf, scn)) !=3D NULL) { @@ -2466,8 +2467,13 @@ print_symtab (Ebl *ebl, int type) elf_ndxscn (scn), elf_errmsg (-1)); } handle_symtab (ebl, scn, shdr); + symtab_handled =3D true; } } + + if (!symtab_handled && symbol_table_section !=3D NULL) + printf ("WARNING: %s: '%s'\n", _("cannot find section"), + symbol_table_section); } --=20 You are receiving this mail because: You are on the CC list for the bug.=