]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - binutils/readelf.c
readelf: Correct version flag formatting
authorMaciej W. Rozycki <macro@imgtec.com>
Thu, 23 Feb 2017 18:18:51 +0000 (18:18 +0000)
committerMaciej W. Rozycki <macro@imgtec.com>
Fri, 24 Feb 2017 13:49:55 +0000 (13:49 +0000)
commit7bb1ad1738d3ff45452b136fdfc3fc19195ae55f
treee447b697972fdbc306ec1719ac7d19a9e7afa561
parent5235cd686141bb5adb57dbbf302a168e9693672b
readelf: Correct version flag formatting

Remove a trailing space or a leading pipe character from version flags
printed with `readelf --version-info'.

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
$

which includes an unnecessary space after `BASE'; both call sites
already provide suitable separation from output that follows.  Also if
only unknown flags were present, then lone `| <unknown>' would be
printed.

binutils/
* readelf.c (get_ver_flags): Tidy the formatting of the string
returned
binutils/ChangeLog
binutils/readelf.c