Stream: git-wasmtime

Topic: wasmtime / PR #15180 cranelift-object: share custom secti...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 01:15):

lucas-jacques opened PR #15180 from lucas-jacques:macho-shared-custom-sections to bytecodealliance:main:

Hello, I hit this with rustc_codegen_cranelift's experimental unwinding support on aarch64-apple-darwin, where every function's LSDA goes into _TEXT, _gcc_except_tab, but it applies to any frontend putting many data objects in one custom section (for example Rust's #link_section]).

Problem

Currently every data object with a custom section currently gets its own section. A Mach-0 object file can contain at most 255 sections, so emitting more data objects than that into the same custom section fails with "Too many sections".

Changes

On Mach-0, data objects with the same custom section now share a single section, like LLVM does. Individual data objects can still be dead stripped, since the object file uses subsections via symbols. ELF and COFF are unchanged and still get one section per data object.

Two edge cases: using the same section name with different section types or attributes now returns an error rather than emitting two conflicting sections, and zero-initialized data in such a section is written out as zeros, because uninitialized and initialized data can't share a section.

Duplicate

First, this PR addresses the same problem than #14985, but i believe there is a bug:
On macOS, data objects with the same custom section name now share one section. But zero-filled data (define_zeroinit) and normal data get the same cache key, so both kinds can land in the same section. Say the section gets a zero-filled object A (8 bytes), then a normal object B:

  1. A is added as zero-fill. The section's size grows to 8, but nothing is written to its byte buffer.
  2. B is appended at the end of the byte buffer, which is still offset 0.
  3. Result: A and B both point to offset 0. Reading A returns B's bytes instead of zeros.

Testing

Other test i did:

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 01:15):

lucas-jacques requested cfallin for a review on PR #15180.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 01:15):

lucas-jacques removed the review request for wasmtime-compiler-reviewers from PR #15180.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 01:15):

lucas-jacques requested wasmtime-compiler-reviewers for a review on PR #15180.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 01:18):

lucas-jacques updated PR #15180.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 03:44):

github-actions[bot] added the label cranelift on PR #15180.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 03:44):

github-actions[bot] added the label cranelift:module on PR #15180.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 07:46):

bjorn3 commented on PR #15180:

First, this PR addresses the same problem than https://github.com/bytecodealliance/wasmtime/pull/14985, but i believe there is a bug:

Instead of creating an entirely new PR you could also have left a comment avout this bug on that PR.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 11:15):

lucas-jacques commented on PR #15180:

First, this PR addresses the same problem than #14985, but i believe there is a bug:

Instead of creating an entirely new PR you could also have left a comment avout this bug on that PR.

Fair, I discovered the PR after i made this one, and noticed the bug afterward.

Should i close this one ? Just wanted to help having this fix merged upstream.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 11:15):

lucas-jacques edited a comment on PR #15180:

First, this PR addresses the same problem than #14985, but i believe there is a bug:

Instead of creating an entirely new PR you could also have left a comment avout this bug on that PR.

Fair, I discovered the PR after i made this fix, and noticed the bug afterward.

Should i close this one ? Just wanted to help having this fix merged upstream.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 17:09):

cfallin commented on PR #15180:

Yes, @lucas-jacques, if you wouldn't mind, maybe comment on the prior PR? I see that one is stalled on maintainer signoff; feel free to ping me when it's ready, @bjorn3, and I can merge it.


Last updated: Nov 19 2026 at 20:05 UTC