Skip to content
/ zig Public
forked from ziglang/zig

Commit

Permalink
Merge pull request ziglang#19127 from ziglang/export-symbol-names-cac…
Browse files Browse the repository at this point in the history
…he-hash

add missing export symbol names to whole mode wasm cache hash
  • Loading branch information
andrewrk authored Feb 29, 2024
2 parents 3e292e5 + f7d095d commit 5c0766b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,7 @@ fn addNonIncrementalStuffToCacheManifest(
man.hash.addOptional(opts.initial_memory);
man.hash.addOptional(opts.max_memory);
man.hash.addOptional(opts.global_base);
man.hash.addListOfBytes(opts.export_symbol_names);

// Mach-O specific stuff
try link.File.MachO.hashAddFrameworks(man, opts.frameworks);
Expand Down
10 changes: 2 additions & 8 deletions src/link/Wasm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3535,11 +3535,8 @@ fn linkWithZld(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) lin
man.hash.addOptional(wasm.initial_memory);
man.hash.addOptional(wasm.max_memory);
man.hash.addOptional(wasm.global_base);
man.hash.add(wasm.export_symbol_names.len);
man.hash.addListOfBytes(wasm.export_symbol_names);
// strip does not need to go into the linker hash because it is part of the hash namespace
for (wasm.export_symbol_names) |symbol_name| {
man.hash.addBytes(symbol_name);
}

// We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
_ = try man.hit();
Expand Down Expand Up @@ -4605,11 +4602,8 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo
man.hash.addOptional(wasm.max_memory);
man.hash.add(shared_memory);
man.hash.addOptional(wasm.global_base);
man.hash.add(wasm.export_symbol_names.len);
man.hash.addListOfBytes(wasm.export_symbol_names);
// strip does not need to go into the linker hash because it is part of the hash namespace
for (wasm.export_symbol_names) |symbol_name| {
man.hash.addBytes(symbol_name);
}

// We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
_ = try man.hit();
Expand Down

0 comments on commit 5c0766b

Please sign in to comment.