diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 2c6257a0323..343a73988d1 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -135,6 +135,12 @@ static ld_plugin_status cleanup_hook(void); 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.