Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWARF gets incorrect DW_AT_linkage_name for generics #32925

Closed
tromey opened this issue Apr 13, 2016 · 4 comments
Closed

DWARF gets incorrect DW_AT_linkage_name for generics #32925

tromey opened this issue Apr 13, 2016 · 4 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug.

Comments

@tromey
Copy link
Contributor

tromey commented Apr 13, 2016

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
@Aatch Aatch added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Apr 13, 2016
@michaelwoerister
Copy link
Member

Yes, that's a known issue. In former times, it was the only way to get GDB to print nice, fully-qualified function names. We might want to revisit that though.

@tromey
Copy link
Contributor Author

tromey commented Jun 26, 2016

Nightly is emitting values that are even less valid, like:

    <db>   DW_AT_linkage_name: (indirect string, offset: 0x422): _ZN7methods8{{impl}}3newE

@steveklabnik
Copy link
Member

Triage: not sure if anything has changed here, but I don't think so.

@tmiasko
Copy link
Contributor

tmiasko commented Jan 18, 2022

This was fixed at some point, probably by #46899:

$ rustc ba.rs -g
$ readelf -wi ba |grep identity
    <386>   DW_AT_linkage_name: (indirect string, offset: 0x42d): _ZN2ba8identity17h4032c34ace3f366cE
    <38a>   DW_AT_name        : (indirect string, offset: 0x451): identity<u64>
    <3bb>   DW_AT_linkage_name: (indirect string, offset: 0x45f): _ZN2ba8identity17h97d8ddefaee8e693E
    <3bf>   DW_AT_name        : (indirect string, offset: 0x483): identity<i32>
$ nm ba | grep identity
0000000000007c20 t _ZN2ba8identity17h4032c34ace3f366cE
0000000000007c30 t _ZN2ba8identity17h97d8ddefaee8e693E

@tmiasko tmiasko closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

6 participants