These aliases are produced by MergeFunctions and need to be mangled according to the calling convention of the function they are pointing to instead of defaulting to the C calling convention.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I have some misgivings about this, but I think this is probably the best way forward for now.
I think it was always a mistake to do IR mangling based on the calling convention and prototype. However, that's what we do, and removing that is a long process. FWIW clang never relies on the IR mangler for functions like this, it does the mangling itself.
The other way to handle this is to teach merge functions to do IR mangling. Merge functions can create a Mangler object with the DataLayout from the Module. Then it can create escaped aliases with names like "\01@foo@20". After thinking about it, I think I prefer your approach, despite the surprising behavior.
In the long run, I would like to remove this calling convention mangling altogether, at which point this change will be deleted.
For context, I encountered a linker error caused by this in Rust which does use the IR mangler.