@@ -2964,31 +2964,22 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootErro
29642964 }
29652965}
29662966
2967- /// When using the linker flavors opting in to `lld`, or the unstable `-Zgcc-ld=lld` flag, add the
2968- /// necessary paths and arguments to invoke it:
2967+ /// When using the linker flavors opting in to `lld`, add the necessary paths and arguments to
2968+ /// invoke it:
29692969/// - when the self-contained linker flag is active: the build of `lld` distributed with rustc,
29702970/// - or any `lld` available to `cc`.
29712971fn add_lld_args ( cmd : & mut dyn Linker , sess : & Session , flavor : LinkerFlavor ) {
2972- let unstable_use_lld = sess. opts . unstable_opts . gcc_ld . is_some ( ) ;
2973- debug ! ( "add_lld_args requested, flavor: '{flavor:?}', `-Zgcc-ld=lld`: {unstable_use_lld}" ) ;
2974-
2975- // Sanity check: using the old unstable `-Zgcc-ld=lld` option requires a `cc`-using flavor.
2976- let flavor_uses_cc = flavor. uses_cc ( ) ;
2977- if unstable_use_lld && !flavor_uses_cc {
2978- sess. emit_fatal ( errors:: OptionGccOnly ) ;
2979- }
2972+ debug ! ( "add_lld_args requested, flavor: '{flavor:?}'" ) ;
29802973
29812974 // If the flavor doesn't use a C/C++ compiler to invoke the linker, or doesn't opt in to `lld`,
29822975 // we don't need to do anything.
2983- let use_lld = flavor. uses_lld ( ) || unstable_use_lld;
2984- if !flavor_uses_cc || !use_lld {
2976+ if !( flavor. uses_cc ( ) && flavor. uses_lld ( ) ) {
29852977 return ;
29862978 }
29872979
29882980 // 1. Implement the "self-contained" part of this feature by adding rustc distribution
29892981 // directories to the tool's search path.
2990- let self_contained_linker = sess. opts . cg . link_self_contained . linker ( ) || unstable_use_lld;
2991- if self_contained_linker {
2982+ if sess. opts . cg . link_self_contained . linker ( ) {
29922983 for path in sess. get_tools_search_paths ( false ) {
29932984 cmd. arg ( {
29942985 let mut arg = OsString :: from ( "-B" ) ;
@@ -3012,13 +3003,13 @@ fn add_lld_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
30123003 // shown in issue #101653 and the discussion in PR #101792.
30133004 //
30143005 // It could be required in some cases of cross-compiling with
3015- // `-Zgcc-ld=lld` , but this is generally unspecified, and we don't know
3006+ // LLD , but this is generally unspecified, and we don't know
30163007 // which specific versions of clang, macOS SDK, host and target OS
30173008 // combinations impact us here.
30183009 //
30193010 // So we do a simple first-approximation until we know more of what the
30203011 // Apple targets require (and which would be handled prior to hitting this
3021- // `-Zgcc-ld=lld` codepath anyway), but the expectation is that until then
3012+ // LLD codepath anyway), but the expectation is that until then
30223013 // this should be manually passed if needed. We specify the target when
30233014 // targeting a different linker flavor on macOS, and that's also always
30243015 // the case when targeting WASM.
0 commit comments