Skip to content

incorrect DW_AT_location for static #32574

Open
@tromey

Description

@tromey

I'm using rust from the Fedora COPR:

bapiya. rustc --version
rustc 1.7.0 (a5d1e7a59 2016-02-29)

Consider this program:

pub static AA: i32 = 5;

fn main() {
}

I compile with -g and then examine the DWARF using readelf. I see:

 <2><2f>: Abbrev Number: 3 (DW_TAG_variable)
    <30>   DW_AT_name        : (indirect string, offset: 0x48): AA
    <34>   DW_AT_type        : <0x62>
    <38>   DW_AT_decl_file   : 1
    <39>   DW_AT_decl_line   : 1
    <3a>   DW_AT_location    : 9 byte block: 3 0 0 0 0 0 0 0 0  (DW_OP_addr: 0)
    <44>   DW_AT_linkage_name: (indirect string, offset: 0x4f): _ZN2b12AAE

Now, this variable is not actually emitted. There's no ELF symbol for it. Given this, it seems strange to emit DW_AT_linkage_name and DW_AT_location, especially considering that the latter is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions