mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 15:36:07 +00:00

This originally used the spelling Ws2_32 when added in a5ffabce98a4b2e9d69009fa3e60f2b154100860, but was changed to WS2_32 in 042a2e8932984e6c9f2017cbabb5bc66ad5419ce with the intent to use the canonical spelling from WinSDK, in order to aid cross compilation from case sensitive file systems with WinSDK. However, the WinSDK itself is self-inconsistent with respect to file name cases. Headers refer to each other with many different casings, so the original, out of the box casing doesn't work on case sensitive file systems. Import libraries like these use a variety of casings (some use all lowercase, some use CamelCase, some all uppercase, and the suffix is either .lib, .Lib or .LIB). In order to use the WinSDK on a case sensitive file system, these case issues has to be worked around somehow. Either by lowercasing all files (and the #includes within them, and potentially keeping symlinks with their original casing), or by setting up a Clang case insensitive VFS overlay. LLVM's llvm/cmake/platforms/WinMsvc.cmake sets up such a VFS overlay. For the linker, it creates a directory with lowercase symlinks. Therefore, the canonical way of handling these casing issues on case sensitive file systems is to consistently use lowercase. That is also what MinGW toolchains use. As an example, the same list of system_libs refers to advapi32, even if the actual file on disk in WinSDK is AdvAPI32.Lib. Likewise, other in-tree build systems that picked up this change for ws2_32 made it all lowercase, in b07aaf8d3bde911638b0370037204898c3c2deb7 and d22dad9f768fef376546053952f0b49b23bebfde. This also matches other existing references to ws2_32 in e.g. lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt and lldb/source/Utility/CMakeLists.txt.