From 233f82cfb4c3f496712648c20994e0dbabe8aa79 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Wed, 22 Feb 2017 18:09:41 +0000 Subject: readelf: Restore a lost new line in version information Fix a commit 74e1a04b9787 ("More fixes for reading corrupt ELF files.") `readelf --version-info' output formatting regression where a dropped new line caused section header information from the `.gnu.version_d' version definition section to be printed on the same line as this section's first entry. For example with the `mips-linux' target we get: $ cat ver_def.s .data .globl new_foo .type new_foo, %object new_foo: .symver new_foo, foo@@ver_foo $ cat ver_def.ver { global: *foo*; local: *; }; $ as -o ver_def.o ver_def.s $ ld -e 0 --export-dynamic --version-script=ver_def.ver -o ver_def ver_def.o $ readelf -V ver_def Version symbols section '.gnu.version' contains 4 entries: Addr: 000000000000007e Offset: 0x01007e Link: 2 (.dynsym) 000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo) Version definition section '.gnu.version_d' contains 2 entries: Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo Version definition past end of section $ Add the new line then, to get: $ readelf -V ver_def Version symbols section '.gnu.version' contains 4 entries: Addr: 000000000000007e Offset: 0x01007e Link: 2 (.dynsym) 000: 0 (*local*) 2 (ver_foo) 1 (*global*) 2 (ver_foo) Version definition section '.gnu.version_d' contains 2 entries: Addr: 0x0000000000000088 Offset: 0x010088 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: ver_def 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_foo Version definition past end of section $ instead. binutils/ * readelf.c (process_version_sections) : Print a new line between the heading and the first version definition entry. --- binutils/ChangeLog | 6 ++++++ binutils/readelf.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'binutils') diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 3bd33d7..88568b4 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2017-02-22 Maciej W. Rozycki + + * readelf.c (process_version_sections) : Print a + new line between the heading and the first version definition + entry. + 2017-02-20 Nick Clifton PR binutils/21156 diff --git a/binutils/readelf.c b/binutils/readelf.c index 20df6f8..da1fa4d 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -10002,7 +10002,7 @@ process_version_sections (FILE * file) printf (_(" Addr: 0x")); printf_vma (section->sh_addr); - printf (_(" Offset: %#08lx Link: %u (%s)"), + printf (_(" Offset: %#08lx Link: %u (%s)\n"), (unsigned long) section->sh_offset, section->sh_link, printable_section_name_from_index (section->sh_link)); -- cgit v1.1