Skip to content

Linking broken on arm64ec due to __rust_alloc_error_handler_should_panic symbol #143253

@purplesyringa

Description

@purplesyringa

Attempting to link any program on the arm64ec target yields

error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostARM64\\arm64\\link.exe" "/NOLOGO" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcou23Eq\\symbols.o" "<72 object files omitted>" "<sysroot>\\lib\\rustlib\\arm64ec-pc-windows-msvc\\lib/{libtest-*,libgetopts-*,libunicode_width-*,librustc_std_workspace_std-*,libstd-*,libpanic_unwind-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,libcfg_if-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/machine:arm64ec" "softintrin.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\runneradmin\\.cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\windows_x86_64_msvc-0.52.6\\lib" "/OUT:C:\\a\\lithium\\lithium\\target\\arm64ec-pc-windows-
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: symbols.o : error LNK2001: unresolved external symbol #_RNvCse3amHqTQ2bx_7___rustc39___rust_alloc_error_handler_should_panic (EC Symbol)␍
          symbols.o : error LNK2001: unresolved external symbol #_RNvCse3amHqTQ2bx_7___rustc39___rust_alloc_error_handler_should_panic (EC Symbol)␍
          C:\a\lithium\lithium\target\arm64ec-pc-windows-msvc\debug\deps\lithium-21aeb5d0fedc4d6a.exe : fatal error LNK1120: 1 unresolved externals␍

I think this was broken by #140809, more specifically 0cdd7f5 which started exporting all #[rustc_std_internal_symbol] symbols. __rust_alloc_error_handler_should_panic is a static, but is erroneously marked as a function and that breaks mangling. I've tried to draft a PR to mark it as Data, but I think might encounter the same problems as what eventually lead to #141061 and I'm not qualified to judge that.

cc @dpaoliello

Versions

My CI has passed on rustc 1.90.0-nightly (b03b3a7ec 2025-06-26) and now fails on rustc 1.90.0-nightly (35f603652 2025-06-29). I don't really have access to an ARM64 Windows machine other than that, but this is probably enough info? Here's the relevant Actions job.

@rustbot label +A-allocators +A-linkage +O-AArch64 +O-windows-msvc +T-compiler -needs-triage

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsA-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.O-AArch64Armv8-A or later processors in AArch64 modeO-windows-msvcToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions