summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2015-10-30 19:55:32 +0000
committerKevin Enderby <enderby@apple.com>2015-10-30 19:55:32 +0000
commit1543bdf4509c9001fd635fe24204b6d429603ff4 (patch)
tree27040612264de141cfb0de99bafcc18863314a57 /llvm
parenta49cfd8f946160a82d70ebe6e8b3d7658c07c68f (diff)
downloadbcm5719-llvm-1543bdf4509c9001fd635fe24204b6d429603ff4.tar.gz
bcm5719-llvm-1543bdf4509c9001fd635fe24204b6d429603ff4.zip
Implemented the code to make llvm-nm’s -g option work.
While llvm-nm parses the -g option and has help that describes it as: -extern-only - Show only external symbols There is no code in the program to use the boolean valve it sets from the command line. rdar://23261095 llvm-svn: 251718
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.macho-x86_64bin0 -> 844 bytes
-rw-r--r--llvm/test/tools/llvm-nm/X86/externalonly.test4
-rw-r--r--llvm/test/tools/llvm-nm/lit.local.cfg2
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp3
4 files changed, 9 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.macho-x86_64 b/llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.macho-x86_64
new file mode 100644
index 00000000000..2b59a1cfc63
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/X86/Inputs/hello.obj.macho-x86_64
Binary files differ
diff --git a/llvm/test/tools/llvm-nm/X86/externalonly.test b/llvm/test/tools/llvm-nm/X86/externalonly.test
new file mode 100644
index 00000000000..c3741298786
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/X86/externalonly.test
@@ -0,0 +1,4 @@
+# RUN: llvm-nm -g %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
+
+# CHECK-NOT: EH_frame0
+# CHECK: _main
diff --git a/llvm/test/tools/llvm-nm/lit.local.cfg b/llvm/test/tools/llvm-nm/lit.local.cfg
new file mode 100644
index 00000000000..c8625f4d9d2
--- /dev/null
+++ b/llvm/test/tools/llvm-nm/lit.local.cfg
@@ -0,0 +1,2 @@
+if not 'X86' in config.root.targets:
+ config.unsupported = True
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index a0b5e9b4eaa..9d0cc575843 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -529,6 +529,9 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName,
continue;
if (Undefined && DefinedOnly)
continue;
+ bool Global = SymFlags & SymbolRef::SF_Global;
+ if (!Global && ExternalOnly)
+ continue;
if (SizeSort && !PrintAddress)
continue;
if (PrintFileName) {
OpenPOWER on IntegriCloud