Fix clang cc1as crash for asm output
Steven Wu
stevenwu at apple.com
Thu Jul 23 15:03:05 PDT 2015
Hi Rafael
This looks like a fallout from your ostream rewrite. In clang cc1as_main, when the output file type is “asm”, AsmStreamer owns a formatted_raw_ostream which has a reference to FDOS (raw_ostream), so AsmStreamer must be closed before FDOS. Here is the patch.
Thanks
Steven
From f930e3d8a8c7da74de6000bb3b80f90efc5615ff Mon Sep 17 00:00:00 2001
From: Steven Wu <stevenwu at apple.com>
Date: Thu, 23 Jul 2015 14:48:24 -0700
Subject: [PATCH 1/2] Fix the cc1as crash when it outputs assembly
---
tools/driver/cc1as_main.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp
index aa92541..fd0fbb4 100644
--- a/tools/driver/cc1as_main.cpp
+++ b/tools/driver/cc1as_main.cpp
@@ -406,6 +406,9 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
Failed = Parser->Run(Opts.NoInitialTextSection);
}
+ // Close Streamer first.
+ // It might have a reference to the output stream.
+ Str.reset();
// Close the output stream early.
BOS.reset();
FDOS.reset();
--
2.3.8 (Apple Git-58)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-the-cc1as-crash-when-it-outputs-assembly.patch
Type: application/octet-stream
Size: 788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150723/98c9138a/attachment.obj>
More information about the cfe-commits
mailing list