[LLVMdev] [lld] adding demangler for symbol resolution

Shankar Easwaran shankare at codeaurora.org
Thu Dec 11 21:38:19 PST 2014


One source of confusion is libstdc++ owns the API __cxa_demangle, when 
the demangle code is moved from libc++ to llvm, does libc++ link with 
libSupport ?

libc++ needs to continue to own the demangle API too, IMO.

Shankar Easwaran

On 12/11/2014 6:24 PM, Sean Silva wrote:
> The simplest long-term solution would probably be to just add demangling in
> a portable way to libSupport. Then we don't need to conditionalize or
> anything. We just call llvm::demangle(). This is the only viable solution
> for proper cross-linking anyway.
>
> Given that there should be existing demanglers we can reuse, I'm not sure
> that this long term solution is significantly more difficult than the short
> term solution you are proposing.
>
> -- Sean Silva
>
> On Tue, Apr 1, 2014 at 9:19 PM, Shankar Easwaran <shankare at codeaurora.org>
> wrote:
>> Hi Nick, Bigcheese,
>>
>> When lld is used to link C++ code, it would be required to demangle symbol
>> names by default/user driven option.
>>
>> The Gnu linker has the following options :-
>>
>> --demangle=[style]
>> --no-demangle
>>
>> I found that clang/llvm-symbolizer use __cxx_demangle function.
>>
>> I would think that lld also need to call the same function, and I think
>> the way we want to demangle is to have the function in LinkingContext as
>> various flavors may choose to use different API's to demangle symbol names.
>>
>> The API's that would be in LinkingContext would be :-
>>
>>          * virtual bool canDemangle()  = 0; // Does the flavor provide a
>> way to demangle symbol names ?
>>          * virtual std::string demangle(StringRef symbolName) = 0; //
>> demangle the symbol name
>>
>> Thoughts / Suggestions ?
>>
>> Thanks
>>
>> Shankar Easwaran
>>
>> --
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
>> by the Linux Foundation
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-dev mailing list