summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2014-06-19 22:49:21 +0000
committerKevin Enderby <enderby@apple.com>2014-06-19 22:49:21 +0000
commit1e1b992ad7bb3c79fae317897f59b68608cfe313 (patch)
treeef6784bb9a85c9d577717e4bce13687458cbf5c3
parentb201bfcbcee51cb975f68fb9a3e25b47fc3b6505 (diff)
downloadbcm5719-llvm-1e1b992ad7bb3c79fae317897f59b68608cfe313.tar.gz
bcm5719-llvm-1e1b992ad7bb3c79fae317897f59b68608cfe313.zip
Fix the output of llvm-nm for Mach-O files to use the characters ‘d’ and ‘b’ for
data and bss symbols instead of the generic ’s’ for a symbol in a section. llvm-svn: 211321
-rw-r--r--llvm/test/Object/nm-trivial-object.test7
-rw-r--r--llvm/test/Object/nm-universal-binary.test2
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp4
3 files changed, 12 insertions, 1 deletions
diff --git a/llvm/test/Object/nm-trivial-object.test b/llvm/test/Object/nm-trivial-object.test
index 20ac6621e72..c53dc91ecd4 100644
--- a/llvm/test/Object/nm-trivial-object.test
+++ b/llvm/test/Object/nm-trivial-object.test
@@ -14,6 +14,8 @@ RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
RUN: | FileCheck %s -check-prefix macho
RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
RUN: | FileCheck %s -check-prefix macho64
+RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
+RUN: | FileCheck %s -check-prefix macho-tdb
RUN: llvm-nm %p/Inputs/common.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF-COMMON
RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
@@ -64,6 +66,11 @@ macho64: U _SomeOtherFunction
macho64: 0000000000000000 T _main
macho64: U _puts
+macho-tdb: 0000000000000030 s EH_frame0
+macho-tdb: 0000000000000070 b _b
+macho-tdb: 000000000000000c D _d
+macho-tdb: 0000000000000000 T _t
+macho-tdb: 0000000000000048 S _t.eh
Test that nm uses addresses even with ELF .o files.
ELF-SEC-ADDR64: 0000000000000058 D a
diff --git a/llvm/test/Object/nm-universal-binary.test b/llvm/test/Object/nm-universal-binary.test
index 52781267c5c..8992359a79b 100644
--- a/llvm/test/Object/nm-universal-binary.test
+++ b/llvm/test/Object/nm-universal-binary.test
@@ -15,5 +15,5 @@ CHECK-AR: 0000000000000000 T _main
CHECK-AR: 0000000000000080 S _main.eh
CHECK-AR: U _printf
CHECK-AR: macho-universal-archive.x86_64.i386(foo.o) (for architecture i386):
-CHECK-AR: 00000008 S _bar
+CHECK-AR: 00000008 D _bar
CHECK-AR: 00000000 T _foo
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index c6b80d1dd96..5062435d897 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -577,6 +577,10 @@ static char getSymbolNMTypeChar(MachOObjectFile &Obj, basic_symbol_iterator I) {
StringRef SegmentName = Obj.getSectionFinalSegmentName(Ref);
if (SegmentName == "__TEXT" && SectionName == "__text")
return 't';
+ else if (SegmentName == "__DATA" && SectionName == "__data")
+ return 'd';
+ else if (SegmentName == "__DATA" && SectionName == "__bss")
+ return 'b';
else
return 's';
}
OpenPOWER on IntegriCloud