Maybe the msvc demangling should be within if (!mingw)? Performance wise it's probably irrelevant, but the itanium demangling, in combination with dllimport and i386 leading underscores, ended up as a few more lines, so an if (mingw) around it makes it a bit clearer.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I'm not very familiar with MinGW, but is Itanium name mangling in use on MinGW? MinGW is intended to be a native development environment for Windows, so I thought that they naturally use the platform way of mangling symbols.
Yes, MinGW uses Itanium name mangling only.
Yes, MinGW is intended to be a native development environment, but despite this (for historical reasons) it has done a lot of things very differently, due to being based on the GNU tools originally, and generally doing unixy things in COFF files. GCC doesn't support the MSVC C++ ABI at all, and the name mangling is only a very small part of the whole C++ ABI.
Generally the level of compatibility is that you can call between DLLs built by different tools, as long as it only has a pure C API, but you shouldn't expect to mix object files (or static libraries) between MSVC/link.exe and GCC/ld.bfd.
lld/trunk/COFF/Symbols.cpp | ||
---|---|---|
31 | It is trivial to disambiguate Itanium and MSVC symbols just by looking at the prefix. For both mangling types, we should ignore __imp_ prefixes in the same way. Then, Itanium names match _+Z, and Microsoft names start with ?. I think we should get rid of the two lld::demangleItanium/MSVC variants, add a check for ? in llvm::demangle, and standardize on that. The COFF demangle helper can do the __imp_ handling. Make sense? |
lld/trunk/COFF/Symbols.cpp | ||
---|---|---|
31 | Sounds sensible, I'll put it on my backlog and give it a shot. |
It is trivial to disambiguate Itanium and MSVC symbols just by looking at the prefix. For both mangling types, we should ignore __imp_ prefixes in the same way. Then, Itanium names match _+Z, and Microsoft names start with ?.
I think we should get rid of the two lld::demangleItanium/MSVC variants, add a check for ? in llvm::demangle, and standardize on that. The COFF demangle helper can do the __imp_ handling. Make sense?