Skip to content

Wrong architecture objects mixed in self-built compiler #105065

Open
@mkroening

Description

@mkroening

When using a self-built compiler on an Apple Silicon host to build a x86_64-unknown-none static library, mach-o-arm64 objects get mixed into the output. This happens since #103732.

Problem setup

# config.toml
# using stage1, built with `./x.py build`
changelog-seen = 2

[llvm]
targets = "AArch64;X86"

[build]
target = [
    "aarch64-apple-darwin",
    "x86_64-unknown-none",
]

[rust]
llvm-tools = true
lld = true
host: aarch64-apple-darwin
// foo.rs
#![no_std]

#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
    loop {}
}
$ rustc --crate-type staticlib --target x86_64-unknown-none foo.rs
$ objdump --archive-headers libfoo.a

Results

  1. 33b530e
  2. 5984b1d (the next commit)
    • 5984b1d.log
    • contains absvdi2.o: file format mach-o-arm64 and more
  3. nightly-2022-11-01 (the next nightly)

CC: @stlankes

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-crossArea: Cross compilationC-bugCategory: This is a bug.O-AArch64Armv8-A or later processors in AArch64 modeT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)requires-custom-configThis issue requires custom config/build for rustc in some way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions