Stream: git-wasmtime

Topic: wasmtime / PR #14985 cranelift-object: share Mach-O secti...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2026 at 09:45):

faysou opened PR #14985 from faysou:cranelift-object-macho-shared-custom-sections to bytecodealliance:main:

Problem

ObjectModule::define_data calls add_section for every data object that has a custom section. A Mach-O object holds at most 255 sections, so ObjectProduct::emit fails with Too many sections: 0x12d once a module defines more data objects than that.

This happens in practice with rustc_codegen_cranelift on aarch64 macOS: every inventory::submit! static goes into __DATA,__mod_init_func, and building nautilus-model hits the limit.

Change

On Mach-O, reuse an existing section when segment, name, SectionKind, and Mach-O flags all match, as LLVM does when it merges sections with the same name. ELF and COFF output is unchanged.

Testing

view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2026 at 09:45):

faysou removed the review request for wasmtime-compiler-reviewers from PR #14985.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2026 at 09:45):

faysou requested fitzgen for a review on PR #14985.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2026 at 09:45):

faysou requested wasmtime-compiler-reviewers for a review on PR #14985.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2026 at 11:44):

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

view this post on Zulip Wasmtime GitHub notifications bot (Oct 25 2026 at 11:44):

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

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 13:15):

:memo: bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 13:15):

:speech_balloon: bjorn3 created PR review comment:

            if self.object.format() == BinaryFormat::MachO
                && let Some(&section) = self.macho_custom_sections.get(&(segment.clone(), section.clone(), kind, macho_flags.0))

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 13:15):

:memo: bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 13:15):

:speech_balloon: bjorn3 created PR review comment:

LLVM emits an error when a section is defined twice with different flags.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 13:16):

:speech_balloon: bjorn3 deleted PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:00):

faysou updated PR #14985.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:01):

:memo: faysou submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:01):

:speech_balloon: faysou created PR review comment:

Thanks, switched to a let-chain. The insert below now checks the format directly too, since there's no optional key anymore.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:03):

:memo: bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:03):

:speech_balloon: bjorn3 created PR review comment:

Can you inline this to avoid the clones outside Mach-O?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:43):

faysou updated PR #14985.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:43):

:memo: faysou submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 14:43):

:speech_balloon: faysou created PR review comment:

Done. The lookup key is now built inside the let-chain, and the insert key is built only for Mach-O before add_section takes ownership of the names.


Last updated: Oct 31 2026 at 23:03 UTC