llvm.org GIT mirror llvm / 59349ad
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212303 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 6 years ago
1 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
135135 extern "C" ld_plugin_status onload(ld_plugin_tv *tv);
136136 ld_plugin_status onload(ld_plugin_tv *tv) {
137 InitializeAllTargetInfos();
138 InitializeAllTargets();
139 InitializeAllTargetMCs();
140 InitializeAllAsmParsers();
141 InitializeAllAsmPrinters();
137143 // We're given a pointer to the first transfer vector. We read through them
138144 // until we find one where tv_tag == LDPT_NULL. The REGISTER_* tagged values
139145 // contain pointers to functions that we need to call to register our own
227233 if (!RegisteredAllSymbolsRead)
228234 return LDPS_OK;
230 InitializeAllTargetInfos();
231 InitializeAllTargets();
232 InitializeAllTargetMCs();
233 InitializeAllAsmParsers();
234 InitializeAllAsmPrinters();
235236 CodeGen = new LTOCodeGenerator();
237238 // Pass through extra options to the code generator.