Skip to content

LLVM assertion when cargo building std with panic=abort #37252

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
japaric opened this issue Oct 18, 2016 · 1 comment · Fixed by #37974
Closed

LLVM assertion when cargo building std with panic=abort #37252

japaric opened this issue Oct 18, 2016 · 1 comment · Fixed by #37974

Comments

@japaric
Copy link
Member

japaric commented Oct 18, 2016

STR

$ cargo new --bin foo && cd $_
$ edit Cargo.toml && cat $_
# Cargo.toml
[package]
name = "foo"
version = "0.1.0"

[dependencies]
std = { path = "$(rustc --print sysroot)/lib/rustlib/src/rust/src/libstd" }

[profile.dev]
panic = "abort"
$ cargo build -j1
   Compiling build_helper v0.1.0 (file://$sysroot/lib/rustlib/src/rust/src/build_helper)
   Compiling unwind v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libunwind)
   Compiling core v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libcore)
   Compiling alloc v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/liballoc)
   Compiling libc v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/rustc/libc_shim)
   Compiling panic_abort v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libpanic_abort)
   Compiling alloc_system v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/liballoc_system)
   Compiling rustc_unicode v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/librustc_unicode)
   Compiling rand v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/librand)
   Compiling gcc v0.3.37
   Compiling compiler_builtins v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libcompiler_builtins)
warning: ar: `u' modifier ignored since `D' is thedefault (see `U')
   Compiling std v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libstd)
   Compiling collections v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libcollections)
   Compiling panic_unwind v0.0.0 (file://$sysroot/lib/rustlib/src/rust/src/libpanic_unwind)
rustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp:1436: void llvm::StoreInst::AssertOK(): Assertion`getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
error: Could not compile `panic_unwind`.

Meta

$ rustc -Vv
rustc 1.14.0-nightly (6dc035ed9 2016-10-15)
binary: rustc
commit-hash: 6dc035ed911672c6a1f7afc9eed15fb08e574e5b
commit-date: 2016-10-15
host: x86_64-unknown-linux-gnu
release: 1.14.0-nightly

The issue, I think, is that Cargo tries to build panic_unwind with
panic=abort. Perhaps, we could fix this by adding a Cargo feature that
disables the compilation of panic_unwind and that's supposed to be used in
conjunction with panic=abort. Of course, it'd be better if this was automatic
but I don't think that's possible.

cc @alexcrichton
cc #36610

@alexcrichton
Copy link
Member

Ayup that'd do it.

We should probably turn panic_unwind into a feature of the standard library (e.g. a feature in Cargo.toml) which is turned off by default. When compiling with rustbuild, however, we'd enable it.

japaric pushed a commit to japaric/rust that referenced this issue Nov 24, 2016
with this feature disabled, you can (Cargo) compile std with
"panic=abort"

rustbuild will build std with this feature enabled, to maintain the
status quo

fixes rust-lang#37252
bors added a commit that referenced this issue Nov 25, 2016
std: make compilation of libpanic_unwind optional via a Cargo feature

with this feature disabled, you can (Cargo) compile std with
"panic=abort"

rustbuild will build std with this feature enabled, to maintain the
status quo

fixes #37252

r? @alexcrichton
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants