[Symbolize][MinGW] Support demangling i386 call-conv-decorated C++ names
authorAlvin Wong <alvin@alvinhc.com>
Tue, 14 Feb 2023 22:38:52 +0000 (06:38 +0800)
committerAlvin Wong <alvin@alvinhc.com>
Wed, 15 Feb 2023 11:07:05 +0000 (19:07 +0800)
commite117fd28d525ead14b809da3a9b5ef22710ca351
treed53b2d4ed3c91d232363a8c815520902eafecbcf
parent14fcdd7f9d7b3973661efc5a426da18e077155bf
[Symbolize][MinGW] Support demangling i386 call-conv-decorated C++ names

On i386 Windows, after C++ names have been Itanium-mangled, the C name
mangling specific to its call convention may also be applied on top.
This change teaches symbolizer to be able to demangle this type of
mangled names.

As part of this change, `demanglePE32ExternCFunc` has also been modified
to fix unwanted stripping for vectorcall names when the demangled name
is supposed to contain a leading `_`. Notice that the vectorcall
mangling does not add either an `_` or `@` prefix. The old code always
tries to strip the prefix first, which for Itanium mangled names in
vectorcall, the leading underscore of the Itanium name gets stripped
instead and breaks the Itanium demangler.

Differential Revision: https://reviews.llvm.org/D144049
llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
llvm/test/DebugInfo/symbolize-demangling-mingw32.s [new file with mode: 0644]