Closed
Description
Issue: gdb
shows globals as <optimized out>
when a rust program is compiled with llvm 4.0.
Test program:
static mut I64: i64 = -64;
fn main() {
_zzz();
let _a = unsafe { I64 };
}
fn _zzz() {()}
Compiling with rust + LLVM 4.0 produces this IR, excerpts:
@_ZN5globt3I6417h1343cea697c2f8f6E = internal global i64 -64, align 8
!6 = !DIGlobalVariableExpression(var: !7)
!7 = distinct !DIGlobalVariable(name: "I64", linkageName: "_ZN5globt3I64E", scope: !8, file: !9, line: 1, type: !10, isLocal: true, isDefinition: true, align: 8)
From looking at the clang 4.0 output of a similar program, I have determined that the static definition (excerpt line 1) is missing a , !dbg !6
. The addition of such a !dbg
fixed the issue, as verified by manually editing the IR and compiling with llc
.
cc @michaelwoerister, @dylanmckay
If someone can point me in the right direction, where / what functions should be called, I can try to fix this (I can also test any potential patches).
Edit: Also feel free to ping me on IRC.
Metadata
Metadata
Assignees
Labels
No labels