[Lldb-commits] [lldb] [LLDB] Handle i686 mingw32 mangling prefix (PR #160930)

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 26 14:20:01 PDT 2025


mstorsjo wrote:

> I'm no real MinGW user, and I couldn't find documentation on the mangling used there, so I relied on examples. The mangled names on i686 mingw32 do have two underscores. From [this comment on an old patch](https://reviews.llvm.org/D22939#500090), it does seem like this is intended. But I can't find where Clang does this. Maybe @mstorsjo knows more?

I'm not entirely sure where that happens in the stack either, but you're right - there's a global `_` prefix on all symbols.

> Itanium specifies that mangled names start with _Z (and ___Z for blocks). A second leading underscore is a global symbol prefix added on some platforms (Darwin and possibly mingw?).

Exactly. The extra underscore prefix on i386 isn't mingw specific either, it's on MSVC as well - for regular C symbols. For other calling conventions (like fastcall or vectorcall) the prefix is different though, and for MSVC C++ mangled symbols, there's a different prefix. But Itanium C++ ABI on i386 works through the regular (cdecl) mangling, which adds a `_` prefix, just like all regular plain C functions.

https://github.com/llvm/llvm-project/pull/160930


More information about the lldb-commits mailing list