bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/26028] New: Readelf truncates symbol names - which is both


From: nyh at math dot technion.ac.il
Subject: [Bug binutils/26028] New: Readelf truncates symbol names - which is both undocumented, and unnecessary
Date: Sat, 23 May 2020 15:25:26 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=26028

            Bug ID: 26028
           Summary: Readelf truncates symbol names - which is both
                    undocumented, and unnecessary
           Product: binutils
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: nyh at math dot technion.ac.il
  Target Milestone: ---

Tested on readelf 2.34 from Fedora 32.

Readelf appears to truncate symbol names to some length, but this length and
even the fact that symbol names are truncated, are not documented in
readelf(1). Surprisingly, the "--wide" option avoids this trunction. 

Here is an example noted in
https://github.com/cloudius-systems/osv/issues/1083:

$ readelf --dyn-syms build/release/loader.elf
...

   295: 000000004036bd10    17 FUNC    GLOBAL DEFAULT    4
_ZN6virtio13virtio_driver

$ readelf --dyn-syms --wide build/release/loader.elf 
  295: 000000004036bd10    17 FUNC    GLOBAL DEFAULT    4
_ZN6virtio13virtio_driver14set_dev_statusEh

Note the truncated symbol name in the first output, and the full symbol name in
the second.

The documentation for "--wide" suggests that it inhibits breaking lines after
80 characters. But in fact it also (or only?) inhibits truncation. Moreover,
the truncation didn't even happen at the 80th character of the line but rather
the 84th - I am guessing that this might be because of a miscalculation of the
line length because this specific executable had over 16,000 symbols and maybe
some of the other fields were longer than expected.

I think you should fix the readelf code to never truncate symbol names, no
matter how long the line becomes. I can't see how backward compatibility here
can be important (especially given that the existing situation doesn't even
truncate the line to 80 characters), but if for some reason you don't want to
fix the code, please at least fix the documentation, readelf(1): In "--syms"
please explain that symbol names may be truncated unless the "--wide" option is
used, and in "--wide" please explain what it really does - that it avoids
truncation, not line splits, and probably not really at 80 characters.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]