[PATCH] D64165: [llvm-objdump] Keep warning for --disassemble-functions in correct order.
Yuanfang Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 16:10:52 PDT 2019
ychen created this revision.
ychen added reviewers: jhenderson, grimar, MaskRay, rupprecht.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
relative to normal output when dumping archive files.
prepare for PR35351.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D64165
Files:
llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -381,8 +381,12 @@
errs().flush();
}
-void warn(Twine Message) {
- WithColor::warning(errs(), ToolName) << Message << "\n";
+static void warn(Twine Message, StringRef Prefix = "") {
+ // Output order between errs() and outs() matters especially for archive
+ // files where the output is per member object.
+ outs().flush();
+ WithColor::warning(errs(), Prefix) << Message << "\n";
+ errs().flush();
}
LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message) {
Index: llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
+++ llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
@@ -1,5 +1,11 @@
## Warn if --disassemble-functions specifies an unknown symbol.
-# RUN: yaml2obj %s | llvm-objdump - --disassemble-functions=foo 2>&1 | FileCheck %s
+
+# RUN: yaml2obj -o %t.1.o %s
+# RUN: yaml2obj -o %t.2.o %s
+# RUN: rm -f %t.a
+# RUN: llvm-ar rc %t.a %t.1.o %t.2.o
+# RUN: llvm-objdump --disassemble-functions=foo %t.1.o 2>&1 | FileCheck %s
+# RUN: llvm-objdump --disassemble-functions=foo %t.a 2>&1 | FileCheck %s --check-prefix=MULTI
--- !ELF
FileHeader:
@@ -9,3 +15,8 @@
Machine: EM_X86_64
# CHECK: warning: failed to disassemble missing function foo
+
+# MULTI: file format ELF64-x86-64
+# MULTI: warning: failed to disassemble missing function foo
+# MULTI: file format ELF64-x86-64
+# MULTI: warning: failed to disassemble missing function foo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64165.207910.patch
Type: text/x-patch
Size: 1754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190703/e5283a5a/attachment.bin>
More information about the llvm-commits
mailing list