% readelf -V /lib/x86_64-linux-gnu/libc.so.6 Version symbols section '.gnu.version' contains 2247 entries: Addr: 0000000000016a3a Offset: 0x016a3a Link: 4 (.dynsym) 000: 0 (*local*) 1b (GLIBC_PRIVATE) 1b (GLIBC_PRIVATE) 1c (GLIBC_2.3) 004: 1b (GLIBC_PRIVATE) 1b (GLIBC_PRIVATE) 0 (*local*) 1b (GLIBC_PRIVATE) ... Version definition section '.gnu.version_d' contains 26 entries: Addr: 0x0000000000017bc8 Offset: 0x017bc8 Link: 5 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libc.so.6 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: GLIBC_2.2.5 ... Version needs section '.gnu.version_r' contains 1 entry: Addr: 0x0000000000017f60 Offset: 0x017f60 Link: 5 (.dynstr) 000000: Version: 1 File: ld-linux-x86-64.so.2 Cnt: 2 0x0010: Name: GLIBC_2.3 Flags: none Version: 28 ... * In the output .gnu.version and .gnu.version_d, `Addr:` is indented by 2. * `000000` probably should be printed as `0x0000`
Sorry, in .gnu.version_d, `Addr:` is indented by 2.
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ae9ac79e5e291a2bc5c6620a10c37a3558d55d36 commit ae9ac79e5e291a2bc5c6620a10c37a3558d55d36 Author: Nick Clifton <nickc@redhat.com> Date: Thu May 30 10:17:29 2019 +0100 Harmonize readelf's output for version sections. PR 24627 binutils * readelf.c (process_version_sections): Add 0x prefix to address display. Correct indentation. ld * testsuite/ld-elf/ver_def.vd: Update expected output.
Hi Fanguri, I would not call the output "ugly", rather I think that "inconsistent" would be a better word. Nevertheless I have applied a patch so that "Addr" is only intended by one space for three types of output, and that the address always receives a 0x prefix. The fact that a zero value does not receive a 0x prefix when displaying offsets into the section is an artefact of the printf function's '#' formatting character and not something that we can control directly. (Well other than abandoning the use of the # formatter). So I have not changed this. Cheers Nick
Thank you for your prompt fix!
One remaining issue (after ae9ac79e5e291a2bc5c6620a10c37a3558d55d36). Does `000000: Rev: 1` below need a similar %# fix? Version definition section '.gnu.version_d' contains 26 entries: Addr: 0x0000000000017bc8 Offset: 0x017bc8 Link: 5 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libc.so.6 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: GLIBC_2.2.5 0x0038: Rev: 1 Flags: none Index: 3 Cnt: 2 Name: GLIBC_2.2.6