Skip to content

Commit 32cfbeb

Browse files
committedAug 31, 2017
[llvm-nm] Fix output formatting of -f sysv for 64bit targets
Differential Revision: https://reviews.llvm.org/D37347 llvm-svn: 312284
1 parent cde4528 commit 32cfbeb

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed
 
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
RUN: llvm-nm -f sysv %p/Inputs/hello.obj.elf-i386 | FileCheck %s --strict-whitespace
2+
3+
CHECK: Name Value Class Type Size Line Section
4+
CHECK: .L.str |00000000| r | |0000000f| |
5+
CHECK: main |00000000| T | |00000015| |
6+
CHECK: puts | | U | | | |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
RUN: llvm-nm -f sysv %p/Inputs/hello.obj.elf-x86_64 | FileCheck %s --check-prefix=ELF --strict-whitespace
2+
RUN: llvm-nm -f sysv %p/Inputs/hello.obj.macho-x86_64 2>&1 | FileCheck %s --check-prefix=MACHO --strict-whitespace
3+
4+
ELF: Name Value Class Type Size Line Section
5+
ELF: main |0000000000000000| T | |0000000000000015| |
6+
ELF: puts | | U | | | |
7+
8+
MACHO: Name Value Class Type Size Line Section
9+
MACHO: EH_frame0 |0000000000000068| s | |0000000000000000| |
10+
MACHO: L_.str |000000000000003b| s | |0000000000000000| |
11+
MACHO: _main |0000000000000000| T | |0000000000000000| |
12+
MACHO: _main.eh |0000000000000080| S | |0000000000000000| |
13+
MACHO: _printf | | U | | | |

‎llvm/tools/llvm-nm/llvm-nm.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,13 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName,
709709
} else if (OutputFormat == bsd && MultipleFiles && printName) {
710710
outs() << "\n" << CurrentFilename << ":\n";
711711
} else if (OutputFormat == sysv) {
712-
outs() << "\n\nSymbols from " << CurrentFilename << ":\n\n"
713-
<< "Name Value Class Type"
714-
<< " Size Line Section\n";
712+
outs() << "\n\nSymbols from " << CurrentFilename << ":\n\n";
713+
if (isSymbolList64Bit(Obj))
714+
outs() << "Name Value Class Type"
715+
<< " Size Line Section\n";
716+
else
717+
outs() << "Name Value Class Type"
718+
<< " Size Line Section\n";
715719
}
716720
}
717721

0 commit comments

Comments
 (0)