Skip to content

Commit

Permalink
[llvm-nm] Report '.comment' ELF sections as 'n' instead of '?'
Browse files Browse the repository at this point in the history
Summary:
The previous implementation reported `.comment` sections as '?'
GNU uses 'n' which means  "The symbol is a debugging symbol."  `.note`  sections are represented as 'n' too.

The test related to this change was updated to CHECK-NEXT to ensure
order and that we did not miss any symbols in the dump.

Reviewers: jhenderson

Reviewed By: jhenderson

Subscribers: rupprecht, llvm-commits

Differential Revision: https://reviews.llvm.org/D57544

llvm-svn: 352891
  • Loading branch information
Matt Davis authored and Matt Davis committed Feb 1, 2019
1 parent 1238838 commit 68fad50
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
29 changes: 15 additions & 14 deletions llvm/test/Object/nm-trivial-object.test
Expand Up @@ -116,20 +116,21 @@ ABSOLUTE-ELF64: 0000000000000123 a a1
ABSOLUTE-ELF64: 0000000000000123 A a2

ELF64-DEBUG-SYMS: 00000000 b .bss
ELF64-DEBUG-SYMS: 00000000 d .data
ELF64-DEBUG-SYMS: 00000000 N .debug_abbrev
ELF64-DEBUG-SYMS: 00000000 N .debug_aranges
ELF64-DEBUG-SYMS: 00000000 N .debug_frame
ELF64-DEBUG-SYMS: 00000000 N .debug_info
ELF64-DEBUG-SYMS: 00000000 N .debug_line
ELF64-DEBUG-SYMS: 00000000 N .debug_pubnames
ELF64-DEBUG-SYMS: 00000000 n .note.GNU-stack
ELF64-DEBUG-SYMS: 00000000 t .text
ELF64-DEBUG-SYMS: 00000000 a IsNAN.cpp
ELF64-DEBUG-SYMS: 00000014 T _ZN4llvm5IsNANEd
ELF64-DEBUG-SYMS: 00000000 T _ZN4llvm5IsNANEf
ELF64-DEBUG-SYMS: U __isnan
ELF64-DEBUG-SYMS: U __isnanf
ELF64-DEBUG-SYMS-NEXT: 00000000 n .comment
ELF64-DEBUG-SYMS-NEXT: 00000000 d .data
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_abbrev
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_aranges
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_frame
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_info
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_line
ELF64-DEBUG-SYMS-NEXT: 00000000 N .debug_pubnames
ELF64-DEBUG-SYMS-NEXT: 00000000 n .note.GNU-stack
ELF64-DEBUG-SYMS-NEXT: 00000000 t .text
ELF64-DEBUG-SYMS-NEXT: 00000000 a IsNAN.cpp
ELF64-DEBUG-SYMS-NEXT: 00000014 T _ZN4llvm5IsNANEd
ELF64-DEBUG-SYMS-NEXT: 00000000 T _ZN4llvm5IsNANEf
ELF64-DEBUG-SYMS-NEXT: U __isnan
ELF64-DEBUG-SYMS-NEXT: U __isnanf

macho: U _SomeOtherFunction
macho: 00000000 T _main
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/llvm-nm/llvm-nm.cpp
Expand Up @@ -935,6 +935,7 @@ static char getSymbolNMTypeChar(ELFObjectFileBase &Obj,
return StringSwitch<char>(*Name)
.StartsWith(".debug", 'N')
.StartsWith(".note", 'n')
.StartsWith(".comment", 'n')
.Default('?');
}

Expand Down

0 comments on commit 68fad50

Please sign in to comment.