Change:
Currently, codegen backends are installed as e.g. As there is no hash or such in the library name (like there is for all the rust libraries shipped with rustc), installing several versions of rust is not possible as there would be a file conflict. On exherbo we can install rust stable, rust beta and rust nightly, but with these codegen backends we cannot anymore. It would be great to either have a hash in the library name, or to be able to change to e.g. in at build time, for example. Would such a patch be accepted? Which of the two options would be preferred?

Discussion:
# bootstrap) #codegen-backends = ["llvm"] <ins> # This is the name of the directory in which codegen backends will get installed #codegen-backends-dir = "codegen-backends" </ins> # Flag indicating whether `libstd` calls an imported function to handle basic IO # when targeting WebAssembly. Enable this to debug tests for the `wasm32-unknown-unknown` # target, as without this option the test output will not be captured.

pub fn sysroot_codegen_backends(&self, compiler: Compiler) -> PathBuf { self.sysroot_libdir(compiler, compiler.host) <del> .with_file_name("codegen-backends") </del> <ins> .with_file_name(self.build.config.rust_codegen_backends_dir.clone()) </ins> } /// Returns the compiler's libdir where it stores the dynamic libraries that

cargo.env("CFG_RELEASE", build.rust_release()) .env("CFG_RELEASE_CHANNEL", &build.config.channel) .env("CFG_VERSION", build.rust_version()) <del> .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()); </del> <ins> .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()) .env("CFG_CODEGEN_BACKENDS_DIR", &build.config.rust_codegen_backends_dir); </ins> let libdir_relative = build.config.libdir_relative().unwrap_or(Path::new("lib")); cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);

pub rust_debuginfo_tests: bool, pub rust_dist_src: bool, pub rust_codegen_backends: Vec<Interned<String>>, <ins> pub rust_codegen_backends_dir: String, </ins> pub build: Interned<String>, pub hosts: Vec<Interned<String>>,

test_miri: Option<bool>, save_toolstates: Option<String>, codegen_backends: Option<Vec<String>>, <ins> codegen_backends_dir: Option<String>, </ins> wasm_syscall: Option<bool>, }

config.rust_dist_src = true; config.test_miri = false; config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")]; <ins> config.rust_codegen_backends_dir = "codegen-backends".to_owned(); </ins> config.rustc_error_format = flags.rustc_error_format; config.on_fail = flags.on_fail;

.collect(); } <ins> set(&mut config.rust_codegen_backends_dir, rust.codegen_backends_dir.clone()); </ins> match rust.codegen_units { Some(0) => config.rust_codegen_units = Some(num_cpus::get() as u32), Some(n) => config.rust_codegen_units = Some(n),

let mut src = builder.sysroot_libdir(compiler, target).to_path_buf(); src.pop(); // Remove the trailing /lib folder from the sysroot_libdir cp_filtered(&src, &dst, &|path| { <del> path.file_name().and_then(|s| s.to_str()) != Some("codegen-backends") </del> <ins> path.file_name().and_then(|s| s.to_str()) != Some(build.config.rust_codegen_backends_dir.as_str()) </ins> }); let mut cmd = rust_installer(builder);

let sysroot = sysroot_candidates.iter() .map(|sysroot| { let libdir = filesearch::relative_target_lib_path(&sysroot, &target); <del> sysroot.join(libdir).with_file_name("codegen-backends") </del> <ins> sysroot.join(libdir) .with_file_name(option_env!("CFG_CODEGEN_BACKENDS_DIR") .unwrap_or("codegen-backends")) </ins> }) .filter(|f| { info!("codegen backend candidate: {}", f.display());