madsmtm opened PR #13137 from madsmtm:allow-macho-flags to bytecodealliance:main:
This enables
rustc_codegen_craneliftto control these.
madsmtm requested cfallin for a review on PR #13137.
madsmtm requested wasmtime-compiler-reviewers for a review on PR #13137.
madsmtm edited PR #13137:
This enables
rustc_codegen_craneliftto control these, see https://github.com/rust-lang/rustc_codegen_cranelift/pull/1648.
madsmtm submitted PR review.
madsmtm created PR review comment:
Another design for this could be to take:
segment: String, section: String, macho_section_type: String, macho_section_attributes: Vec<String>,And then have the "pure_instructions" -> S_ATTR_PURE_INSTRUCTIONS mapping in
cranelift-object? What would you prefer?
madsmtm edited PR review comment.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Maybe directly use
object::write::SectionFlagsand then or those flags with the ones cranelift-object would set by default?
madsmtm submitted PR review.
madsmtm created PR review comment:
But that would introduce a dependency on
objecttocranelift-module?
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Ah, right this is cranelift-module, not cranelift-object.
github-actions[bot] added the label cranelift on PR #13137.
github-actions[bot] added the label cranelift:module on PR #13137.
cfallin added PR #13137 Allow passing Mach-O flags to set_segment_section to the merge queue
cfallin submitted PR review:
Looks reasonable to me -- thanks!
madsmtm submitted PR review.
madsmtm created PR review comment:
A third alternative would be:
custom_segment_section: Option<String>,And do the entire parsing inside
cranelift-object.
github-merge-queue[bot] removed PR #13137 Allow passing Mach-O flags to set_segment_section from the merge queue
alexcrichton added PR #13137 Allow passing Mach-O flags to set_segment_section to the merge queue
alexcrichton merged PR #13137.
alexcrichton removed PR #13137 Allow passing Mach-O flags to set_segment_section from the merge queue
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Actually shouldn't this be
|=? As is this would overwrite the default flags even when no flags are passed.
madsmtm submitted PR review.
madsmtm created PR review comment:
I considered that, but there are no default flags for (
SectionKind::Data,SectionKind::ReadOnlyDataandSectionKind::ReadOnlyDataWithRel), and if there were, it would break if we tried to|=the section type.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Would skipping the flag set if macho_flags is 0 makes sense?
madsmtm submitted PR review.
madsmtm created PR review comment:
Maybe we could do:
let section_type = *macho_flags & SECTION_TYPE; let section_attributes = *macho_flags & SECTION_ATTRIBUTES; let current_attributes = (*flags & SECTION_ATTRIBUTES); *flags = section_type | current_attributes | section_attributes;But I feared that might be confusing too, if I request only
no_dead_strip, it might be weird if I got other attributes too.Though we should probably have an assert that
*flagsis0.
madsmtm submitted PR review.
madsmtm created PR review comment:
I opened https://github.com/bytecodealliance/wasmtime/pull/13153 for adding a debug assertion instead
Last updated: May 03 2026 at 22:13 UTC