Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,34 @@ codegen-units = 16
strip = false
codegen-units = 16

# Issue #5928: well-known "shared tokio" wrapper crates (#507) are built in
# the SAME cargo invocation as perry-stdlib-static so cargo unifies their
# shared dependency graph (tokio, hyper_util, rustls, and even core/std
# monomorphizations) into identical compilation units. That unification only
# holds if EVERY crate in that invocation uses the SAME `codegen-units`
# setting — rustc partitions a crate's monomorphized code into N codegen
# units based on this value, so two crates compiling the "same" shared
# dependency with different `codegen-units` end up with differently-sized,
# differently-partitioned .rcgu.o objects despite sharing an identical
# crate/feature graph (confirmed empirically: perry-stdlib-static's `core`
# codegen unit was 551 KB vs an ext crate's 2.4 MB for the identically
# hash-named unit, before this fix). Without this, macOS's linker (which
# has no `-multiply_defined suppress` / `-ld_classic` tolerance mode
# anymore) hits thousands of `ld: duplicate symbol` errors once a program
# needs 2+ of these wrapper crates simultaneously, because perry's
# strip-dedup mechanism assumes same-named codegen units are byte-identical
# and safe to drop duplicates from — an assumption this mismatch violated.
[profile.release.package.perry-ext-fastify]
codegen-units = 16
[profile.release.package.perry-ext-http]
codegen-units = 16
[profile.release.package.perry-ext-ioredis]
codegen-units = 16
[profile.release.package.perry-ext-net]
codegen-units = 16
[profile.release.package.perry-ext-ws]
codegen-units = 16

# Fast developer profile (#5422). Optimized enough for realistic local runs but
# without the distribution-grade settings that dominate compile time, so the
# edit/build loop stays short. Intended local loop:
Expand Down Expand Up @@ -300,6 +328,20 @@ codegen-units = 16
strip = false
codegen-units = 16

# Issue #5928: mirrors the [profile.release.package.perry-ext-*] block above
# — see its comment for why matching `codegen-units` across every crate in
# the "shared tokio" (#507) cargo invocation is required.
[profile.dist.package.perry-ext-fastify]
codegen-units = 16
[profile.dist.package.perry-ext-http]
codegen-units = 16
[profile.dist.package.perry-ext-ioredis]
codegen-units = 16
[profile.dist.package.perry-ext-net]
codegen-units = 16
[profile.dist.package.perry-ext-ws]
codegen-units = 16

[workspace.package]
version = "0.5.1236"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion crates/perry/src/commands/compile/optimized_libs/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ pub(crate) fn build_optimized_libs(
runtime_bc,
stdlib_bc,
extra_bc,
prefer_well_known_before_stdlib: !well_known_libs.is_empty(),
well_known_libs,
prefer_well_known_before_stdlib: false,
}
}
Loading