summaryrefslogtreecommitdiff
path: root/tools/gold
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gold')
-rw-r--r--tools/gold/gold-plugin.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index db0db3b5b2..858af6f432 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -453,8 +453,8 @@ static ld_plugin_status all_symbols_read_hook(void) {
(*message)(LDPL_ERROR, "%s", ErrMsg.c_str());
return LDPS_ERR;
}
- raw_fd_ostream objFile(uniqueObjPath.c_str(), ErrMsg,
- raw_fd_ostream::F_Binary);
+ tool_output_file objFile(uniqueObjPath.c_str(), ErrMsg,
+ raw_fd_ostream::F_Binary);
if (!ErrMsg.empty()) {
(*message)(LDPL_ERROR, "%s", ErrMsg.c_str());
return LDPS_ERR;
@@ -462,6 +462,13 @@ static ld_plugin_status all_symbols_read_hook(void) {
objFile.write(buffer, bufsize);
objFile.close();
+ if (objFile.has_error()) {
+ (*message)(LDPL_ERROR, "Error writing output file '%s'",
+ uniqueObjPath.c_str());
+ objFile.clear_error();
+ return LDPS_ERR;
+ }
+ objFile.keep();
lto_codegen_dispose(cg);