@@ -596,17 +596,7 @@ void LinkerDriver::setMachine(MachineTypes machine) {
596596 assert (machine != IMAGE_FILE_MACHINE_UNKNOWN);
597597
598598 ctx.config .machine = machine;
599-
600- if (machine != ARM64X) {
601- ctx.symtab .machine = machine;
602- if (machine == ARM64EC)
603- ctx.symtabEC = &ctx.symtab ;
604- } else {
605- ctx.symtab .machine = ARM64;
606- ctx.hybridSymtab .emplace (ctx, ARM64EC);
607- ctx.symtabEC = &*ctx.hybridSymtab ;
608- }
609-
599+ ctx.symtab .machine = machine;
610600 addWinSysRootLibSearchPaths ();
611601}
612602
@@ -2529,56 +2519,54 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
25292519 if (config->imageBase == uint64_t (-1 ))
25302520 config->imageBase = getDefaultImageBase ();
25312521
2532- ctx.forEachSymtab ([&](SymbolTable &symtab) {
2533- symtab.addSynthetic (mangle (" __ImageBase" ), nullptr );
2534- if (symtab.machine == I386) {
2535- symtab.addAbsolute (" ___safe_se_handler_table" , 0 );
2536- symtab.addAbsolute (" ___safe_se_handler_count" , 0 );
2537- }
2538-
2539- symtab.addAbsolute (mangle (" __guard_fids_count" ), 0 );
2540- symtab.addAbsolute (mangle (" __guard_fids_table" ), 0 );
2541- symtab.addAbsolute (mangle (" __guard_flags" ), 0 );
2542- symtab.addAbsolute (mangle (" __guard_iat_count" ), 0 );
2543- symtab.addAbsolute (mangle (" __guard_iat_table" ), 0 );
2544- symtab.addAbsolute (mangle (" __guard_longjmp_count" ), 0 );
2545- symtab.addAbsolute (mangle (" __guard_longjmp_table" ), 0 );
2546- // Needed for MSVC 2017 15.5 CRT.
2547- symtab.addAbsolute (mangle (" __enclave_config" ), 0 );
2548- // Needed for MSVC 2019 16.8 CRT.
2549- symtab.addAbsolute (mangle (" __guard_eh_cont_count" ), 0 );
2550- symtab.addAbsolute (mangle (" __guard_eh_cont_table" ), 0 );
2551-
2552- if (isArm64EC (ctx.config .machine )) {
2553- symtab.addAbsolute (" __arm64x_extra_rfe_table" , 0 );
2554- symtab.addAbsolute (" __arm64x_extra_rfe_table_size" , 0 );
2555- symtab.addAbsolute (" __arm64x_redirection_metadata" , 0 );
2556- symtab.addAbsolute (" __arm64x_redirection_metadata_count" , 0 );
2557- symtab.addAbsolute (" __hybrid_auxiliary_delayload_iat_copy" , 0 );
2558- symtab.addAbsolute (" __hybrid_auxiliary_delayload_iat" , 0 );
2559- symtab.addAbsolute (" __hybrid_auxiliary_iat" , 0 );
2560- symtab.addAbsolute (" __hybrid_auxiliary_iat_copy" , 0 );
2561- symtab.addAbsolute (" __hybrid_code_map" , 0 );
2562- symtab.addAbsolute (" __hybrid_code_map_count" , 0 );
2563- symtab.addAbsolute (" __hybrid_image_info_bitfield" , 0 );
2564- symtab.addAbsolute (" __x64_code_ranges_to_entry_points" , 0 );
2565- symtab.addAbsolute (" __x64_code_ranges_to_entry_points_count" , 0 );
2566- symtab.addSynthetic (" __guard_check_icall_a64n_fptr" , nullptr );
2567- symtab.addSynthetic (" __arm64x_native_entrypoint" , nullptr );
2568- }
2569-
2570- if (config->pseudoRelocs ) {
2571- symtab.addAbsolute (mangle (" __RUNTIME_PSEUDO_RELOC_LIST__" ), 0 );
2572- symtab.addAbsolute (mangle (" __RUNTIME_PSEUDO_RELOC_LIST_END__" ), 0 );
2573- }
2574- if (config->mingw ) {
2575- symtab.addAbsolute (mangle (" __CTOR_LIST__" ), 0 );
2576- symtab.addAbsolute (mangle (" __DTOR_LIST__" ), 0 );
2577- }
2578- if (config->debug || config->buildIDHash != BuildIDHash::None)
2579- if (symtab.findUnderscore (" __buildid" ))
2580- symtab.addUndefined (mangle (" __buildid" ));
2581- });
2522+ ctx.symtab .addSynthetic (mangle (" __ImageBase" ), nullptr );
2523+ if (config->machine == I386) {
2524+ ctx.symtab .addAbsolute (" ___safe_se_handler_table" , 0 );
2525+ ctx.symtab .addAbsolute (" ___safe_se_handler_count" , 0 );
2526+ }
2527+
2528+ ctx.symtab .addAbsolute (mangle (" __guard_fids_count" ), 0 );
2529+ ctx.symtab .addAbsolute (mangle (" __guard_fids_table" ), 0 );
2530+ ctx.symtab .addAbsolute (mangle (" __guard_flags" ), 0 );
2531+ ctx.symtab .addAbsolute (mangle (" __guard_iat_count" ), 0 );
2532+ ctx.symtab .addAbsolute (mangle (" __guard_iat_table" ), 0 );
2533+ ctx.symtab .addAbsolute (mangle (" __guard_longjmp_count" ), 0 );
2534+ ctx.symtab .addAbsolute (mangle (" __guard_longjmp_table" ), 0 );
2535+ // Needed for MSVC 2017 15.5 CRT.
2536+ ctx.symtab .addAbsolute (mangle (" __enclave_config" ), 0 );
2537+ // Needed for MSVC 2019 16.8 CRT.
2538+ ctx.symtab .addAbsolute (mangle (" __guard_eh_cont_count" ), 0 );
2539+ ctx.symtab .addAbsolute (mangle (" __guard_eh_cont_table" ), 0 );
2540+
2541+ if (isArm64EC (config->machine )) {
2542+ ctx.symtab .addAbsolute (" __arm64x_extra_rfe_table" , 0 );
2543+ ctx.symtab .addAbsolute (" __arm64x_extra_rfe_table_size" , 0 );
2544+ ctx.symtab .addAbsolute (" __arm64x_redirection_metadata" , 0 );
2545+ ctx.symtab .addAbsolute (" __arm64x_redirection_metadata_count" , 0 );
2546+ ctx.symtab .addAbsolute (" __hybrid_auxiliary_delayload_iat_copy" , 0 );
2547+ ctx.symtab .addAbsolute (" __hybrid_auxiliary_delayload_iat" , 0 );
2548+ ctx.symtab .addAbsolute (" __hybrid_auxiliary_iat" , 0 );
2549+ ctx.symtab .addAbsolute (" __hybrid_auxiliary_iat_copy" , 0 );
2550+ ctx.symtab .addAbsolute (" __hybrid_code_map" , 0 );
2551+ ctx.symtab .addAbsolute (" __hybrid_code_map_count" , 0 );
2552+ ctx.symtab .addAbsolute (" __hybrid_image_info_bitfield" , 0 );
2553+ ctx.symtab .addAbsolute (" __x64_code_ranges_to_entry_points" , 0 );
2554+ ctx.symtab .addAbsolute (" __x64_code_ranges_to_entry_points_count" , 0 );
2555+ ctx.symtab .addSynthetic (" __guard_check_icall_a64n_fptr" , nullptr );
2556+ ctx.symtab .addSynthetic (" __arm64x_native_entrypoint" , nullptr );
2557+ }
2558+
2559+ if (config->pseudoRelocs ) {
2560+ ctx.symtab .addAbsolute (mangle (" __RUNTIME_PSEUDO_RELOC_LIST__" ), 0 );
2561+ ctx.symtab .addAbsolute (mangle (" __RUNTIME_PSEUDO_RELOC_LIST_END__" ), 0 );
2562+ }
2563+ if (config->mingw ) {
2564+ ctx.symtab .addAbsolute (mangle (" __CTOR_LIST__" ), 0 );
2565+ ctx.symtab .addAbsolute (mangle (" __DTOR_LIST__" ), 0 );
2566+ }
2567+ if (config->debug || config->buildIDHash != BuildIDHash::None)
2568+ if (ctx.symtab .findUnderscore (" __buildid" ))
2569+ ctx.symtab .addUndefined (mangle (" __buildid" ));
25822570
25832571 // This code may add new undefined symbols to the link, which may enqueue more
25842572 // symbol resolution tasks, so we need to continue executing tasks until we
@@ -2821,8 +2809,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
28212809 if (auto *arg = args.getLastArg (OPT_print_symbol_order))
28222810 config->printSymbolOrder = arg->getValue ();
28232811
2824- if (ctx.symtabEC )
2825- ctx.symtabEC ->initializeECThunks ();
2812+ ctx.symtab .initializeECThunks ();
28262813
28272814 // Identify unreferenced COMDAT sections.
28282815 if (config->doGC ) {
0 commit comments