Skip to content

Commit 293b59d

Browse files
committed
Use an auto-patched copy of rustc_codegen_ssa (dubbed pqp_cg_ssa).
1 parent 925d5c2 commit 293b59d

File tree

20 files changed

+487
-29
lines changed

20 files changed

+487
-29
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,18 @@ jobs:
7676
- name: build example shaders
7777
if: ${{ matrix.target != 'aarch64-linux-android' }}
7878
env:
79-
OUT_DIR: "target/tmp"
79+
PROFILE: release
80+
OUT_DIR: "target/release/ci/out"
8081
run: cargo run -p example-runner-wgpu-builder --release --no-default-features --features "use-installed-tools"
8182

82-
- name: build example shaders dev
83+
- name: build example shaders (dev aka "debug mode")
8384
if: ${{ matrix.target != 'aarch64-linux-android' && matrix.target != 'x86_64-apple-darwin' }}
8485
env:
85-
OUT_DIR: "target/tmp"
86+
# HACK(eddyb) see `[profile.dev]` in `Cargo.toml` for more on why
87+
# `-Zshare-generics=off` is useful (and why it had to be moved here).
88+
RUSTFLAGS: -Zshare-generics=off
89+
PROFILE: debug
90+
OUT_DIR: "target/debug/ci/out"
8691
run: cargo run -p example-runner-wgpu-builder --no-default-features --features "use-installed-tools"
8792

8893
- name: Build WGPU Example for Android

.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: 132 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# HACK(eddyb) meant for `[profile.dev]` `rustflags` overrides below, but sadly
2+
# not configurable w/o breaking `Cargo.toml` parsing from non-nightly Cargo.
3+
#
4+
# cargo-features = ["profile-rustflags"]
5+
16
[workspace]
27
resolver = "2"
38
members = [
@@ -60,3 +65,15 @@ codegen-units = 256
6065
opt-level = 3
6166
incremental = true
6267
codegen-units = 256
68+
69+
# HACK(eddyb) reduce the number of linker exports and/or imports, by avoiding
70+
# inter-CGU linkage, to stay under the 64Ki MSVC limit for `rustc_codegen_spirv`
71+
# when building it in "debug mode" (only relevant to CI for now, realistically),
72+
# i.e. working around this issue: https://github.com/rust-lang/rust/issues/53014.
73+
[profile.dev]
74+
# HACK(eddyb) fewer inter-crate exports/imports (not just inter-CGU), but sadly
75+
# not configurable w/o breaking `Cargo.toml` parsing from non-nightly Cargo
76+
# (moved to `.github/workflows/ci.yaml` as `RUSTFLAGS: -Zshare-generics=off`).
77+
#
78+
# rustflags = ["-Zshare-generics=off"]
79+
codegen-units = 1

crates/rustc_codegen_spirv/Cargo.toml

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

42+
# HACK(eddyb) deps of `rustc_codegen_ssa`, for `pqp_cg_ssa` (see `build.rs`),
43+
# that cannot be handled with just `extern crate` pulling out of the sysroot.
44+
object = { version = "0.32.1", default-features = false, features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"] }
45+
thorin-dwp = "0.7"
46+
4247
# Normal dependencies.
4348
ar = "0.9.0"
4449
either = "1.8.0"
@@ -56,7 +61,10 @@ itertools = "0.10.5"
5661
[dev-dependencies]
5762
pipe = "0.4"
5863
pretty_assertions = "1.0"
59-
tempfile = "3.4"
64+
65+
# HACK(eddyb) can't re-introduce deps of `rustc_codegen_ssa`, for `pqp_cg_ssa`
66+
# (see `build.rs`).
67+
# tempfile = "3.4"
6068

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

0 commit comments

Comments
 (0)