Skip to content

no_std_test: declare the personality routine as the lang item (fixes NoStdBuild on current nightly) - #1191

Merged
schungx merged 1 commit into
rhaiscript:mainfrom
yuvalrakavy:fix-no-std-test-eh-personality
Oct 17, 2026
Merged

schungx merged 1 commit into
rhaiscript:mainfrom
yuvalrakavy:fix-no-std-test-eh-personality

Conversation

@yuvalrakavy

Copy link
Copy Markdown
Contributor

Fixes the NoStdBuild jobs, which have been red on every branch since the nightly of 2026-10-16 (seen on #1189 and #1190, which touch nothing no_std-specific; main's run of 2026-10-13 was still green).

rust-lang/rust#148413 (merged 2026-10-15) mangles the personality symbol like the other std-internal symbols, so the pre-built core/alloc now reference __rustc::rust_eh_personality, and the #[no_mangle] extern "C" fn rust_eh_personality() in no_std/no_std_test/src/main.rs no longer satisfies the linker:

error: linking with `cc` failed: exit status: 1
  = note: Undefined symbols for architecture arm64:
            "__RNvCs6EUDi8WbMwz_7___rustc19rust_eh_personality", referenced from: ...

The change declares the function as #[lang = "eh_personality"] (with #![feature(lang_items)]), which is what rust-lang/rust's own no_std binary fixture (tests/run-make/no-alloc-shim/foo.rs) moved to in that PR. The compiler then emits the symbol under whatever name it expects, so the harness builds on nightlies before and after the change. The routine is still never called, since every profile sets panic = "abort"; the other shims are untouched.

Verified locally on aarch64-apple-darwin: with nightly-2026-10-16 the harness fails to link without this change and builds with it, for --profile unix and --profile macos; with nightly-2026-10-09 it builds either way.

🤖 Generated with Claude Code

Since rust-lang/rust#148413 (in nightly 2026-10-16) the compiler mangles the
personality symbol like the other std-internal symbols, so the pre-built
`core`/`alloc` now reference `__rustc::rust_eh_personality` and the
`#[no_mangle] extern "C" fn rust_eh_personality()` in no_std_test no longer
satisfies the linker:

    error: linking with `cc` failed
      = note: Undefined symbols for architecture arm64:
                "__RNvCs6EUDi8WbMwz_7___rustc19rust_eh_personality"

Every NoStdBuild job has failed with this since that nightly, on every branch.

Declare the function as `#[lang = "eh_personality"]` instead (with
`#![feature(lang_items)]`), the shape rust-lang/rust's own no_std binary
fixture (tests/run-make/no-alloc-shim/foo.rs) moved to in that PR. The
compiler then emits the symbol under whatever name it expects, so this builds
on the nightlies before and after the change. The routine is still never
called: every profile sets `panic = "abort"`.

Built with nightly 2026-10-16 (fails without this change) and nightly
2026-10-09 (builds either way), `--profile unix` and `--profile macos`.
@schungx schungx added the bug label Oct 17, 2026
@schungx
schungx merged commit 5cbef10 into rhaiscript:main Oct 17, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants