Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong architecture objects mixed in self-built compiler #105065

Open
mkroening opened this issue Nov 29, 2022 · 5 comments
Open

Wrong architecture objects mixed in self-built compiler #105065

mkroening opened this issue Nov 29, 2022 · 5 comments
Labels
A-cross Area: Cross compilation C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode requires-custom-config This issue requires custom config/build for rustc in some way T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@mkroening
Copy link
Contributor

mkroening commented Nov 29, 2022

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

@mkroening mkroening added the C-bug Category: This is a bug. label Nov 29, 2022
@mkroening
Copy link
Contributor Author

mkroening commented Nov 29, 2022

#102579 seems to solve this.

@mkroening
Copy link
Contributor Author

This was broken before 3acb505 as well, I wonder why we did not notice in the past. 🤔

@mkroening
Copy link
Contributor Author

CC: @jyn514

@jyn514
Copy link
Member

jyn514 commented Nov 29, 2022

I don't understand why this only broke now, but I'm glad #102579 fixes it.

You probably weren't checking out the llvm-project submodules and just recently started doing that.

@mkroening
Copy link
Contributor Author

Well, thinking about it, I got my machine quite recently, so I might just have never tried with this setup before. 😅

I always had the llvm-project submodule checked out, though.

@jyn514 jyn514 added A-cross Area: Cross compilation T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) O-AArch64 Armv8-A or later processors in AArch64 mode requires-custom-config This issue requires custom config/build for rustc in some way labels Jul 1, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 4, 2024
…tins, r=onur-ozkan

Reland optimized-compiler-builtins config

Copy of rust-lang#102579 PR.

From rust-lang#102579:

> No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it.

> Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true).

Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 7, 2024
…ns, r=onur-ozkan

Reland optimized-compiler-builtins config

Copy of rust-lang#102579 PR.

From rust-lang#102579:

> No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it.

> Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true).

Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065

r? ghost
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jan 10, 2024
…r-ozkan

Reland optimized-compiler-builtins config

Copy of #102579 PR.

From #102579:

> No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it.

> Fixes rust-lang/rust#102560. Fixes rust-lang/rust#101172. Helps with rust-lang/rust#105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true).

Fixes rust-lang/rust#102560. Fixes rust-lang/rust#101172. Helps with rust-lang/rust#105065

r? ghost
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Apr 7, 2024
…r-ozkan

Reland optimized-compiler-builtins config

Copy of #102579 PR.

From #102579:

> No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it.

> Fixes rust-lang/rust#102560. Fixes rust-lang/rust#101172. Helps with rust-lang/rust#105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true).

Fixes rust-lang/rust#102560. Fixes rust-lang/rust#101172. Helps with rust-lang/rust#105065

r? ghost
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this issue Apr 27, 2024
…r-ozkan

Reland optimized-compiler-builtins config

Copy of #102579 PR.

From #102579:

> No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it.

> Fixes rust-lang/rust#102560. Fixes rust-lang/rust#101172. Helps with rust-lang/rust#105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true).

Fixes rust-lang/rust#102560. Fixes rust-lang/rust#101172. Helps with rust-lang/rust#105065

r? ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross Area: Cross compilation C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode requires-custom-config This issue requires custom config/build for rustc in some way T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

2 participants