rust-lang / rust-lang/rust

Cannot build bare metal mach-o binaries

Open
#131,427 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

requires-custom-config S-needs-info
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried to compile a bare metal aarch64 Rust Mach-O binary with the following target json spec:

{
  "abi": "softfloat",
  "arch": "aarch64",
  "crt-objects-fallback": "false",
  "data-layout": "e-m:o-i64:64-i128:128-n32:64-S128-Fn32",
  "disable-redzone": true,
  "features": "+v8a,+strict-align,-neon,-fp-armv8",
  "is-builtin": false,
  "linker": "ld64.lld",
  "linker-flavor": "gnu-lld",
  "llvm-target": "aarch64-unknown-none-macho",
  "max-atomic-width": 128,
  "metadata": {
    "description": "Bare ARM64, softfloat",
    "host_tools": false,
    "std": false,
    "tier": 2
  },
  "panic-strategy": "abort",
  "relocation-model": "static",
  "stack-probes": {
    "kind": "inline"
  },
  "target-pointer-width": "64"
}

I expected to see this happen: No errors

Instead, this happened:

rustc-LLVM ERROR: Global variable '__rustc_debug_gdb_scripts_section__' has an invalid section specifier '.debug_gdb_scripts': mach-o section specifier requires a segment and section separated by a comma.
Meta

rustc --version --verbose:

rustc 1.83.0-nightly (6f4ae0f34 2024-10-08)
binary: rustc
commit-hash: 6f4ae0f34503601e54680a137c1db0b81b56cc3d
commit-date: 2024-10-08
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

Unfortunately RUST_BACKTRACE=1 doesn't change anything so I cannot give backtrace at the moment. I will look into building rustc if needed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the aarch64 bare-metal target JSON from the issue and inspect how rustc emits the rustc_debug_gdb_scripts_section section for Mach-O targets. Done means the target builds without LLVM rejecting the .debug_gdb_scripts section specifier; no project files or tests are named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.