Skip to content

Rustc 1.32 segfaults with llvm 7.0.1 while building fd-find and lto=true enabled #57801

@Mic92

Description

@Mic92

While binaries by provided by mozilla are compiled against its bundled llvm, distributions such as archlinux, fedora and NixOS link rust against the upstream llvm version.

Also the rust project itself don't has this version yet, it might be still useful to track this issue here as it will eventually also affect the project if they ever upgrade llvm.

Steps to reproduce:

$ cargo --version
cargo 1.32.0
$ rustc --version
rustc 1.32.0
$ cargo install fd-find
....
   Compiling clap v2.32.0
   Compiling parking_lot v0.7.1
   Compiling ctrlc v3.1.1
   Compiling crossbeam-channel v0.3.6
   Compiling fd-find v7.2.0
   Compiling globset v0.4.2
   Compiling ignore v0.4.6
error: failed to compile `fd-find v7.2.0`, intermediate artifacts can be found at `/tmp/cargo-installCT8S32`

Caused by:
  Could not compile `fd-find`.

Caused by:
  process didn't exit successfully: `rustc --crate-name fd /root/.cargo/registry/src/github.com-1ecc6299db9ec823/fd-find-7.2.0/src/main.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C codegen-units=1 -C metadata=a3a6a7cb919634a5 -C extra-filename=-a3a6a7cb919634a5 --out-dir /tmp/cargo-installCT8S32/release/deps -L dependency=/tmp/cargo-installCT8S32/release/deps --extern ansi_term=/tmp/cargo-installCT8S32/release/deps/libansi_term-da0b45e138ff353b.rlib --extern atty=/tmp/cargo-installCT8S32/release/deps/libatty-d255fe7ee8d55655.rlib --extern clap=/tmp/cargo-installCT8S32/release/deps/libclap-f83ca700ee891f8b.rlib --extern ctrlc=/tmp/cargo-installCT8S32/release/deps/libctrlc-03b9fe7f29c143b5.rlib --extern humantime=/tmp/cargo-installCT8S32/release/deps/libhumantime-67b9f25c854b0215.rlib --extern ignore=/tmp/cargo-installCT8S32/release/deps/libignore-1259b5bca495d9c6.rlib --extern lazy_static=/tmp/cargo-installCT8S32/release/deps/liblazy_static-7deee2bf7505e8c9.rlib --extern libc=/tmp/cargo-installCT8S32/release/deps/liblibc-e3278554887eedae.rlib --extern num_cpus=/tmp/cargo-installCT8S32/release/deps/libnum_cpus-f24ed7872633de1c.rlib --extern regex=/tmp/cargo-installCT8S32/release/deps/libregex-dcae60647554bb97.rlib --extern regex_syntax=/tmp/cargo-installCT8S32/release/deps/libregex_syntax-16497b92e03853d9.rlib --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)

This happens both on archlinux (#61490) and on NixOS (#54323). Both distributions uses llvm 7.0.1 instead of the llvm version that is provided by rust. The problem goes away when using the vendored llvm source.

This is backtrace of the coredump: https://gist.github.com/e337646429c41d93a089aaa45b8d2375
as generated by gdb rustc core -batch -ex bt.
The error suggest that it might be related to generating debugging symbols.

cc @foutrelis

UPDATE: the error also seems to go away, when I disable lto optimization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions