gold plugin: report errors occured in lto_module_create_from_*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139340 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 8cb4fb4..a42ce4f 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -251,8 +251,13 @@
} else {
M = lto_module_create_from_fd(file->fd, file->name, file->filesize);
}
- if (!M)
+ if (!M) {
+ if (const char* msg = lto_get_error_message()) {
+ (*message)(LDPL_ERROR, "Failed to create LTO module: %s", msg);
+ return LDPS_ERR;
+ }
return LDPS_OK;
+ }
*claimed = 1;
Modules.resize(Modules.size() + 1);