; 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].
; 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
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
; 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
# 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:
}
}
- 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();
(Weak && NoWeakSymbols))
continue;
if (PrintFileName)
- writeFileName();
+ writeFileName(outs());
if ((JustSymbolName ||
(UndefinedOnly && MachO && OutputFormat != darwin)) &&
OutputFormat != posix) {