@@ -464,6 +464,9 @@ struct TargetOverrideCtx {
464464 const mcpp::manifest::TargetEntry* sectionEntry = nullptr ;
465465 bool hasExplicitSection = false ;
466466 bool hasToolchainOverride = false ;
467+ // The target came from the configuration's `default_target`, beside its
468+ // `[toolchain] default`: a pair the configuration states.
469+ bool targetFromGlobalDefault = false ;
467470 const mcpp::toolchain::triple::TargetInfo* known = nullptr ;
468471};
469472
@@ -869,8 +872,13 @@ step1_target_row_pin_and_capability_check(PrepareState& state, TargetOverrideCtx
869872 state.targetRowPin = std::string (ctx.known ->pin );
870873 state.targetRowName = ctx.parsed ->str ();
871874 }
875+ // A pair the configuration states for this machine's own target is kept
876+ // (`configured_native_pair`).
877+ const bool configuredNativePair = ctx.parsed
878+ && configured_native_pair (ctx.targetFromGlobalDefault , state.tcOrigin , *ctx.parsed ,
879+ mcpp::toolchain::triple::host_triple ());
872880 if (ctx.known && !ctx.hasToolchainOverride && !ctx.known ->pin .empty ()
873- && !tc_origin_is_user_explicit (state.tcOrigin )) {
881+ && !tc_origin_is_user_explicit (state.tcOrigin ) && !configuredNativePair ) {
874882 state.targetPinCandidate = std::string (ctx.known ->pin );
875883 state.targetPinIsCapability = ctx.parsed && ctx.parsed ->pin_is_capability ();
876884 }
@@ -1012,6 +1020,7 @@ static std::expected<void, std::string> step1_target_and_static_overrides(Prepar
10121020 // override and the vocabulary-table convention (pin + default linkage).
10131021 if (!state.overrides .target_triple .empty ()) {
10141022 TargetOverrideCtx ctx;
1023+ ctx.targetFromGlobalDefault = targetFromGlobalDefault;
10151024 if (auto r = step1_resolve_target_triple_request (state, ctx); !r)
10161025 return std::unexpected (r.error ());
10171026 if (auto r = step1_validate_target_tier (state, ctx); !r)
0 commit comments