@@ -2369,12 +2369,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
23692369 // except a few linker-synthesized ones will be added to the symbol table.
23702370 compileBitcodeFiles<ELFT>();
23712371
2372- // Handle --exclude-libs again because lto.tmp may reference additional
2373- // libcalls symbols defined in an excluded archive. This may override
2374- // versionId set by scanVersionScript().
2375- if (args.hasArg (OPT_exclude_libs))
2376- excludeLibs (args);
2377-
23782372 // Symbol resolution finished. Report backward reference problems.
23792373 reportBackrefs ();
23802374 if (errorCount ())
@@ -2392,9 +2386,18 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
23922386 !config->thinLTOModulesToCompile .empty ())
23932387 return ;
23942388
2389+ // Handle --exclude-libs again because lto.tmp may reference additional
2390+ // libcalls symbols defined in an excluded archive. This may override
2391+ // versionId set by scanVersionScript().
2392+ if (args.hasArg (OPT_exclude_libs))
2393+ excludeLibs (args);
2394+
23952395 // Apply symbol renames for --wrap and combine foo@v1 and foo@@v1.
23962396 redirectSymbols (wrapped);
23972397
2398+ // Replace common symbols with regular symbols.
2399+ replaceCommonSymbols ();
2400+
23982401 {
23992402 llvm::TimeTraceScope timeScope (" Aggregate sections" );
24002403 // Now that we have a complete list of input files.
@@ -2479,9 +2482,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
24792482 if (!config->relocatable )
24802483 inputSections.push_back (createCommentSection ());
24812484
2482- // Replace common symbols with regular symbols.
2483- replaceCommonSymbols ();
2484-
24852485 // Split SHF_MERGE and .eh_frame sections into pieces in preparation for garbage collection.
24862486 splitSections<ELFT>();
24872487
0 commit comments