@@ -24,8 +24,8 @@ use crate::core::config::flags::{Subcommand, get_completion};
2424use crate :: utils:: build_stamp:: { self , BuildStamp } ;
2525use crate :: utils:: exec:: { BootstrapCommand , command} ;
2626use crate :: utils:: helpers:: {
27- self , LldThreads , add_link_lib_path , add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
28- linker_args , linker_flags, t, target_supports_cranelift_backend, up_to_date,
27+ self , LldThreads , add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var, linker_args ,
28+ linker_flags, t, target_supports_cranelift_backend, up_to_date,
2929} ;
3030use crate :: utils:: render_tests:: { add_flags_and_try_run_tests, try_run_tests} ;
3131use crate :: { CLang , DocTests , GitRepo , Mode , PathSet , envify} ;
@@ -1975,11 +1975,17 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
19751975 // Tests that use compiler libraries may inherit the `-lLLVM` link
19761976 // requirement, but the `-L` library path is not propagated across
19771977 // separate compilations. We can add LLVM's library path to the
1978- // platform-specific environment variable as a workaround.
1978+ // rustc args as a workaround.
19791979 if !builder. config . dry_run ( ) && suite. ends_with ( "fulldeps" ) {
19801980 let llvm_libdir =
19811981 command ( & llvm_config) . arg ( "--libdir" ) . run_capture_stdout ( builder) . stdout ( ) ;
1982- add_link_lib_path ( vec ! [ llvm_libdir. trim( ) . into( ) ] , & mut cmd) ;
1982+ let mut rustflags = env:: var ( "RUSTFLAGS" ) . unwrap_or_default ( ) ;
1983+ if target. is_msvc ( ) {
1984+ rustflags. push_str ( & format ! ( "-Clink-arg=-LIBPATH:{llvm_libdir}" ) ) ;
1985+ } else {
1986+ rustflags. push_str ( & format ! ( "-Clink-arg=-L{llvm_libdir}" ) ) ;
1987+ }
1988+ cmd. env ( "RUSTFLAGS" , rustflags) ;
19831989 }
19841990
19851991 if !builder. config . dry_run ( ) && matches ! ( mode, "run-make" | "coverage-run" ) {
0 commit comments