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

proc-macro server exited with signal: 6 (SIGABRT) on MacOS when LTO is enabled #19135

Open
dave-fl opened this issue Feb 11, 2025 · 0 comments
Open
Labels
C-bug Category: bug

Comments

@dave-fl
Copy link

dave-fl commented Feb 11, 2025

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[@]}"
@dave-fl dave-fl added the C-bug Category: bug label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant