@@ -650,7 +650,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
650
650
if (errorCount ())
651
651
return ;
652
652
653
- link ( args);
653
+ invokeELFT ( link , args);
654
654
}
655
655
656
656
if (config->timeTraceEnabled ) {
@@ -2711,7 +2711,7 @@ static void postParseObjectFile(ELFFileBase *file) {
2711
2711
2712
2712
// Do actual linking. Note that when this function is called,
2713
2713
// all linker scripts have already been parsed.
2714
- void LinkerDriver::link (opt::InputArgList &args) {
2714
+ template < class ELFT > void LinkerDriver::link (opt::InputArgList &args) {
2715
2715
llvm::TimeTraceScope timeScope (" Link" , StringRef (" LinkerDriver::Link" ));
2716
2716
2717
2717
// Handle --trace-symbol.
@@ -2733,7 +2733,7 @@ void LinkerDriver::link(opt::InputArgList &args) {
2733
2733
llvm::TimeTraceScope timeScope (" Parse input files" );
2734
2734
for (size_t i = 0 ; i < files.size (); ++i) {
2735
2735
llvm::TimeTraceScope timeScope (" Parse input files" , files[i]->getName ());
2736
- parseFile (files[i]);
2736
+ doParseFile<ELFT> (files[i]);
2737
2737
}
2738
2738
if (armCmseImpLib)
2739
2739
parseArmCMSEImportLib (*armCmseImpLib);
@@ -2867,15 +2867,15 @@ void LinkerDriver::link(opt::InputArgList &args) {
2867
2867
2868
2868
// Handle --lto-validate-all-vtables-have-type-infos.
2869
2869
if (config->ltoValidateAllVtablesHaveTypeInfos )
2870
- invokeELFT ( ltoValidateAllVtablesHaveTypeInfos, args);
2870
+ ltoValidateAllVtablesHaveTypeInfos<ELFT>( args);
2871
2871
2872
2872
// Do link-time optimization if given files are LLVM bitcode files.
2873
2873
// This compiles bitcode files into real object files.
2874
2874
//
2875
2875
// With this the symbol table should be complete. After this, no new names
2876
2876
// except a few linker-synthesized ones will be added to the symbol table.
2877
2877
const size_t numObjsBeforeLTO = ctx.objectFiles .size ();
2878
- invokeELFT ( compileBitcodeFiles, skipLinkedOutput);
2878
+ compileBitcodeFiles<ELFT>( skipLinkedOutput);
2879
2879
2880
2880
// Symbol resolution finished. Report backward reference problems,
2881
2881
// --print-archive-stats=, and --why-extract=.
@@ -2940,7 +2940,7 @@ void LinkerDriver::link(opt::InputArgList &args) {
2940
2940
llvm::erase_if (ctx.inputSections , [](InputSectionBase *s) {
2941
2941
if (s->type != SHT_LLVM_SYMPART)
2942
2942
return false ;
2943
- invokeELFT ( readSymbolPartitionSection, s);
2943
+ readSymbolPartitionSection<ELFT>( s);
2944
2944
return true ;
2945
2945
});
2946
2946
}
@@ -2998,10 +2998,10 @@ void LinkerDriver::link(opt::InputArgList &args) {
2998
2998
ctx.inputSections .push_back (createCommentSection ());
2999
2999
3000
3000
// Split SHF_MERGE and .eh_frame sections into pieces in preparation for garbage collection.
3001
- invokeELFT ( splitSections, );
3001
+ splitSections<ELFT>( );
3002
3002
3003
3003
// Garbage collection and removal of shared symbols from unused shared objects.
3004
- invokeELFT ( markLive, );
3004
+ markLive<ELFT>( );
3005
3005
3006
3006
// Make copies of any input sections that need to be copied into each
3007
3007
// partition.
@@ -3014,7 +3014,7 @@ void LinkerDriver::link(opt::InputArgList &args) {
3014
3014
3015
3015
// Create synthesized sections such as .got and .plt. This is called before
3016
3016
// processSectionCommands() so that they can be placed by SECTIONS commands.
3017
- invokeELFT ( createSyntheticSections, );
3017
+ createSyntheticSections<ELFT>( );
3018
3018
3019
3019
// Some input sections that are used for exception handling need to be moved
3020
3020
// into synthetic sections. Do that now so that they aren't assigned to
@@ -3054,18 +3054,18 @@ void LinkerDriver::link(opt::InputArgList &args) {
3054
3054
// Two input sections with different output sections should not be folded.
3055
3055
// ICF runs after processSectionCommands() so that we know the output sections.
3056
3056
if (config->icf != ICFLevel::None) {
3057
- invokeELFT ( findKeepUniqueSections, args);
3058
- invokeELFT ( doIcf, );
3057
+ findKeepUniqueSections<ELFT>( args);
3058
+ doIcf<ELFT>( );
3059
3059
}
3060
3060
3061
3061
// Read the callgraph now that we know what was gced or icfed
3062
3062
if (config->callGraphProfileSort != CGProfileSortKind::None) {
3063
3063
if (auto *arg = args.getLastArg (OPT_call_graph_ordering_file))
3064
3064
if (std::optional<MemoryBufferRef> buffer = readFile (arg->getValue ()))
3065
3065
readCallGraph (*buffer);
3066
- invokeELFT ( readCallGraphsFromObjectFiles, );
3066
+ readCallGraphsFromObjectFiles<ELFT>( );
3067
3067
}
3068
3068
3069
3069
// Write the result to the file.
3070
- invokeELFT ( writeResult, );
3070
+ writeResult<ELFT>( );
3071
3071
}
0 commit comments