Skip to content

DWARF: no_mangle items are given mangled linkage_names and namespace scopes #46487

New issue

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

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

Already on GitHub? # to your account

Closed
m4b opened this issue Dec 4, 2017 · 2 comments · Fixed by #72620
Closed

DWARF: no_mangle items are given mangled linkage_names and namespace scopes #46487

m4b opened this issue Dec 4, 2017 · 2 comments · Fixed by #72620
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug.

Comments

@m4b
Copy link
Contributor

m4b commented Dec 4, 2017

This technically subsumes:

#33172

The problem is:

  1. any item marked no_mangle is given a mangled linkage_name
  2. any item marked no_mangle is given a dwarf namespace scope

So basically, it's not correct at all.

On linux gdb this manifests in various ways, usually reporting the "symbol is in a file with no debugging information", and on lldb (tested on osx) the only way to disassemble a function, for example, is to namespace the mangled function like disass -n main::unmangled_function, which is obviously counter-intuitive.

According to the dwarf standard:

If the object file name for an entity is the same as the name in
the source program, then a linkage name attribute is omitted.

So I think the right thing to do here is not omit a linkage_name at all.

The PR in #46457 fixes this for statics; the change for functions and any other relevant no_mangle items should be relatively straightforward after.

@TimNN TimNN added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. labels Dec 5, 2017
@steveklabnik
Copy link
Member

Triage: it would be nice to have a way to reproduce this issue in this ticket.

@tmiasko
Copy link
Contributor

tmiasko commented May 26, 2020

Triage: For no_mangle items the linkage_name is included but value is correct, i.e., not mangled.

# for free to join this conversation on GitHub. Already have an account? # 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

Successfully merging a pull request may close this issue.

4 participants