Michael137 wrote:

> > Could you elaborate the configuration here? Compiled with `clang-cl` on a 
> > Windows host I assume? Is this with `-gdwarf`? Couldn't get something like 
> > that to work on Godbolt
> 
> Sure, https://godbolt.org/z/Gj968q3xs shows the functions. Getting clang(-cl) 
> to build binaries for Windows on compiler explorer is always a bit tricky, so 
> I initially did it locally on Windows through a x86 command prompt.

Hah, interesting, so anything with a `stdcall` calling convention also gets 
this `_` prefix: 
https://github.com/llvm/llvm-project/blob/98d43ef2d842eb8b552b244a4ed6218d757682a1/clang/lib/AST/Mangle.cpp#L247-L257,
 as I now see @mstorsjo pointed out above.

Other C and C++ names don't have it in DWARF though (even on Windows), as your 
Godbolt link demonstrates.

This is quite the can of worms. Basically what ends up in DWARF as linkage 
names is whatever the Clang AST mangled to. But, iiuc, the global `_` prefix 
isn't yet attached to the mangled name at that point, unless we're using the 
`__stdcall` calling convention on supported targets. Arguably, the 
`DW_AT_linkage_name` in DWARF should be the linkage name that end up in the 
object files, but what we actually put there are the platform independent C++ 
mangled names. I'm still not 100% sure which level we'd want to strip these 
symbols at. For Mach-O, where we have the `_` prefix too, LLDB strips the 
prefix when parsing the symbol table.

https://github.com/llvm/llvm-project/pull/160930
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to