Skip to content

rustc-builtins: use the target *specification* (rather than its triple) in build.rs #35474

Closed
@japaric

Description

@japaric

follow up of #35021

rustc-builtins' build.rs uses $TARGET to decide which intrinsics to compile. This won't work well with custom targets because these targets can have arbitrary triples (e.g. cortex-m0) that don't reflect the actual target specification (ARM architecture, no OS, etc). To make rustc-builtins more robust we should use the target specification (target_arch, target_os, etc) instead of the triple. This will improve rustc-builtins's support of custom targets and should simplify its build.rs logic: if spec.target_arch == "arm" instead of if target.starts_with("arm") || target.starts_with("thumb").

There's no standard mechanism to access the target specification from a build script but we could use an external crate like @nagisa's target_build_utils.

cc @alexcrichton @brson

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