Skip to content

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

Description

@m4b

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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