Call flush() after llvm_shutdown().
authorRui Ueyama <ruiu@google.com>
Fri, 11 Nov 2016 02:16:15 +0000 (02:16 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 11 Nov 2016 02:16:15 +0000 (02:16 +0000)
llvm_shutdown could write something to outs or errs,
so we need to flush them after calling llvm_shutdown.

llvm-svn: 286548

lld/ELF/Error.cpp

index 87d633b..d56229d 100644 (file)
@@ -49,14 +49,13 @@ void elf::error(std::error_code EC, const Twine &Prefix) {
 }
 
 void elf::exitLld(int Val) {
-  outs().flush();
-  errs().flush();
-
   // Dealloc/destroy ManagedStatic variables before calling
   // _exit(). In a non-LTO build, this is a nop. In an LTO
   // build allows us to get the output of -time-passes.
   llvm_shutdown();
 
+  outs().flush();
+  errs().flush();
   _exit(Val);
 }