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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## wasm-split-cli vfuture

- Improve data layout in optimized builds, with less data ending up in the main module and more
data in the split modules, in particular when `wasm-ld` deduplicates strings and performs tail
merging (for details see #60).
- Fix relocations inside a data symbol that is contained in another symbol being attributed to
the containing symbol. A module that only used the inner symbol could miss the relocation's
target. This was hidden by whole segments being kept in the main module.

## wasm-split-cli v0.2.3

- Fix breakage from wasm-bindgen 0.128, which changes how casts are generated, leading to
Expand Down
6 changes: 6 additions & 0 deletions crates/wasm_split_cli/src/dep_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ fn iter_data_dependencies<'m>(
}) {
let _ = overlap_candidates.pop();
}
// The relocation belongs to the innermost symbol containing its start,
// and must lie fully inside it.
let &target = emit_iter_err!(overlap_candidates.last().ok_or_else(|| anyhow!(
"Invalid relocation entry {entry:?} not overlapping any data symbols"
)));
Expand Down Expand Up @@ -351,6 +353,10 @@ fn iter_data_dependencies<'m>(

// if we reach here, then the next symbol is contained in all items on the stack
if let Some(container) = container {
// Keep the inner symbol as a candidate: relocations inside it must be attributed to
// it, the smallest symbol containing them, and not to its container. Otherwise a
// module that only needs the inner symbol would miss the relocation's target.
overlap_candidates.push(next_symbol);
return Some(Ok(DataDependency::Containment {
container,
inner: next_symbol,
Expand Down
Loading
Loading