Handle overloaded constructors with mangled symbols in map generator#4940
Draft
tarek-y-ismail wants to merge 1 commit into
Draft
Handle overloaded constructors with mangled symbols in map generator#4940tarek-y-ismail wants to merge 1 commit into
tarek-y-ismail wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 byldandlld, causing linker failures depending on the toolchain. Additionally, mangled symbols were incorrectly placed in theextern "C++"block of the map file rather than the top-levelglobal: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(viac++filt) andis_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