rust-lang / rust-lang/rust-analyzer
proc-macro server exited with signal: 6 (SIGABRT) on MacOS when LTO is enabled
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
uname -a
Darwin Davids-Mac-mini-398.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 arm64
rust-analyzer --version
rust-analyzer 1.84.1 (e71f9a9a 2025-01-27)
rustc --version
rustc 1.84.1 (e71f9a9a9 2025-01-27)
See example demonstrating the issue: https://github.com/dave-fl/ra_ex_project
if LTO is enabled on MacOS (and possibly other operating systems). Then Rust Analyzer will SIGABRT.
Using rustflags = ["-C", "linker-plugin-lto", "-C", "link-arg=-fuse-ld=lld"] is problematic while rustflags = ["-C", "link-arg=-fuse-ld=lld"] is fine.
See example repo. If I turn off LTO via config.toml then there is no issue.
This is my linker script which is not in the repo.
#!/bin/sh
# wrapper to adapt ld64 to gnu style arguments
declare -a args=()
for arg in "$@"
do
if [[ $arg == "-Wl,"* ]]; then
IFS=',' read -r -a options <<< "${arg#-Wl,}"
for option in "${options[@]}"
do
if [[ $option == "-plugin="* ]] || [[ $option == "-plugin-opt=mcpu="* ]]; then
:
elif [[ $option == "-plugin-opt=O"* ]]; then
args[${#args[@]}]="-Wl,--lto-CGO${option#-plugin-opt=O}"
else
args[${#args[@]}]="-Wl,$option"
fi
done
else
args[${#args[@]}]="$arg"
fi
done
exec ${CXX:-/opt/homebrew/opt/llvm/bin/clang++} "${args[@]}"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked ra_ex_project on macOS and reproduce the failure using rustflags with linker-plugin-lto, then compare it with the configuration that only uses -fuse-ld=lld. Inspect the proc-macro server path involved in the SIGABRT; done means the LTO configuration no longer aborts while the non-LTO behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100