From patchwork Mon Oct 24 12:13:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fche at redhat dot com X-Patchwork-Id: 59350 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDCFA3858439 for ; Mon, 24 Oct 2022 12:13:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDCFA3858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666613639; bh=RZDtAkpL+RduiQrt5rq0nwtUmgUFvc3NYr/7M3EgA3w=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=a8OfDXijOCld3yssiGJ+0NA3u10bby55ZDEqHteEaVeqGNlJUl3ncytSnleS7QhNY 8O/3AzXPBaQKBo7Kpc028j9+v3MMSFbMMgkQKvvFUlOupw+kufGLrfiad5EsNiCrNX 1B4eaPBIOxWLhhlB4+2GBemqe6pptOJbdlhsecD0= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org 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 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: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: mliska at suse dot cz via Elfutils-devel From: fche at redhat dot com Reply-To: mliska at suse dot cz Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "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' You are on the CC list for the bug. 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: