Skip to content

Commit d5fd255

Browse files
committed
Use an auto-patched copy of rustc_codegen_ssa (dubbed pqp_cg_ssa).
1 parent 929b227 commit d5fd255

21 files changed

+524
-33
lines changed

.github/workflows/lint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,16 @@ function version_test() {
8787
# FIXME(eddyb) try to get this working for `spirv-builder`, which has a larger
8888
# dependency graph, with too much imprecision in upstream `Cargo.toml` files.
8989
version_test crates/spirv-std
90+
91+
# 3. Ensure `rustc_codegen_spirv` still compiles with `rustc_codegen_ssa`.
92+
93+
# HACK(eddyb) see `crates/rustc_codegen_spirv/build.rs` for more on `pqp_cg_ssa`
94+
# (a patched copy of `rustc_codegen_ssa`).
95+
echo ::group::rustc_codegen_spirv_disable_pqp_cg_ssa
96+
cargo clippy \
97+
--manifest-path "crates/rustc_codegen_spirv/Cargo.toml" \
98+
--no-default-features \
99+
--features "$FEAT" \
100+
--all-targets \
101+
-- -D warnings --cfg rustc_codegen_spirv_disable_pqp_cg_ssa
102+
echo ::endgroup::

Cargo.lock

Lines changed: 162 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# HACK(eddyb) only for `[profile.dev]` `rustflags` overrides below.
2+
cargo-features = ["profile-rustflags"]
3+
14
[workspace]
25
resolver = "2"
36
members = [
@@ -60,3 +63,13 @@ codegen-units = 256
6063
opt-level = 3
6164
incremental = true
6265
codegen-units = 256
66+
67+
# HACK(eddyb) reduce the number of linker exports and/or imports, by avoiding
68+
# inter-CGU linkage, to stay under the 64Ki MSVC limit for `rustc_codegen_spirv`
69+
# when building it in "debug mode" (only relevant to CI for now, realistically),
70+
# i.e. working around this issue: https://github.com/rust-lang/rust/issues/53014
71+
# (see also `crates/spirv-builder/Cargo.toml`).
72+
[profile.dev]
73+
# HACK(eddyb) fewer inter-crate exports/imports (not just inter-CGU).
74+
rustflags = ["-Zshare-generics=off"]
75+
codegen-units = 1

crates/rustc_codegen_spirv/Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ num-traits = { workspace = true, default-features = true }
4646
once_cell = "1"
4747
regex = { version = "1", features = ["perf"] }
4848

49+
# HACK(eddyb) deps of `rustc_codegen_ssa`, for `pqp_cg_ssa` (see `build.rs`),
50+
# that cannot be handled with just `extern crate` pulling out of the sysroot.
51+
object = { version = "0.32.1", default-features = false, features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"] }
52+
thorin-dwp = "0.7"
53+
4954
# Normal dependencies.
5055
ar = "0.9.0"
5156
either = "1.8.0"
@@ -63,7 +68,10 @@ itertools = "0.10.5"
6368
[dev-dependencies]
6469
pipe = "0.4"
6570
pretty_assertions = "1.0"
66-
tempfile = "3.4"
71+
72+
# HACK(eddyb) can't re-introduce deps of `rustc_codegen_ssa`, for `pqp_cg_ssa`
73+
# (see `build.rs`).
74+
# tempfile = "3.4"
6775

6876
# Note that in order to use RA and have access to `rustc_*` crates, you also
6977
# need to set `"rust-analyzer.rustcSource": "discover"` in e.g. VSCode.

0 commit comments

Comments
 (0)