summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.elf-i386bin0 -> 664 bytes
-rw-r--r--llvm/test/tools/llvm-nm/X86/sysv-i386.test6
-rw-r--r--llvm/test/tools/llvm-nm/X86/sysv-x86_64.test13
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp10
4 files changed, 26 insertions, 3 deletions
diff --git a/llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.elf-i386 b/llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.elf-i386
new file mode 100644
index 00000000000..d14b8d7a7f6
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.elf-i386
Binary files differ
diff --git a/llvm/test/tools/llvm-nm/X86/sysv-i386.test b/llvm/test/tools/llvm-nm/X86/sysv-i386.test
new file mode 100644
index 00000000000..b9b1f6024b1
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/X86/sysv-i386.test
@@ -0,0 +1,6 @@
+RUN: llvm-nm -f sysv %p/Inputs/hello.obj.elf-i386 | FileCheck %s --strict-whitespace
+
+CHECK: Name Value Class Type Size Line Section
+CHECK: .L.str |00000000| r | |0000000f| |
+CHECK: main |00000000| T | |00000015| |
+CHECK: puts | | U | | | |
diff --git a/llvm/test/tools/llvm-nm/X86/sysv-x86_64.test b/llvm/test/tools/llvm-nm/X86/sysv-x86_64.test
new file mode 100644
index 00000000000..bf041b202f7
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/X86/sysv-x86_64.test
@@ -0,0 +1,13 @@
+RUN: llvm-nm -f sysv %p/Inputs/hello.obj.elf-x86_64 | FileCheck %s --check-prefix=ELF --strict-whitespace
+RUN: llvm-nm -f sysv %p/Inputs/hello.obj.macho-x86_64 2>&1 | FileCheck %s --check-prefix=MACHO --strict-whitespace
+
+ELF: Name Value Class Type Size Line Section
+ELF: main |0000000000000000| T | |0000000000000015| |
+ELF: puts | | U | | | |
+
+MACHO: Name Value Class Type Size Line Section
+MACHO: EH_frame0 |0000000000000068| s | |0000000000000000| |
+MACHO: L_.str |000000000000003b| s | |0000000000000000| |
+MACHO: _main |0000000000000000| T | |0000000000000000| |
+MACHO: _main.eh |0000000000000080| S | |0000000000000000| |
+MACHO: _printf | | U | | | |
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index 126a9ae925e..1934051c65d 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -709,9 +709,13 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName,
} else if (OutputFormat == bsd && MultipleFiles && printName) {
outs() << "\n" << CurrentFilename << ":\n";
} else if (OutputFormat == sysv) {
- outs() << "\n\nSymbols from " << CurrentFilename << ":\n\n"
- << "Name Value Class Type"
- << " Size Line Section\n";
+ outs() << "\n\nSymbols from " << CurrentFilename << ":\n\n";
+ if (isSymbolList64Bit(Obj))
+ outs() << "Name Value Class Type"
+ << " Size Line Section\n";
+ else
+ outs() << "Name Value Class Type"
+ << " Size Line Section\n";
}
}
OpenPOWER on IntegriCloud