[llvm-bugs] [Bug 40788] New: Use section name for section symbol names in llvm-readobj

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 20 07:59:34 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40788

            Bug ID: 40788
           Summary: Use section name for section symbol names in
                    llvm-readobj
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-readobj
          Assignee: unassignedbugs at nondot.org
          Reporter: jh7370.2008 at my.bristol.ac.uk
                CC: jh7370.2008 at my.bristol.ac.uk, llvm-bugs at lists.llvm.org

llvm-readobj + llvm-readelf print an empty string for section symbols. This is
technically correct, in the section symbols typically have no name, but it is
not particularly useful and makes the symbol table dump harder to interpret
(you have to lookup the section index and inspect the section header table to
map the symbol to its corresponding section).

This is similar to bug 39995, where section names are now being used for symbol
names for ELF STT_SECTION symbols. However, whereas that bug brought llvm-nm
closer to GNU nm's output, the same is not the case here. It is worth noting
that GNU objdump's -t output also uses the section names for such symbols.

I think we should do the same here. In all likelihood it won't hurt any
parsers, since the name is at the end of the line, and would be an improvement
over GNU readelf. I think we should do it for both GNU and LLVM style output as
GNU style is more compact and more familiar to many developers.

Current output:
C:\llvm\llvm\test\tools\llvm-readobj> c:\llvm\build\debug\bin\llvm-readobj.exe
"--symbols" "C:\llvm\llvm\test\tools\llvm-readobj/Inputs/relocs.obj.elf-x86_64"
"--elf-output-style=GNU"

Symbol table '.symtab' contains 6 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_GLOBAL_OFFSET_TABLE_
     5: 0000000000000000     0 TLS     GLOBAL DEFAULT  UND sym

Proposal:
C:\llvm\llvm\test\tools\llvm-readobj> c:\llvm\build\debug\bin\llvm-readobj.exe
"--symbols" "C:\llvm\llvm\test\tools\llvm-readobj/Inputs/relocs.obj.elf-x86_64"
"--elf-output-style=GNU"

Symbol table '.symtab' contains 6 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 .text
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 .data
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 .bss
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_GLOBAL_OFFSET_TABLE_
     5: 0000000000000000     0 TLS     GLOBAL DEFAULT  UND sym

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190220/81285b87/attachment.html>


More information about the llvm-bugs mailing list