llvm-ar: Fix MinGW compilation

llvm-ar is using CompareStringOrdinal which is available
only starting with Windows Vista (WINVER 0x600).

Fix this by hoising WindowsSupport.h, which sets _WIN32_WINNT
to 0x0601, up to llvm/include/llvm/Support and use it in llvm-ar.

Patch by Cristian Adam!

Differential revision: https://reviews.llvm.org/D74599
This commit is contained in:
Hans Wennborg 2020-02-28 09:59:24 +01:00 committed by Gericom
parent d8016b0e78
commit 799c27e8ad
15 changed files with 14 additions and 15 deletions

View File

@ -236,7 +236,7 @@ bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
// XP, so if support for older versions of Windows is required, // XP, so if support for older versions of Windows is required,
// it will have to be added. // it will have to be added.
#include "Windows/WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
static LONG CALLBACK ExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo) static LONG CALLBACK ExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo)
{ {

View File

@ -15,7 +15,7 @@
#include <string> #include <string>
#ifdef _WIN32 #ifdef _WIN32
#include "Windows/WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#endif #endif
using namespace llvm; using namespace llvm;

View File

@ -17,7 +17,7 @@
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#ifdef _WIN32 #ifdef _WIN32
#include "Windows/WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#else #else
#include "Unix/Unix.h" #include "Unix/Unix.h"
#endif #endif

View File

@ -10,7 +10,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#include "llvm/Support/ConvertUTF.h" #include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"

View File

@ -10,7 +10,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#include <cstdio> #include <cstdio>
#include <string> #include <string>

View File

@ -17,7 +17,7 @@
#include "llvm/Support/WindowsError.h" #include "llvm/Support/WindowsError.h"
// The Windows.h header must be the last one included. // The Windows.h header must be the last one included.
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
static DWORD getWindowsProtectionFlags(unsigned Flags) { static DWORD getWindowsProtectionFlags(unsigned Flags) {
switch (Flags & llvm::sys::Memory::MF_RWE_MASK) { switch (Flags & llvm::sys::Memory::MF_RWE_MASK) {

View File

@ -25,7 +25,7 @@
// These two headers must be included last, and make sure shlobj is required // These two headers must be included last, and make sure shlobj is required
// after Windows.h to make sure it picks up our definition of _WIN32_WINNT // after Windows.h to make sure it picks up our definition of _WIN32_WINNT
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#include <shellapi.h> #include <shellapi.h>
#include <shlobj.h> #include <shlobj.h>

View File

@ -19,7 +19,7 @@
#include <malloc.h> #include <malloc.h>
// The Windows.h header must be after LLVM and standard headers. // The Windows.h header must be after LLVM and standard headers.
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>

View File

@ -10,7 +10,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ConvertUTF.h" #include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Errc.h" #include "llvm/Support/Errc.h"

View File

@ -23,7 +23,7 @@
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
// The Windows.h header must be after LLVM and standard headers. // The Windows.h header must be after LLVM and standard headers.
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#ifdef __MINGW32__ #ifdef __MINGW32__
#include <imagehlp.h> #include <imagehlp.h>

View File

@ -15,7 +15,7 @@
//=== is guaranteed to work on *all* Win32 variants. //=== is guaranteed to work on *all* Win32 variants.
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#include "llvm/Support/ThreadLocal.h" #include "llvm/Support/ThreadLocal.h"
namespace llvm { namespace llvm {

View File

@ -13,7 +13,7 @@
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h" #include "llvm/ADT/Twine.h"
#include "WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#include <process.h> #include <process.h>
// Windows will at times define MemoryFence. // Windows will at times define MemoryFence.

View File

@ -60,7 +60,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "llvm/Support/ConvertUTF.h" #include "llvm/Support/ConvertUTF.h"
#include "Windows/WindowsSupport.h" #include "llvm/Support/Windows/WindowsSupport.h"
#endif #endif
using namespace llvm; using namespace llvm;

View File

@ -45,8 +45,7 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #include "llvm/Support/Windows/WindowsSupport.h"
#include <windows.h>
#endif #endif
using namespace llvm; using namespace llvm;