[llvm] r212303 - gold plugin: move target initialization to the top of the onload function.

Peter Collingbourne peter at pcc.me.uk
Thu Jul 3 16:28:03 PDT 2014


Author: pcc
Date: Thu Jul  3 18:28:03 2014
New Revision: 212303

URL: http://llvm.org/viewvc/llvm-project?rev=212303&view=rev
Log:
gold plugin: move target initialization to the top of the onload function.

On at least my machine, ar does not register an all symbols read hook (which
previously triggered target initialization), but it does register a claim
files hook, which depends on the targets being initialized.

Differential Revision: http://reviews.llvm.org/D4372

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=212303&r1=212302&r2=212303&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Jul  3 18:28:03 2014
@@ -135,6 +135,12 @@ static ld_plugin_status cleanup_hook(voi
 
 extern "C" ld_plugin_status onload(ld_plugin_tv *tv);
 ld_plugin_status onload(ld_plugin_tv *tv) {
+  InitializeAllTargetInfos();
+  InitializeAllTargets();
+  InitializeAllTargetMCs();
+  InitializeAllAsmParsers();
+  InitializeAllAsmPrinters();
+
   // We're given a pointer to the first transfer vector. We read through them
   // until we find one where tv_tag == LDPT_NULL. The REGISTER_* tagged values
   // contain pointers to functions that we need to call to register our own
@@ -228,11 +234,6 @@ ld_plugin_status onload(ld_plugin_tv *tv
   if (!RegisteredAllSymbolsRead)
     return LDPS_OK;
 
-  InitializeAllTargetInfos();
-  InitializeAllTargets();
-  InitializeAllTargetMCs();
-  InitializeAllAsmParsers();
-  InitializeAllAsmPrinters();
   CodeGen = new LTOCodeGenerator();
 
   // Pass through extra options to the code generator.





More information about the llvm-commits mailing list