Bug 228290 - [patch] elfdump -n does not recognise notes sections
Summary: [patch] elfdump -n does not recognise notes sections
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2018-05-16 11:46 UTC by martin
Modified: 2019-01-31 16:49 UTC (History)
3 users (show)

See Also:


Attachments
Patch to elfdump to recognise .note.tag sections. (419 bytes, patch)
2018-05-16 11:46 UTC, martin
no flags Details | Diff
More desriptive elfdump patch (2.22 KB, patch)
2018-06-12 18:37 UTC, Dan McGregor
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description martin 2018-05-16 11:46:56 UTC
Created attachment 193451 [details]
Patch to elfdump to recognise .note.tag sections.

This command prints nothing even though /bin/sh has a note section:

/usr/bin/elfdump -n /bin/sh

The problem is that https://svnweb.freebsd.org/base/head/usr.bin/elfdump/elfdump.c?view=markup#l662 is looking for a note section named .note.ABI-tag but the name has been .note.tag since r232832.

Fixed by the attached patch.
Comment 1 commit-hook freebsd_committer 2018-05-30 01:17:13 UTC
A commit references this bug:

Author: emaste
Date: Wed May 30 01:16:50 UTC 2018
New revision: 334363
URL: https://svnweb.freebsd.org/changeset/base/334363

Log:
  elfdump: chase ABI tag note name change from r232832

  r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag.
  Follow suit in elfdump.

  Elfdump's note parsing is very basic and should be significantly
  reworked, but for now just restore the broken functionality.

  PR:		228290
  Submitted by:	martin at lispworks.com
  MFC after:	1 week

Changes:
  head/usr.bin/elfdump/elfdump.c
Comment 2 Dan McGregor 2018-06-12 18:37:10 UTC
Created attachment 194204 [details]
More desriptive elfdump patch

I independently came up with this patch around the same time the original was created. This keeps support for the .note.ABI-tag section alongside the .note.tag section.

It also displays the note type, not just its value. That way noinit tags, arch tags, and abi tags can be kept separate.
Comment 3 commit-hook freebsd_committer 2018-06-19 17:12:20 UTC
A commit references this bug:

Author: emaste
Date: Tue Jun 19 17:11:54 UTC 2018
New revision: 335375
URL: https://svnweb.freebsd.org/changeset/base/335375

Log:
  MFC r334363: elfdump: chase ABI tag note name change from r232832

  r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag.
  Follow suit in elfdump.

  Elfdump's note parsing is very basic and should be significantly
  reworked, but for now just restore the broken functionality.

  PR:		228290
  Submitted by:	martin at lispworks.com

Changes:
_U  stable/11/
  stable/11/usr.bin/elfdump/elfdump.c
Comment 4 commit-hook freebsd_committer 2019-01-31 16:19:27 UTC
A commit references this bug:

Author: emaste
Date: Thu Jan 31 16:19:04 UTC 2019
New revision: 343610
URL: https://svnweb.freebsd.org/changeset/base/343610

Log:
  elfdump: include note type names

  Based on a patch submitted by Dan McGregor.

  PR:		228290
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/usr.bin/elfdump/elfdump.c
Comment 5 commit-hook freebsd_committer 2019-01-31 16:21:31 UTC
A commit references this bug:

Author: emaste
Date: Thu Jan 31 16:21:10 UTC 2019
New revision: 343611
URL: https://svnweb.freebsd.org/changeset/base/343611

Log:
  elfdump: fix build after r343610

  One patch hunk did not survive the trip from git to svn.

  PR:		228290
  MFC with:	r343610

Changes:
  head/usr.bin/elfdump/elfdump.c
Comment 6 commit-hook freebsd_committer 2019-01-31 16:49:59 UTC
A commit references this bug:

Author: emaste
Date: Thu Jan 31 16:49:06 UTC 2019
New revision: 343613
URL: https://svnweb.freebsd.org/changeset/base/343613

Log:
  elfdump: use designated array initialization for note types

  This ensures the note type name is in the correct slot.

  PR:		228290
  Submitted by:	kib
  MFC with:	343610
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/usr.bin/elfdump/elfdump.c