gold plugin: report errors occured in lto_module_create_from_*
authorIvan Krasin <krasin@chromium.org>
Fri, 9 Sep 2011 00:14:04 +0000 (00:14 +0000)
committerIvan Krasin <krasin@chromium.org>
Fri, 9 Sep 2011 00:14:04 +0000 (00:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139340 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gold/gold-plugin.cpp

index 8cb4fb4bca4154a40fbc42a49943008d014be374..a42ce4f3e8d98187e08d3788b646ae05d5f32865 100644 (file)
@@ -251,8 +251,13 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
   } 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);