Skip to content

Subtree sync for rustc_codegen_cranelift #128896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c9b0075
Distribute rustc_codegen_cranelift for arm64 macOS
bjorn3 Jun 30, 2024
322c2f6
Sync ar_archive_writer to LLVM 18.1.3
bjorn3 Apr 16, 2024
d0d2e60
Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into sync_cg_…
bjorn3 Jul 13, 2024
cceadba
Merge branch 'sync_from_rust'
bjorn3 Jul 13, 2024
5203b7e
Set rustup profile to minimal (#1516)
lqd Jul 14, 2024
c01fe3c
Move compiler_builtin check to the use case
momvart Jul 15, 2024
580cdfa
Added project-specific Zed IDE settings
ChaiTRex Jul 16, 2024
25dce8f
Rollup merge of #124033 - bjorn3:ar_archive_writer_0_3_0, r=davidtwco
tgross35 Jul 16, 2024
c1c13bd
Avoid ref when using format! in compiler
nyurik Jul 19, 2024
0c9ba01
Rollup merge of #127779 - momvart:should_codegen_hook, r=cjgillot
matthiaskrgr Jul 20, 2024
b929b68
Remove the RUSTFLAGS enable method from Readme.md
bjorn3 Jul 20, 2024
b70ad2d
Remove unneeded libcalls from `codegen_i128.rs`
beetrees Jul 20, 2024
4fb3c4b
Fix handling of large alignments in `write_cvalue_maybe_transmute` (#…
beetrees Jul 21, 2024
f85d741
Rollup merge of #127177 - bjorn3:arm64_macos_cg_clif, r=Mark-Simulacrum
jieyouxu Jul 22, 2024
486f5b5
Use Cow<'static, str> for InlineAsmTemplatePiece::String
GnomedDev Jun 24, 2024
b2e612f
Update Cranelift to 0.110.1
bjorn3 Jul 9, 2024
f73c411
Sync from rust c1a6199e9d92bb785c17a6d7ffd8b8b552f79c10
bjorn3 Jul 25, 2024
d768359
Rustup to rustc 1.82.0-nightly (c1a6199e9 2024-07-24)
bjorn3 Jul 25, 2024
39bc103
Fix rustc test suite
bjorn3 Jul 25, 2024
aaffce9
Sync from rust 7c2012d0ec3aae89fefc40e5d6b317a0949cda36
bjorn3 Jul 27, 2024
68b99fc
Rustup to rustc 1.82.0-nightly (7c2012d0e 2024-07-26)
bjorn3 Jul 27, 2024
62a0c22
stabilize `is_sorted`
slanterns Jul 27, 2024
b00404e
Update `use` declarations formatting options.
nnethercote Jun 12, 2024
ea9f491
Reformat `use` declarations.
nnethercote Jul 28, 2024
5cd1e8d
Update compiler_builtins to 0.1.114
nicholasbishop May 11, 2024
d35f63e
Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35
bors Jul 29, 2024
161d247
Move temp file name generation out of the create_dll_import_lib method
bjorn3 Jul 25, 2024
37da264
Move computation of decorated names out of the create_dll_import_lib …
bjorn3 Jul 25, 2024
f340c81
Statically enable a couple of target features always enabled on arm64…
bjorn3 Jul 31, 2024
e47c930
Sync from rust 8e86c9567154dc5a9ada15ab196d23eae2bd7d89
bjorn3 Aug 2, 2024
7bdafb5
Rustup to rustc 1.82.0-nightly (8e86c9567 2024-08-01)
bjorn3 Aug 2, 2024
9bad4b6
Fix rustc test suite
bjorn3 Aug 2, 2024
c48b010
Implement x86 _mm_sqrt_ss vendor intrinsic
bjorn3 Aug 2, 2024
e52af66
Update abi-cafe
bjorn3 Jul 1, 2024
395181c
Merge pull request #1523 from rust-lang/update_abi_cafe
bjorn3 Aug 2, 2024
9ad44ba
enable abi-cafe tests on aarch64-apple-darwin
lqd Jul 14, 2024
b3df6dc
ensure the download folder exists when running `abi-cafe`
lqd Aug 4, 2024
1f19cdf
mark busted tests for `aarch64-apple-darwin` and `aarch64-unknown-lin…
lqd Aug 5, 2024
747adbd
Merge pull request #1515 from lqd/abi-cafe
bjorn3 Aug 5, 2024
52f1ea4
Don't skip running abi-cafe tests that give SIGILL on Windows
bjorn3 Aug 5, 2024
6ef49b2
Run abi-cafe tests for pull requests too
bjorn3 Aug 7, 2024
76f615e
Rustup to rustc 1.82.0-nightly (60d146580 2024-08-06)
bjorn3 Aug 7, 2024
14d020f
Remove no longer used vendor intrinsic implementations
bjorn3 Aug 7, 2024
82605c4
Sync from rust 8b3870784f69d8ed2ae4246d1b56f150e3131499
bjorn3 Aug 8, 2024
60ffec8
Rustup to rustc 1.82.0-nightly (8b3870784 2024-08-07)
bjorn3 Aug 8, 2024
fdc6a55
Fix rustc test suite
bjorn3 Aug 8, 2024
2756bd6
Add support for raw-dylib
dpaoliello Aug 2, 2024
a2f3413
Merge pull request #1524 from dpaoliello/rawdylib
bjorn3 Aug 8, 2024
d61b0e7
Rustup to rustc 1.82.0-nightly (3e9bd8b56 2024-08-08)
bjorn3 Aug 9, 2024
d515e88
Disable f16 and f128 in compiler-builtins when running rustc tests
bjorn3 Aug 9, 2024
0e20a76
Stop using a custom Cargo.toml and Cargo.lock for the standard library
bjorn3 Aug 9, 2024
69b3f5a
Couple of minor cleanups
bjorn3 Aug 9, 2024
af7ea31
Merge commit '69b3f5a426a5c1c05236a45b36f6679d95fbe01b' into sync_cg_…
bjorn3 Aug 9, 2024
6e5873c
Use ar_archive_writer from sysroot for cg_clif
bjorn3 Aug 9, 2024
57dd967
Update tidy for new cranelift-bitset crate
bjorn3 Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions compiler/rustc_codegen_cranelift/.github/workflows/abi-cafe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ name: Abi-cafe

on:
- push
- pull_request

permissions: {}

jobs:
abi_cafe:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
timeout-minutes: 30
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.env.TARGET_TRIPLE }}
cancel-in-progress: true
Expand All @@ -27,12 +28,16 @@ jobs:
- os: macos-latest
env:
TARGET_TRIPLE: x86_64-apple-darwin
- os: windows-latest
- os: macos-latest
env:
TARGET_TRIPLE: x86_64-pc-windows-msvc
TARGET_TRIPLE: aarch64-apple-darwin
- os: windows-latest
env:
TARGET_TRIPLE: x86_64-pc-windows-gnu
TARGET_TRIPLE: x86_64-pc-windows-msvc
# FIXME Currently hangs. Re-enable once this is fixed or abi-cafe adds a timeout.
#- os: windows-latest
# env:
# TARGET_TRIPLE: x86_64-pc-windows-gnu

steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
- uses: actions/checkout@v4
- run: |
sed -i 's/components.*/components = []/' rust-toolchain
echo 'profile = "minimal"' >> rust-toolchain
- uses: rustsec/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- name: Avoid installing rustc-dev
run: |
sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain
echo 'profile = "minimal"' >> rust-toolchain
rustfmt -v

- name: Rustfmt
Expand Down
68 changes: 68 additions & 0 deletions compiler/rustc_codegen_cranelift/.zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"format_on_save": "on",
"lsp": {
"rust-analyzer": {
"initialization_options": {
"diagnostics": {
// in case rustc.source is disabled for performance reasons; disable the errors about this
"disabled": ["unresolved-extern-crate", "unresolved-macro-call"]
},
"rustc": {
"source": "discover"
},
"imports": {
"granularity": {
"enforce": true,
"group": "module"
},
"prefix": "crate"
},
"cargo": {
"features": ["unstable-features"]
},
"linkedProjects": [
"./Cargo.toml",
"./build_system/Cargo.toml",
{
"crates": [
{
"root_module": "./example/mini_core.rs",
"edition": "2018",
"deps": [],
"cfg": []
},
{
"root_module": "./example/mini_core_hello_world.rs",
"edition": "2018",
"deps": [
{
"crate": 0,
"name": "mini_core"
}
],
"cfg": []
},
{
"root_module": "./example/mod_bench.rs",
"edition": "2018",
"deps": [],
"cfg": []
}
]
},
{
"sysroot_src": "./build/stdlib/library",
"crates": [
{
"root_module": "./example/std_example.rs",
"edition": "2015",
"deps": [],
"cfg": []
}
]
}
]
}
}
}
}
66 changes: 38 additions & 28 deletions compiler/rustc_codegen_cranelift/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,28 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "cranelift-bforest"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b6b33d7e757a887989eb18b35712b2a67d96171ec3149d1bfb657b29b7b367c"
checksum = "effa84ab2023f7138045ece6b326588c17447ca22e66db71ec15cb0a6c0c4ad2"
dependencies = [
"cranelift-entity",
]

[[package]]
name = "cranelift-bitset"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38a1dfc50dca188a15d938867c4400589530bcb0138f7022aae6d059d1d8c309"

[[package]]
name = "cranelift-codegen"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9acf15cb22be42d07c3b57d7856329cb228b7315d385346149df2566ad5e4aa"
checksum = "821c20c639350158ecca928dc2a244d0d1c9cef2377a378fc62a445a286eb1ca"
dependencies = [
"bumpalo",
"cranelift-bforest",
"cranelift-bitset",
"cranelift-codegen-meta",
"cranelift-codegen-shared",
"cranelift-control",
Expand All @@ -77,39 +84,42 @@ dependencies = [

[[package]]
name = "cranelift-codegen-meta"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e934d301392b73b3f8b0540391fb82465a0f179a3cee7c726482ac4727efcc97"
checksum = "064473f2fd59b44fa2c9aaa60de1f9c44db5e13521e28bc85d2b92ee535ef625"
dependencies = [
"cranelift-codegen-shared",
]

[[package]]
name = "cranelift-codegen-shared"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8afb2a2566b3d54b854dfb288b3b187f6d3d17d6f762c92898207eba302931da"
checksum = "d0f39b9ebfd2febdc2acfb9a0fca110665bcd5a6839502576307735ed07b2177"

[[package]]
name = "cranelift-control"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0100f33b704cdacd01ad66ff41f8c5030d57cbff078e2a4e49ab1822591299fa"
checksum = "94e125c189c3a1ca8dfe209fc6f46edba058a6d24e0b92aff69459a15f4711e7"
dependencies = [
"arbitrary",
]

[[package]]
name = "cranelift-entity"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8cfdc315e5d18997093e040a8d234bea1ac1e118a716d3e30f40d449e78207b"
checksum = "ea62eb109baec2247e1a6fa7b74c0f584b1e76e289cfd7017385b4b031fc8450"
dependencies = [
"cranelift-bitset",
]

[[package]]
name = "cranelift-frontend"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f74b84f16af2e982b0c0c72233503d9d55cbfe3865dbe807ca28dc6642a28b5"
checksum = "722b089357aacb6c7528b2e59a5fe00917d61ce63448b25a3e477a5b7819fac8"
dependencies = [
"cranelift-codegen",
"log",
Expand All @@ -119,15 +129,15 @@ dependencies = [

[[package]]
name = "cranelift-isle"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adf306d3dde705fb94bd48082f01d38c4ededc74293a4c007805f610bf08bc6e"
checksum = "c4b5005a48288e7fc2a2991a377831c534e26929b063c379c018060727785a9b"

[[package]]
name = "cranelift-jit"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5c5cfb8bbd3339cd25cca30e7516ff8fe5cb1feeddde6980cc4d5ef34df97bb"
checksum = "f843932baf8d1025c5f114b929eda172d74b7163d058e0de2597c308b567c7e9"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -145,9 +155,9 @@ dependencies = [

[[package]]
name = "cranelift-module"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c9b0d4269b36fd858e6d8f20cd4938941186fb831488c361888cb2d6b33a9a6"
checksum = "449819ef1c4af139cf1b9717916fcaea0e23248853d3e95135139773a842d3eb"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -156,9 +166,9 @@ dependencies = [

[[package]]
name = "cranelift-native"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ea0ebdef7aff4a79bcbc8b6495f31315f16b3bf311152f472eaa8d679352581"
checksum = "3ae2d48f38081a9e679ad795bd36bb29bedeb5552fc1c195185bf9885fa1b16e"
dependencies = [
"cranelift-codegen",
"libc",
Expand All @@ -167,9 +177,9 @@ dependencies = [

[[package]]
name = "cranelift-object"
version = "0.109.0"
version = "0.110.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19e33439ec20db058bc7cc3410f9748ab1ad90a35cef713d625c736f43e3820d"
checksum = "3a39ee2cfd0ec485eca76f6b4dc17701a280fa406bc05137bb43f1635ed12c9f"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand Down Expand Up @@ -279,9 +289,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"

[[package]]
name = "object"
version = "0.36.1"
version = "0.36.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce"
checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e"
dependencies = [
"crc32fast",
"hashbrown 0.14.5",
Expand Down Expand Up @@ -411,9 +421,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"

[[package]]
name = "wasmtime-jit-icache-coherence"
version = "22.0.0"
version = "23.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5afe2f0499542f9a4bcfa1b55bfdda803b6ade4e7c93c6b99e0f39dba44b0a91"
checksum = "7fddf3e2980fb1d123d1fcac55189e417fdd3dba4f62139b5a0a1f9efe5669d5"
dependencies = [
"anyhow",
"cfg-if",
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ crate-type = ["dylib"]

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { version = "0.109.0", default-features = false, features = ["std", "unwind", "all-arch"] }
cranelift-frontend = { version = "0.109.0" }
cranelift-module = { version = "0.109.0" }
cranelift-native = { version = "0.109.0" }
cranelift-jit = { version = "0.109.0", optional = true }
cranelift-object = { version = "0.109.0" }
cranelift-codegen = { version = "0.110.1", default-features = false, features = ["std", "unwind", "all-arch"] }
cranelift-frontend = { version = "0.110.1" }
cranelift-module = { version = "0.110.1" }
cranelift-native = { version = "0.110.1" }
cranelift-jit = { version = "0.110.1", optional = true }
cranelift-object = { version = "0.110.1" }
target-lexicon = "0.12.0"
gimli = { version = "0.28", default-features = false, features = ["write"]}
object = { version = "0.36", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_cranelift/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ $ rustup component add rustc-codegen-cranelift-preview --toolchain nightly

Once it is installed, you can enable it with one of the following approaches:
- `CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build -Zcodegen-backend`
- `RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build`
- Add the following to `.cargo/config.toml`:
```toml
[unstable]
Expand Down
28 changes: 18 additions & 10 deletions compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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};

static ABI_CAFE_REPO: GitRepo = GitRepo::github(
"Gankra",
"abi-cafe",
"4c6dc8c9c687e2b3a760ff2176ce236872b37212",
"588df6d66abbe105",
"f1220cfd13b57f5c0082c26529163865ee25e115",
"fe93a9acd461425d",
"abi-cafe",
);

Expand All @@ -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);

Expand All @@ -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) => {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading
Loading