Skip to content

codegen: one target-OS classifier (follow-up to #12247's triple-spelling fix) #12249

Closed

Description

@proggeramlug

Hardening follow-up to #12247. #12247 is correct: the heap floor is a checked lower bound, and any address outside the range takes the runtime slow path.

  1. Hard-coded floor. target_layout.rs writes the floor as the literal 0x10_0000. Use crate::runtime_abi::RECEIVER_HANDLE_FLOOR instead, as receiver_range.rs:37 already does.

  2. Hand-listed test targets. heap_address_floor_covers_emitted_triples lists target names by hand and misses wearos, windows-arm64, windows-x86_64, linux-x86_64-musl, windows-winui and wasi. Expose one TARGET_NAMES next to resolve_target_triple (codegen/helpers.rs:994) and loop over it.

  3. One OS classifier. Several places classify the target OS by ad hoc substring matching on the triple:

    • helpers.rs:155
    • expr/literals_vars.rs:223
    • inprocess/function_layout.rs:27
    • gc_map.rs:1192
    • commands/compile/post_link.rs:87

    fix(codegen): treat LLVM macOS and visionOS triples as low-address heap targets #12247 fixed the same class of bug, where LLVM and rustc spell the OS differently in a triple. Add one target_os_of(triple) classifier that mirrors rustc's target_os, route these sites through it, and test it against cfg!(target_os) for the default triple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions