As reported in FreeBSD PR 216878 readelf -d puts parentheses around the tag constants (- is binutils, + is ELF Tool Chain):
- 0x0000000000000001 (NEEDED) Shared library: [libc++.so.1] + 0x0000000000000001 NEEDED Shared library: [libc++.so.1]
There might be other formatting differences vs binutils. We should note the differences in the man page, or match binutils format exactly. In this case I think the parentheses in binutils are not useful and occupy columns that would be better used to avoid truncating long DT_*
names, but if it turns out there's a lot of scripts/software that parses readelf output and expects the GNU format it's not worth being different.
Also 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
Diff: