Bug 216878

Summary: BSD readelf -d output is slightly incompatible with GNU readelf
Product: Base System Reporter: Jan Beich <jbeich>
Component: binAssignee: freebsd-toolchain (Nobody) <toolchain>
Status: Closed Works As Intended    
Severity: Affects Only Me CC: emaste
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://bugzilla.mozilla.org/show_bug.cgi?id=1336791

Description Jan Beich freebsd_committer freebsd_triage 2017-02-07 11:03:57 UTC
GNU readelf wraps type value with parentheses. To avoid bugs like in See Also it'd be nice if BSD readelf would follow the suit.

- 0x0000000000000001 (NEEDED)             Shared library: [libc++.so.1]
+ 0x0000000000000001 NEEDED               Shared library: [libc++.so.1]
Comment 1 Ed Maste freebsd_committer freebsd_triage 2017-02-07 21:51:13 UTC
Added ELF Tool Chain ticket: https://sourceforge.net/p/elftoolchain/tickets/544/

Note that elfutils eu-readelf does not include parentheses:
% eu-readelf -d /bin/ls

Dynamic segment contains 28 entries:
 Addr: 0x0000000000607028  Offset: 0x007028  Link to section: [ 6] '.dynstr'
  Type              Value
  NEEDED            Shared library: [libutil.so.9]
  NEEDED            Shared library: [libncurses.so.8]
  NEEDED            Shared library: [libc.so.7]
  INIT              0x00000000004018c8
  FINI              0x0000000000405dd8
...
so there's some argument that scripts parsing readelf output should be tolerant of different formats, looking for just NEEDED
Comment 2 Baptiste Daroussin freebsd_committer freebsd_triage 2017-02-07 22:31:14 UTC
Note that this was already raised in the past and the result of the discussion was this won't change iirc and we adapted the readelf consumers in base and the ports framework for compatiblity
Comment 3 Ed Maste freebsd_committer freebsd_triage 2017-02-07 23:35:31 UTC
(In reply to Baptiste Daroussin from comment #2)
Do you have a link to that discussion? I recall that we had it, but can't find it now.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2018-09-01 01:54:32 UTC
Issue was discussed and we decided to keep the paren-less version.