Check for errors when calling lto_codegen_add_module in the gold plugin.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 18 Oct 2013 19:32:06 +0000 (19:32 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 18 Oct 2013 19:32:06 +0000 (19:32 +0000)
Thanks to Milan LenĨo for noticing it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192996 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gold/gold-plugin.cpp

index 826173938a1254d70eb7f31a5d46b6768c61d835..360ec07e790292f693e1587768cb6999a7ec8e2b 100644 (file)
@@ -351,8 +351,13 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
     }
   }
 
     }
   }
 
-  if (code_gen)
-    lto_codegen_add_module(code_gen, M);
+  if (code_gen) {
+    if (lto_codegen_add_module(code_gen, M)) {
+      (*message)(LDPL_ERROR, "Error linking module: %s",
+                 lto_get_error_message());
+      return LDPS_ERR;
+    }
+  }
 
   lto_module_dispose(M);
 
 
   lto_module_dispose(M);