Skip to content

DWARF gets incorrect DW_AT_linkage_name for generics #32925

Closed
@tromey

Description

@tromey

Consider a source file like:

fn identity<A>(x: A) -> A { return x; }

fn main() {
    println!("{}", identity(5i32));
    println!("{}", identity(5u64));
}

When compiled with rustc -g, the generated DWARF has incorrect values for DW_AT_linkage_name. These should agree with nm but do not:

bapiya. readelf -wi ba |grep identity
    <19c>   DW_AT_linkage_name: (indirect string, offset: 0x3c8): _ZN2ba13identity<i32>E
    <1a0>   DW_AT_name        : (indirect string, offset: 0x3df): identity<i32>
    <1d1>   DW_AT_linkage_name: (indirect string, offset: 0x41d): _ZN2ba13identity<u64>E
    <1d5>   DW_AT_name        : (indirect string, offset: 0x434): identity<u64>
bapiya. nm ba | grep identity
0000000000005160 t _ZN8identity21h16171468230716265285E
00000000000051a0 t _ZN8identity21h18186590313173030232E

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions