Skip to content

[LLVM 4.0] Incomplete debuginfo for globals. #40580

Description

@TimNN

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions