Skip to content

Handle overloaded constructors with mangled symbols in map generator#4940

Draft
tarek-y-ismail wants to merge 1 commit into
mainfrom
symbols-map-generator-handle-overloaded-symbols
Draft

Handle overloaded constructors with mangled symbols in map generator#4940
tarek-y-ismail wants to merge 1 commit into
mainfrom
symbols-map-generator-handle-overloaded-symbols

Conversation

@tarek-y-ismail
Copy link
Copy Markdown
Contributor

What's new?

Problem

When a public class has multiple constructor overloads, the symbols map generator emits a single wildcard glob (e.g. miral::Foo::Foo*;) to cover all of them. This has two drawbacks: the wildcard exports every overload under the same version stanza even when individual overloads were introduced in later releases, and quoted demangled names for constructors with nested template arguments (e.g. std::function<…>) are rendered differently by ld and lld, causing linker failures depending on the toolchain. Additionally, mangled symbols were incorrectly placed in the extern "C++" block of the map file rather than the top-level global: section where they belong.

Solution

For overloaded constructors, the generator now emits each constructor's individual mangled symbol instead of a wildcard glob, placing it in the global: section of the map file. To prevent duplicates when re-running the generator over an existing map, two new helpers are introduced: demangle_symbol (via c++filt) and is_symbol_covered_by_previous, which recognises whether a newly-generated mangled symbol is already represented by an existing entry — whether as an exact match, a C1/C2 constructor variant, or a matching quoted/wildcard demangled entry — and suppresses the duplicate accordingly.

How to test

Checklist

  • Tests added and pass
  • Adequate documentation added
  • (optional) Added Screenshots or videos

Emit mangled symbols for overloaded constructors to avoid wildcard
over-exporting and demangling inconsistencies. Add logic to detect and
deduplicate symbols already covered by wildcards or quoted entries.
Assign mangled symbols to the global section in the output.
@tarek-y-ismail tarek-y-ismail self-assigned this May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant