@@ -2369,12 +2369,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
2369
2369
// except a few linker-synthesized ones will be added to the symbol table.
2370
2370
compileBitcodeFiles<ELFT>();
2371
2371
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
-
2378
2372
// Symbol resolution finished. Report backward reference problems.
2379
2373
reportBackrefs ();
2380
2374
if (errorCount ())
@@ -2392,9 +2386,18 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
2392
2386
!config->thinLTOModulesToCompile .empty ())
2393
2387
return ;
2394
2388
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
+
2395
2395
// Apply symbol renames for --wrap and combine foo@v1 and foo@@v1.
2396
2396
redirectSymbols (wrapped);
2397
2397
2398
+ // Replace common symbols with regular symbols.
2399
+ replaceCommonSymbols ();
2400
+
2398
2401
{
2399
2402
llvm::TimeTraceScope timeScope (" Aggregate sections" );
2400
2403
// Now that we have a complete list of input files.
@@ -2479,9 +2482,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
2479
2482
if (!config->relocatable )
2480
2483
inputSections.push_back (createCommentSection ());
2481
2484
2482
- // Replace common symbols with regular symbols.
2483
- replaceCommonSymbols ();
2484
-
2485
2485
// Split SHF_MERGE and .eh_frame sections into pieces in preparation for garbage collection.
2486
2486
splitSections<ELFT>();
2487
2487
0 commit comments