1
Fork 0

Merge commit '69b3f5a426' into sync_cg_clif-2024-08-09

This commit is contained in:
bjorn3 2024-08-09 17:18:46 +00:00
commit af7ea3135d
29 changed files with 399 additions and 851 deletions

View file

@ -1,4 +1,4 @@
use crate::path::Dirs;
use crate::path::{Dirs, RelPath};
use crate::prepare::GitRepo;
use crate::utils::{spawn_and_wait, CargoProject, Compiler};
use crate::{build_sysroot, CodegenBackend, SysrootKind};
@ -6,8 +6,8 @@ use crate::{build_sysroot, CodegenBackend, SysrootKind};
static ABI_CAFE_REPO: GitRepo = GitRepo::github(
"Gankra",
"abi-cafe",
"4c6dc8c9c687e2b3a760ff2176ce236872b37212",
"588df6d66abbe105",
"f1220cfd13b57f5c0082c26529163865ee25e115",
"fe93a9acd461425d",
"abi-cafe",
);
@ -21,6 +21,7 @@ pub(crate) fn run(
rustup_toolchain_name: Option<&str>,
bootstrap_host_compiler: &Compiler,
) {
RelPath::DOWNLOAD.ensure_exists(dirs);
ABI_CAFE_REPO.fetch(dirs);
ABI_CAFE_REPO.patch(dirs);
@ -38,17 +39,23 @@ pub(crate) fn run(
eprintln!("Running abi-cafe");
let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
let mut cmd = ABI_CAFE.run(bootstrap_host_compiler, dirs);
cmd.arg("--");
cmd.arg("--pairs");
cmd.args(
let pairs =
if cfg!(not(any(target_os = "macos", all(target_os = "windows", target_env = "msvc")))) {
&pairs[..]
} else {
&pairs[..2]
},
);
};
let mut cmd = ABI_CAFE.run(bootstrap_host_compiler, dirs);
cmd.arg("--");
// stdcall, vectorcall and such don't work yet
cmd.arg("--conventions").arg("c").arg("--conventions").arg("rust");
for pair in pairs {
cmd.arg("--pairs").arg(pair);
}
cmd.arg("--add-rustc-codegen-backend");
match cg_clif_dylib {
CodegenBackend::Local(path) => {
@ -58,6 +65,7 @@ pub(crate) fn run(
cmd.arg(format!("cgclif:{name}"));
}
}
cmd.current_dir(ABI_CAFE.source_dir(dirs));
spawn_and_wait(cmd);

View file

@ -312,7 +312,6 @@ fn build_rtstartup(dirs: &Dirs, compiler: &Compiler) -> Option<SysrootTarget> {
let obj = RTSTARTUP_SYSROOT.to_path(dirs).join(format!("{file}.o"));
let mut build_rtstartup_cmd = Command::new(&compiler.rustc);
build_rtstartup_cmd
.arg("-Ainternal_features") // Missing #[allow(internal_features)]
.arg("--target")
.arg(&compiler.triple)
.arg("--emit=obj")

View file

@ -22,36 +22,6 @@ pub(crate) fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
assert!(sysroot_src_orig.exists());
apply_patches(dirs, "stdlib", &sysroot_src_orig, &STDLIB_SRC.to_path(dirs));
std::fs::write(
STDLIB_SRC.to_path(dirs).join("Cargo.toml"),
r#"
[workspace]
resolver = "1"
members = ["./library/sysroot"]
[patch.crates-io]
rustc-std-workspace-core = { path = "./library/rustc-std-workspace-core" }
rustc-std-workspace-alloc = { path = "./library/rustc-std-workspace-alloc" }
rustc-std-workspace-std = { path = "./library/rustc-std-workspace-std" }
# Mandatory for correctly compiling compiler-builtins
[profile.dev.package.compiler_builtins]
debug-assertions = false
overflow-checks = false
codegen-units = 10000
[profile.release.package.compiler_builtins]
debug-assertions = false
overflow-checks = false
codegen-units = 10000
"#,
)
.unwrap();
let source_lockfile = RelPath::PATCHES.to_path(dirs).join("stdlib-lock.toml");
let target_lockfile = STDLIB_SRC.to_path(dirs).join("Cargo.lock");
fs::copy(source_lockfile, target_lockfile).unwrap();
}
pub(crate) struct GitRepo {

View file

@ -106,6 +106,7 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
]);
runner.run_out_command("gen_block_iterate", &[]);
}),
TestCase::build_bin_and_run("aot.raw-dylib", "example/raw-dylib.rs", &[]),
];
pub(crate) static RAND_REPO: GitRepo = GitRepo::github(
@ -437,7 +438,7 @@ impl<'a> TestRunner<'a> {
cmd.arg("-L");
cmd.arg(format!("crate={}", BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs).display()));
cmd.arg("--out-dir");
cmd.arg(format!("{}", BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs).display()));
cmd.arg(BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs));
cmd.arg("-Cdebuginfo=2");
cmd.arg("--target");
cmd.arg(&self.target_compiler.triple);