[llvm] r352891 - [llvm-nm] Report '.comment' ELF sections as 'n' instead of '?'

Matt Davis via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 1 09:38:08 PST 2019


Author: mattd
Date: Fri Feb  1 09:38:08 2019
New Revision: 352891

URL: http://llvm.org/viewvc/llvm-project?rev=352891&view=rev
Log:
[llvm-nm] Report '.comment' ELF sections as 'n' instead of '?'

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

Modified:
    llvm/trunk/test/Object/nm-trivial-object.test
    llvm/trunk/tools/llvm-nm/llvm-nm.cpp

Modified: llvm/trunk/test/Object/nm-trivial-object.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/nm-trivial-object.test?rev=352891&r1=352890&r2=352891&view=diff
==============================================================================
--- llvm/trunk/test/Object/nm-trivial-object.test (original)
+++ llvm/trunk/test/Object/nm-trivial-object.test Fri Feb  1 09:38:08 2019
@@ -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

Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=352891&r1=352890&r2=352891&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Fri Feb  1 09:38:08 2019
@@ -935,6 +935,7 @@ static char getSymbolNMTypeChar(ELFObjec
     return StringSwitch<char>(*Name)
         .StartsWith(".debug", 'N')
         .StartsWith(".note", 'n')
+        .StartsWith(".comment", 'n')
         .Default('?');
   }
 




More information about the llvm-commits mailing list