Skip to content

Segfault building libcore with stage1 rustc and RUSTFLAGS="-g" #15156

Closed
@luqmana

Description

@luqmana

As of the last LLVM update RUSTFLAGS="-g" is once again broken:

I bisected LLVM and traced it down to this commit rust-lang/llvm@503af43

Here is a backtrace:

-> % gdb --args x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 -g -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-linux-gnu  -D warnings -L "x86_64-unknown-linux-gnu/rt" -L "/scratch/laden/rust/build/x86_64-unknown-linux-gnu/llvm/Debug+Asserts/lib" -L ""  --out-dir x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib /scratch/laden/rust/src/libcore/lib.rs
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc...done.
(gdb) r
Starting program: /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 -g -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-linux-gnu -D warnings -L x86_64-unknown-linux-gnu/rt -L /scratch/laden/rust/build/x86_64-unknown-linux-gnu/llvm/Debug+Asserts/lib -L '' --out-dir x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib /scratch/laden/rust/src/libcore/lib.rs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1bff480 (LWP 5578)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1bff480 (LWP 5578)]
0x00007ffff572d772 in llvm::PointerIntPair<llvm::Value*, 2u, unsigned int, llvm::PointerLikeTypeTraits<llvm::Value*> >::getPointer (this=0xb8) at /scratch/laden/rust/src/llvm/include/llvm/ADT/PointerIntPair.h:76
76                               reinterpret_cast<void*>(Value & PointerBitMask));
(gdb) bt
#0  0x00007ffff572d772 in llvm::PointerIntPair<llvm::Value*, 2u, unsigned int, llvm::PointerLikeTypeTraits<llvm::Value*> >::getPointer (this=0xb8) at /scratch/laden/rust/src/llvm/include/llvm/ADT/PointerIntPair.h:76
#1  0x00007ffff571fe0c in llvm::ValueHandleBase::getValPtr (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:103
#2  0x00007ffff5f515b0 in llvm::AssertingVH<llvm::MDNode const>::getValPtr (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:195
#3  0x00007ffff5f49874 in llvm::AssertingVH<llvm::MDNode const>::operator llvm::MDNode const* (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:222
#4  0x00007ffff5f3a0b0 in llvm::LexicalScope::getScopeNode (this=0xa0) at /scratch/laden/rust/src/llvm/include/llvm/CodeGen/LexicalScopes.h:59
#5  0x00007ffff5f43af5 in llvm::DwarfDebug::endFunction (this=0x3eb1840, MF=0x2572620) at /scratch/laden/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1528
#6  0x00007ffff5f264a4 in llvm::AsmPrinter::EmitFunctionBody (this=0x2401390) at /scratch/laden/rust/src/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:864
#7  0x00007ffff5bf8547 in llvm::X86AsmPrinter::runOnMachineFunction (this=0x2401390, MF=...) at /scratch/laden/rust/src/llvm/lib/Target/X86/X86AsmPrinter.cpp:64
#8  0x00007ffff609e1eb in llvm::MachineFunctionPass::runOnFunction (this=0x2401390, F=...) at /scratch/laden/rust/src/llvm/lib/CodeGen/MachineFunctionPass.cpp:33
#9  0x00007ffff6784eab in llvm::FPPassManager::runOnFunction (this=0x1378560, F=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1545
#10 0x00007ffff678509c in llvm::FPPassManager::runOnModule (this=0x1378560, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1565
#11 0x00007ffff67853f9 in (anonymous namespace)::MPPassManager::runOnModule (this=0x372e0e0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1623
#12 0x00007ffff6785aaf in llvm::legacy::PassManagerImpl::run (this=0x24230f0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1730
#13 0x00007ffff6785cd5 in llvm::legacy::PassManager::run (this=0x32fc3b0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1767
#14 0x00007ffff571b397 in LLVMRustWriteOutputFile (Target=0x45197d0, PMR=0x32fc3b0, M=0x539ec0, path=<optimized out>, FileType=llvm::TargetMachine::CGFT_ObjectFile) at /scratch/laden/rust/src/rustllvm/PassWrapper.cpp:202
#15 0x00007ffff55756ed in rustc::back::link::write_output_file (sess=0x7ffff1bf4be8, target=0x45197d0, pm=0x32fc3b0, m=0x539ec0, output=<optimized out>, file_type=ObjectFile) at /scratch/laden/rust/src/librustc/back/link.rs:78
#16 0x00007ffff557d170 in fn105947 (cpm=0x32fc3b0) at /scratch/laden/rust/src/librustc/back/link.rs:341
#17 with_codegen (tm=0x45197d0, llmod=0x539ec0, no_builtins=<optimized out>, f=<optimized out>) at /scratch/laden/rust/src/librustc/back/link.rs:288
#18 fn105943 () at /scratch/laden/rust/src/librustc/back/link.rs:340
#19 0x00007ffff5577b89 in rustc::back::link::write::run_passes (sess=0x25db070, trans=<optimized out>, output=<optimized out>, output_types=...) at /scratch/laden/rust/src/librustc/back/link.rs:337
#20 0x00007ffff56c3751 in fn117831 () at /scratch/laden/rust/src/librustc/driver/driver.rs:436
#21 0x00007ffff562aeb1 in rustc::driver::driver::phase_5_run_llvm_passes (sess=<optimized out>, trans=<optimized out>, outputs=<optimized out>) at /scratch/laden/rust/src/librustc/driver/driver.rs:435
#22 0x00007ffff561f9f0 in rustc::driver::driver::compile_input (sess=..., cfg=..., input=<optimized out>, outdir=<optimized out>, output=<optimized out>) at /scratch/laden/rust/src/librustc/driver/driver.rs:100
#23 0x00007ffff56e5b29 in rustc::driver::run_compiler (args=...) at /scratch/laden/rust/src/librustc/driver/mod.rs:104
#24 0x00007ffff56e3446 in fn118655 () at /scratch/laden/rust/src/librustc/driver/mod.rs:40
#25 0x00007ffff56f875b in task::TaskBuilder$LT$S$GT$::try_future::closure.119840 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d252d482-0.11.0-pre.so
#26 0x00007ffff56f8603 in task::TaskBuilder$LT$S$GT$::spawn_internal::closure.119821 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d252d482-0.11.0-pre.so
#27 0x00007ffff7fc5c6c in fn7705 () at /scratch/laden/rust/src/libnative/task.rs:95
#28 0x00007ffff4235948 in task::Task::run::closure.5378 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt-d8560cb2-0.11.0-pre.so
#29 0x00007ffff429beac in rust_try () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt-d8560cb2-0.11.0-pre.so
#30 0x00007ffff423838a in rustrt::unwind::try (f=<optimized out>) at /scratch/laden/rust/src/librustrt/unwind.rs:151
#31 0x00007ffff42357fa in rustrt::task::Task::run (self=0x7ffff1c1d1e0, f=<optimized out>) at /scratch/laden/rust/src/librustrt/local.rs:32
#32 0x00007ffff7fc5ae3 in fn7679 () at /scratch/laden/rust/src/libnative/task.rs:95
#33 0x00007ffff42379c7 in thread::thread_start::h1f70d5c4c9ce8948kdd::v0.11.0.pre () at /scratch/laden/rust/src/librustrt/thread.rs:49
#34 0x00007ffff39d0b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#35 0x00007ffff3f0f0ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#36 0x0000000000000000 in ?? ()
(gdb)

cc @michaelwoerister

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions