Description
This technically subsumes:
The problem is:
- any item marked
no_mangle
is given a mangledlinkage_name
- 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.