[PATCH] D65374: [llvm-nm] Use same symbol types as gnu nm when --format=sysv
Mike Pozulp via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 28 00:33:15 PDT 2019
mmpozulp added a comment.
Should we match gnu nm exactly or is this enough?
If we check all 16 possible bit-patterns of the 4-bit-wide symbol type (as in `format-sysv-type.test`) we can see that gnu nm prints the symbol_section and symbol_common symbols differently than we do. See (4) below for the differences.
(1) llvm-nm output **before** applying this patch
Name Value Class Type Size Line Section
symbol_notype | | U | NOTYPE| | |*UND*
symbol_obj | | U | OBJECT| | |*UND*
symbol_function | | U | FUNC| | |*UND*
symbol_section | | U | SECTION| | |*UND*
symbol_file | | U | FILE| | |*UND*
symbol_common | | U | COMMON| | |*COM*
symbol_tls | | U | TLS| | |*UND*
symbol_unknown7 | | U | | | |*UND*
symbol_unknown8 | | U | | | |*UND*
symbol_unknown9 | | U | | | |*UND*
symbol_ifunc | | U | IFUNC| | |*UND*
os_specific10 | | U | IFUNC| | |*UND*
os_specific11 | | U | | | |*UND*
os_specific12 | | U | | | |*UND*
proc_specific13 | | U | | | |*UND*
proc_specific14 | | U | | | |*UND*
proc_specific15 | | U | | | |*UND*
(2) llvm-nm output **after** applying this patch
Name Value Class Type Size Line Section
symbol_notype | | U | NOTYPE| | |*UND*
symbol_obj | | U | OBJECT| | |*UND*
symbol_function | | U | FUNC| | |*UND*
symbol_section | | U | SECTION| | |*UND*
symbol_file | | U | FILE| | |*UND*
symbol_common | | U | COMMON| | |*COM*
symbol_tls | | U | TLS| | |*UND*
symbol_unknown7 | | U | <unknown>: 7| | |*UND*
symbol_unknown8 | | U | <unknown>: 8| | |*UND*
symbol_unknown9 | | U | <unknown>: 9| | |*UND*
symbol_ifunc | | U | <OS specific>: 10| | |*UND*
os_specific10 | | U | <OS specific>: 10| | |*UND*
os_specific11 | | U | <OS specific>: 11| | |*UND*
os_specific12 | | U | <OS specific>: 12| | |*UND*
proc_specific13 | | U |<processor specific>: 13| | |*UND*
proc_specific14 | | U |<processor specific>: 14| | |*UND*
proc_specific15 | | U |<processor specific>: 15| | |*UND*
(3) **gnu nm** (version 2.32) output
Name Value Class Type Size Line Section
symbol_notype | | U | NOTYPE| | |*UND*
symbol_obj | | U | OBJECT| | |*UND*
symbol_function | | U | FUNC| | |*UND*
symbol_section | | U | | | |
symbol_file | | U | FILE| | |*UND*
symbol_common | | U | COMMON| | |*UND*
symbol_tls | | U | TLS| | |*UND*
symbol_unknown7 | | U | <unknown>: 7| | |*UND*
symbol_unknown8 | | U | <unknown>: 8| | |*UND*
symbol_unknown9 | | U | <unknown>: 9| | |*UND*
symbol_ifunc | | U | <OS specific>: 10| | |*UND*
os_specific10 | | U | <OS specific>: 10| | |*UND*
os_specific11 | | U | <OS specific>: 11| | |*UND*
os_specific12 | | U | <OS specific>: 12| | |*UND*
proc_specific13 | | U |<processor specific>: 13| | |*UND*
proc_specific14 | | U |<processor specific>: 14| | |*UND*
proc_specific15 | | U |<processor specific>: 15| | |*UND*
(4) diff llvm-nm gnu-nm
$ diff llvmnm.out gnunm.out
5a6
>
9c10
< symbol_section | | U | SECTION| | |*UND*
---
> symbol_section | | U | | | |
11c12
< symbol_common | | U | COMMON| | |*COM*
---
> symbol_common | | U | COMMON| | |*UND*
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65374/new/
https://reviews.llvm.org/D65374
More information about the llvm-commits
mailing list