diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2017-02-22 18:09:41 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2017-02-22 18:16:28 +0000 |
commit | 233f82cfb4c3f496712648c20994e0dbabe8aa79 (patch) | |
tree | 0b203d17f77b38ec8f271d76ec6787e509dab4bf /binutils | |
parent | 902e9fc76a0ec9f642cefa71ef88cca1c675ad54 (diff) | |
download | gdb-233f82cfb4c3f496712648c20994e0dbabe8aa79.zip gdb-233f82cfb4c3f496712648c20994e0dbabe8aa79.tar.gz gdb-233f82cfb4c3f496712648c20994e0dbabe8aa79.tar.bz2 |
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) <SHT_GNU_verdef>: Print a
new line between the heading and the first version definition
entry.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 6 | ||||
-rw-r--r-- | binutils/readelf.c | 2 |
2 files changed, 7 insertions, 1 deletions
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 <macro@imgtec.com> + + * readelf.c (process_version_sections) <SHT_GNU_verdef>: Print a + new line between the heading and the first version definition + entry. + 2017-02-20 Nick Clifton <nickc@redhat.com> 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)); |