summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/test/CodeGen/thinlto_backend.ll2
-rw-r--r--lld/test/ELF/lto/thinlto-obj-path.ll2
-rw-r--r--llvm/test/Object/nm-shared-object.test3
-rw-r--r--llvm/test/ThinLTO/X86/empty-module.ll2
-rw-r--r--llvm/test/tools/llvm-nm/X86/nm-no-symbols.test4
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp16
6 files changed, 15 insertions, 14 deletions
diff --git a/clang/test/CodeGen/thinlto_backend.ll b/clang/test/CodeGen/thinlto_backend.ll
index be7a6feeb98..2dd919d5f7d 100644
--- a/clang/test/CodeGen/thinlto_backend.ll
+++ b/clang/test/CodeGen/thinlto_backend.ll
@@ -25,7 +25,7 @@
; be empty file.
; RUN: opt -o %t5.o %s
; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t4.o -x ir %t5.o -c -fthinlto-index=%t.thinlto.bc
-; RUN: llvm-nm %t4.o | FileCheck %s -check-prefix=NO-SYMBOLS
+; RUN: llvm-nm %t4.o 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
; NO-SYMBOLS: no symbols
; Ensure f2 was imported. Check for all 3 flavors of -save-temps[=cwd|obj].
diff --git a/lld/test/ELF/lto/thinlto-obj-path.ll b/lld/test/ELF/lto/thinlto-obj-path.ll
index 934b505d81c..2806d164a54 100644
--- a/lld/test/ELF/lto/thinlto-obj-path.ll
+++ b/lld/test/ELF/lto/thinlto-obj-path.ll
@@ -7,7 +7,7 @@
; RUN: rm -f %t4.o
; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=obj-path=%t4.o -shared %t1.o %t2.o -o %t3
; RUN: llvm-readobj -h %t4.o | FileCheck %s
-; RUN: llvm-nm %t4.o | FileCheck %s -check-prefix=NO-SYMBOLS
+; RUN: llvm-nm %t4.o 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
; NO-SYMBOLS: no symbols
; CHECK: Format: ELF64-x86-64
diff --git a/llvm/test/Object/nm-shared-object.test b/llvm/test/Object/nm-shared-object.test
index 678e871b852..9865383be50 100644
--- a/llvm/test/Object/nm-shared-object.test
+++ b/llvm/test/Object/nm-shared-object.test
@@ -30,5 +30,6 @@ RUN: | FileCheck %s -check-prefix ERROR
ERROR: File format has no dynamic symbol table.
-RUN: llvm-nm -D %p/Inputs/trivial-object-test.elf-i386 | FileCheck %s -check-prefix=NO-SYMBOLS
+RUN: llvm-nm -D %p/Inputs/trivial-object-test.elf-i386 2>&1 \
+RUN: | FileCheck %s -check-prefix=NO-SYMBOLS
NO-SYMBOLS: no symbols
diff --git a/llvm/test/ThinLTO/X86/empty-module.ll b/llvm/test/ThinLTO/X86/empty-module.ll
index 63a09fbcff5..285e1bcec2e 100644
--- a/llvm/test/ThinLTO/X86/empty-module.ll
+++ b/llvm/test/ThinLTO/X86/empty-module.ll
@@ -3,7 +3,7 @@
; RUN: rm -f %t2.0
; RUN: llvm-lto2 run %t.bc -r %t.bc,foo,pl -o %t2 -thinlto-distributed-indexes
; RUN: llvm-readobj -h %t2.0 | FileCheck %s
-; RUN: llvm-nm %t2.0 | FileCheck %s -check-prefix=NO-SYMBOLS
+; RUN: llvm-nm %t2.0 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS
; NO-SYMBOLS: no symbols
; CHECK: Format: ELF64-x86-64
diff --git a/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test b/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test
index 1ae830870ae..808a9b1301f 100644
--- a/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test
+++ b/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test
@@ -1,6 +1,6 @@
# RUN: yaml2obj %s > %t.o
-# RUN: llvm-nm %t.o | FileCheck %s
-# RUN: llvm-nm --print-file-name %t.o | FileCheck %s --check-prefix=CHECK-PRINT-FILE-NAME
+# RUN: llvm-nm %t.o 2>&1 | FileCheck %s
+# RUN: llvm-nm --print-file-name %t.o 2>&1 | FileCheck %s --check-prefix=CHECK-PRINT-FILE-NAME
!ELF
FileHeader:
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index 01d21cc5c6a..7e1fd86d0b0 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -757,22 +757,22 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName,
}
}
- auto writeFileName = [&]() {
+ auto writeFileName = [&](raw_ostream &S) {
if (!ArchitectureName.empty())
- outs() << "(for architecture " << ArchitectureName << "):";
+ S << "(for architecture " << ArchitectureName << "):";
if (OutputFormat == posix && !ArchiveName.empty())
- outs() << ArchiveName << "[" << CurrentFilename << "]: ";
+ S << ArchiveName << "[" << CurrentFilename << "]: ";
else {
if (!ArchiveName.empty())
- outs() << ArchiveName << ":";
- outs() << CurrentFilename << ": ";
+ S << ArchiveName << ":";
+ S << CurrentFilename << ": ";
}
};
if (SymbolList.empty()) {
if (PrintFileName)
- writeFileName();
- outs() << "no symbols\n";
+ writeFileName(errs());
+ errs() << "no symbols\n";
}
for (SymbolListT::iterator I = SymbolList.begin(), E = SymbolList.end();
@@ -797,7 +797,7 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName,
(Weak && NoWeakSymbols))
continue;
if (PrintFileName)
- writeFileName();
+ writeFileName(outs());
if ((JustSymbolName ||
(UndefinedOnly && MachO && OutputFormat != darwin)) &&
OutputFormat != posix) {
OpenPOWER on IntegriCloud