Build rtstartup for none sysroot too
Even mini_core needs it
This commit is contained in:
parent
fd83b27945
commit
280dffd82c
@ -129,7 +129,8 @@ fn build_sysroot_for_triple(
|
||||
sysroot_kind: SysrootKind,
|
||||
) -> SysrootTarget {
|
||||
match sysroot_kind {
|
||||
SysrootKind::None => SysrootTarget { triple: compiler.triple, libs: vec![] },
|
||||
SysrootKind::None => build_rtstartup(dirs, &compiler)
|
||||
.unwrap_or(SysrootTarget { triple: compiler.triple, libs: vec![] }),
|
||||
SysrootKind::Llvm => build_llvm_sysroot_for_triple(compiler),
|
||||
SysrootKind::Clif => {
|
||||
build_clif_sysroot_for_triple(dirs, channel, compiler, &cg_clif_dylib_path)
|
||||
@ -198,31 +199,10 @@ fn build_clif_sysroot_for_triple(
|
||||
|
||||
let mut target_libs = SysrootTarget { triple: compiler.triple.clone(), libs: vec![] };
|
||||
|
||||
if compiler.triple.ends_with("windows-gnu") {
|
||||
eprintln!("[BUILD] rtstartup for {}", compiler.triple);
|
||||
|
||||
RTSTARTUP_SYSROOT.ensure_fresh(dirs);
|
||||
|
||||
let rtstartup_src = SYSROOT_SRC.to_path(dirs).join("library").join("rtstartup");
|
||||
let mut rtstartup_target_libs =
|
||||
SysrootTarget { triple: compiler.triple.clone(), libs: vec![] };
|
||||
|
||||
for file in ["rsbegin", "rsend"] {
|
||||
let obj = RTSTARTUP_SYSROOT.to_path(dirs).join(format!("{file}.o"));
|
||||
let mut build_rtstartup_cmd = Command::new(&compiler.rustc);
|
||||
build_rtstartup_cmd
|
||||
.arg("--target")
|
||||
.arg(&compiler.triple)
|
||||
.arg("--emit=obj")
|
||||
.arg("-o")
|
||||
.arg(&obj)
|
||||
.arg(rtstartup_src.join(format!("{file}.rs")));
|
||||
spawn_and_wait(build_rtstartup_cmd);
|
||||
rtstartup_target_libs.libs.push(obj.clone());
|
||||
target_libs.libs.push(obj);
|
||||
}
|
||||
|
||||
if let Some(rtstartup_target_libs) = build_rtstartup(dirs, &compiler) {
|
||||
rtstartup_target_libs.install_into_sysroot(&RTSTARTUP_SYSROOT.to_path(dirs));
|
||||
|
||||
target_libs.libs.extend(rtstartup_target_libs.libs);
|
||||
}
|
||||
|
||||
let build_dir = STANDARD_LIBRARY.target_dir(dirs).join(&compiler.triple).join(channel);
|
||||
@ -266,3 +246,30 @@ fn build_clif_sysroot_for_triple(
|
||||
|
||||
target_libs
|
||||
}
|
||||
|
||||
fn build_rtstartup(dirs: &Dirs, compiler: &Compiler) -> Option<SysrootTarget> {
|
||||
if !compiler.triple.ends_with("windows-gnu") {
|
||||
return None;
|
||||
}
|
||||
|
||||
RTSTARTUP_SYSROOT.ensure_fresh(dirs);
|
||||
|
||||
let rtstartup_src = SYSROOT_SRC.to_path(dirs).join("library").join("rtstartup");
|
||||
let mut target_libs = SysrootTarget { triple: compiler.triple.clone(), libs: vec![] };
|
||||
|
||||
for file in ["rsbegin", "rsend"] {
|
||||
let obj = RTSTARTUP_SYSROOT.to_path(dirs).join(format!("{file}.o"));
|
||||
let mut build_rtstartup_cmd = Command::new(&compiler.rustc);
|
||||
build_rtstartup_cmd
|
||||
.arg("--target")
|
||||
.arg(&compiler.triple)
|
||||
.arg("--emit=obj")
|
||||
.arg("-o")
|
||||
.arg(&obj)
|
||||
.arg(rtstartup_src.join(format!("{file}.rs")));
|
||||
spawn_and_wait(build_rtstartup_cmd);
|
||||
target_libs.libs.push(obj.clone());
|
||||
}
|
||||
|
||||
Some(target_libs)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user