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
parent b17f292010
commit 01f9abbb50
15 changed files with 14 additions and 15 deletions

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
#include "WindowsSupport.h"
#include "llvm/Support/Windows/WindowsSupport.h"
#include "llvm/Support/ConvertUTF.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 <string>

View File

@ -17,7 +17,7 @@
#include "llvm/Support/WindowsError.h"
// The Windows.h header must be the last one included.
#include "WindowsSupport.h"
#include "llvm/Support/Windows/WindowsSupport.h"
static DWORD getWindowsProtectionFlags(unsigned Flags) {
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
// 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 <shlobj.h>

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "WindowsSupport.h"
#include "llvm/Support/Windows/WindowsSupport.h"
#include <process.h>
#include <bitset>

View File

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

View File

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