[cfe-dev] Question about consistency of mangled link names

Rodney M. Bates rodney_bates at lcwb.coop
Wed Dec 3 07:46:24 PST 2014


Thanks, I know how to proceed.

On 11/29/2014 02:47 PM, Richard Smith wrote:
> On 29 Nov 2014 09:35, "David Blaikie" <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
>  >
>  >
>  >
>  > On Sat, Nov 29, 2014 at 8:08 AM, Rodney M. Bates <rodney_bates at lcwb.coop <mailto:rodney_bates at lcwb.coop>> wrote:
>  >>
>  >> I am working on a project that entails writing calls in Modula3 code to C
>  >> and C++ code in the llvm infrastructure.  For C, things are fine.  For C++,
>  >> they are working, but I am having to put the mangled linker name in my binding.
>  >>
>  >> My questions are
>  >>
>  >> 1) Does the mangled linker name of a C++ nonmember function depend only on the
>  >>    function signature?
>  >
>  >
>  > Yes (mangling is there to support overloading and namespaces - since the underlying symbol system doesn't support either, mangling is the task of putting all the unique data about a function into the (mangled) name)
>  >
>  >>
>  >>
>  >> 2) Do gcc and clang both mangle the same?
>  >
>  >
>  > Yes - this is necessary for C++ libraries compiled with Clang to link successfully with C++ libraries compiled with GCC.
>
> The mangling scheme used for most platforms (used by all gcc-supported platforms IIUC, but notably not used by MSVC) is documented here: https://mentorembedded.github.io/cxx-abi/abi.html#mangling
>
>  > (modulo bugs, edge cases, etc)
>  >
>  >>
>  >>
>  >> If not, then I will probably need to do more work to produce C bindings
>  >> similar to those in llvm-c/Core.h
>  >>
>  >> --
>  >> Rodney Bates
>  >> rodney.m.bates at acm.org <mailto:rodney.m.bates at acm.org>
>  >> _______________________________________________
>  >> cfe-dev mailing list
>  >> cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
>  >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>  >
>  >
>  >
>  > _______________________________________________
>  > cfe-dev mailing list
>  > cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
>  > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>  >
>

-- 
Rodney Bates
rodney.m.bates at acm.org



More information about the cfe-dev mailing list