aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-08-31 08:43:21 +0000
committerRui Ueyama <ruiu@google.com>2015-08-31 08:43:21 +0000
commitf10a32014dc6991c716f0ee0475199710a6b2c15 (patch)
tree2c0c8ce948dba97a6a0176510c5e5d39ab166f56 /clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp
parente0a28e54c7ddd918b3b01805c20369b6078e0ce0 (diff)
downloadllvm-f10a32014dc6991c716f0ee0475199710a6b2c15.zip
llvm-f10a32014dc6991c716f0ee0475199710a6b2c15.tar.gz
llvm-f10a32014dc6991c716f0ee0475199710a6b2c15.tar.bz2
COFF: Improve dllexported name mangling compatibility.
The rules for dllexported symbols are overly complicated due to x86 name decoration, fuzzy symbol resolution, and the fact that one symbol can be resolved by so many different names. The rules are probably intended to be "intuitive", so that users don't have to understand the name mangling schemes, but it seems that it can lead to unintended symbol exports. To make it clear what I'm trying to do with this patch, let me write how the export rules are subtle and complicated. - x86 name decoration: If machine type is i386 and export name is given by a command line option, like /export:foo, the real symbol name the linker has to search for is _foo because all symbols are decorated with "_" prefixes. This doesn't happen on non-x86 machines. This automatic name decoration happens only when the name is not C++ mangled. However, the symbol name exported from DLLs are ones without "_" on all platforms. Moreover, if the option is given via .drectve section, no symbol decoration is done (the reason being that the .drectve section is created by a compiler and the compiler should always know the exact name of the symbol, I guess). - Fuzzy symbol resolution: In addition to x86 name decoration, the linker has to look for cdecl or C++ mangled symbols for a given /export. For example, it searches for not only _foo but also _foo@<number> or ??foo@... for /export:foo. Previous implementation didn't get it right. I'm trying to make it as compatible with MSVC linker as possible with this patch however the rules are. The new code looks a bit messy to me, but I don't think it can be simpler due to the ad-hoc-ness of the rules. llvm-svn: 246424
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp')
0 files changed, 0 insertions, 0 deletions