clang: update to 5.0.0 (#2890)
Signed-off-by: Mateusz Mikula <mati865@gmail.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,19 @@
|
||||
From da82422a5f9c9709ba3ac15b52891b8b310278ad Mon Sep 17 00:00:00 2001
|
||||
From 6832b520f918211609cb0b6ee427e922720d4803 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Tue, 16 Aug 2016 12:55:01 -0700
|
||||
Subject: [PATCH 2/6] mingw-w64: use MSVC style ByteAlignment
|
||||
Subject: [PATCH 1/5] mingw-w64: use MSVC style ByteAlignment
|
||||
|
||||
We can do alignment without -aligncomm derectives in PE COFF
|
||||
Until we support GNU style in lld we should use this
|
||||
---
|
||||
lib/MC/WinCOFFStreamer.cpp | 4 ++--
|
||||
lib/MC/MCWinCOFFStreamer.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/MC/WinCOFFStreamer.cpp b/lib/MC/WinCOFFStreamer.cpp
|
||||
index 6383d879403..06a5aef0e3b 100644
|
||||
--- a/lib/MC/WinCOFFStreamer.cpp
|
||||
+++ b/lib/MC/WinCOFFStreamer.cpp
|
||||
@@ -217,7 +217,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
|
||||
diff --git a/lib/MC/MCWinCOFFStreamer.cpp b/lib/MC/MCWinCOFFStreamer.cpp
|
||||
index bf341bb1f45..3b3fecfc1d7 100644
|
||||
--- a/lib/MC/MCWinCOFFStreamer.cpp
|
||||
+++ b/lib/MC/MCWinCOFFStreamer.cpp
|
||||
@@ -222,7 +222,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
|
||||
auto *Symbol = cast<MCSymbolCOFF>(S);
|
||||
|
||||
const Triple &T = getContext().getObjectFileInfo()->getTargetTriple();
|
||||
@@ -22,7 +22,7 @@ index 6383d879403..06a5aef0e3b 100644
|
||||
if (ByteAlignment > 32)
|
||||
report_fatal_error("alignment is limited to 32-bytes");
|
||||
|
||||
@@ -229,7 +229,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
|
||||
@@ -234,7 +234,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
|
||||
Symbol->setExternal(true);
|
||||
Symbol->setCommon(Size, ByteAlignment);
|
||||
|
||||
@@ -32,5 +32,5 @@ index 6383d879403..06a5aef0e3b 100644
|
||||
raw_svector_ostream OS(Directive);
|
||||
const MCObjectFileInfo *MFI = getContext().getObjectFileInfo();
|
||||
--
|
||||
2.11.0.windows.3
|
||||
2.13.3
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From fffcfe99dab9c1ef714067d337159fbefbd5d139 Mon Sep 17 00:00:00 2001
|
||||
From b47a00af69f3c662e54dc54e482fc9b0d4ba6480 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Sun, 28 Jun 2015 20:14:51 +0100
|
||||
Subject: [PATCH 3/6] Fix GetHostTriple for mingw-w64 in msys
|
||||
Subject: [PATCH 2/5] Fix GetHostTriple for mingw-w64 in msys
|
||||
|
||||
---
|
||||
cmake/modules/GetHostTriple.cmake | 4 ++--
|
||||
@@ -26,5 +26,5 @@ index 0cad1db4eff..47e9f986e15 100644
|
||||
else( MSVC )
|
||||
set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
|
||||
--
|
||||
2.11.0.windows.3
|
||||
2.13.3
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 44b291e8ebb6d4a80843cf9b46b4804b0f0d6515 Mon Sep 17 00:00:00 2001
|
||||
From f4cea343d6e61f388de78241e89b1032ff11b0c7 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Pavlov <alexpux@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 20:14:51 +0100
|
||||
Subject: [PATCH 4/6] Globally provide DESTDIR for all platforms
|
||||
Subject: [PATCH 3/5] Globally provide DESTDIR for all platforms
|
||||
|
||||
---
|
||||
cmake/modules/LLVMInstallSymlink.cmake | 2 +-
|
||||
@@ -23,5 +23,5 @@ index 482697b06ba..61c4b9dea80 100644
|
||||
set(LINK_OR_COPY copy)
|
||||
endif()
|
||||
--
|
||||
2.11.0.windows.3
|
||||
2.13.3
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
From cccec8226592a0a635a4f00d5bf6f72803616e38 Mon Sep 17 00:00:00 2001
|
||||
From 56c0371a3cbc98ef5dc039324ad43c153ff601c4 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Thu, 2 Feb 2017 11:48:25 +0100
|
||||
Subject: [PATCH 6/6] llvm-config: look for unversioned shared lib on win32
|
||||
Subject: [PATCH 4/5] llvm-config: look for unversioned shared lib on win32
|
||||
|
||||
---
|
||||
tools/llvm-config/llvm-config.cpp | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
|
||||
index 25344e4cd01..24aeba7cb0f 100644
|
||||
index 08b096afb05..e388d9e5d3f 100644
|
||||
--- a/tools/llvm-config/llvm-config.cpp
|
||||
+++ b/tools/llvm-config/llvm-config.cpp
|
||||
@@ -351,7 +351,7 @@ int main(int argc, char **argv) {
|
||||
@@ -353,7 +353,7 @@ int main(int argc, char **argv) {
|
||||
const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE));
|
||||
if (HostTriple.isOSWindows()) {
|
||||
SharedExt = "dll";
|
||||
@@ -20,7 +20,7 @@ index 25344e4cd01..24aeba7cb0f 100644
|
||||
if (HostTriple.isOSCygMing()) {
|
||||
StaticExt = "a";
|
||||
StaticPrefix = "lib";
|
||||
@@ -389,8 +389,10 @@ int main(int argc, char **argv) {
|
||||
@@ -391,8 +391,10 @@ int main(int argc, char **argv) {
|
||||
const bool BuiltSharedLibs = !!LLVM_ENABLE_SHARED;
|
||||
|
||||
bool DyLibExists = false;
|
||||
@@ -34,5 +34,5 @@ index 25344e4cd01..24aeba7cb0f 100644
|
||||
// If LLVM_LINK_DYLIB is ON, the single shared library will be returned
|
||||
// for "--libs", etc, if they exist. This behaviour can be overridden with
|
||||
--
|
||||
2.11.0.windows.3
|
||||
2.13.3
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 6caf7048b2a66fa2beb198e52e5c62fa08b786e8 Mon Sep 17 00:00:00 2001
|
||||
From 9102055df75457e1194008ce6152221112a785ad Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Tue, 14 Mar 2017 17:50:29 +0100
|
||||
Subject: [PATCH] add pthread as system lib for mingw
|
||||
Subject: [PATCH 5/5] add pthread as system lib for mingw
|
||||
|
||||
---
|
||||
lib/Support/CMakeLists.txt | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt
|
||||
index 15418ad2fd0..c69f75b7e48 100644
|
||||
index 0a8e3897cce..de9cda5dda3 100644
|
||||
--- a/lib/Support/CMakeLists.txt
|
||||
+++ b/lib/Support/CMakeLists.txt
|
||||
@@ -2,6 +2,9 @@ set(system_libs)
|
||||
@@ -22,4 +22,5 @@ index 15418ad2fd0..c69f75b7e48 100644
|
||||
if( HAVE_LIBRT )
|
||||
set(system_libs ${system_libs} rt)
|
||||
--
|
||||
2.12.0
|
||||
2.13.3
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
From 1d467138106facb26fd780ada69314ee2ba865a2 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Pavlov <alexpux@gmail.com>
|
||||
Date: Thu, 2 Feb 2017 11:43:35 +0100
|
||||
Subject: [PATCH 5/6] not install msvc files
|
||||
|
||||
---
|
||||
tools/msbuild/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/msbuild/CMakeLists.txt b/tools/msbuild/CMakeLists.txt
|
||||
index 4f471e5408b..9d132ea58d5 100644
|
||||
--- a/tools/msbuild/CMakeLists.txt
|
||||
+++ b/tools/msbuild/CMakeLists.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
-if (WIN32)
|
||||
+if (MSVC)
|
||||
# CPack will install a registry key in this format that we wish to reference.
|
||||
set(REG_KEY "${CPACK_PACKAGE_INSTALL_REGISTRY_KEY}")
|
||||
set(LIB_PATH_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
|
||||
--
|
||||
2.11.0.windows.3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- llvm-4.0.0.src/tools/bugpoint/CMakeLists.txt
|
||||
+++ llvm-4.0.0.src/tools/bugpoint/CMakeLists.txt
|
||||
@@ -37,6 +37,4 @@
|
||||
--- llvm-5.0.0.src/tools/bugpoint/CMakeLists.txt.orig 2017-09-08 22:16:39.035644100 +0200
|
||||
+++ llvm-5.0.0.src/tools/bugpoint/CMakeLists.txt 2017-09-14 13:26:53.811311200 +0200
|
||||
@@ -38,6 +38,4 @@
|
||||
|
||||
if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
|
||||
target_link_libraries(bugpoint Polly)
|
||||
@@ -1,7 +1,7 @@
|
||||
From c1c93aaa9b8a903ce3f761ae2dabb20daf521f5c Mon Sep 17 00:00:00 2001
|
||||
From ded1b370c6ccbb427406edc6ab39656144d61818 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Pavlov <alexpux@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 20:14:51 +0100
|
||||
Subject: [PATCH 2/9] Allow build static clang library for mingw
|
||||
Subject: [PATCH 1/5] Allow build static clang library for mingw
|
||||
|
||||
---
|
||||
tools/libclang/CMakeLists.txt | 2 +-
|
||||
@@ -21,5 +21,5 @@ index 2dd6703076..477e53dd15 100644
|
||||
endif()
|
||||
|
||||
--
|
||||
2.12.0
|
||||
2.13.3
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From 43803cddf8b2f53203cacb575e1e53db4b8191ed Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Mon, 15 Aug 2016 20:57:27 -0700
|
||||
Subject: [PATCH 1/9] mingw-w64: enable support for __declspec(selectany)
|
||||
|
||||
---
|
||||
include/clang/Basic/Attr.td | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
|
||||
index d7db7186b3..ddb41c0eb8 100644
|
||||
--- a/include/clang/Basic/Attr.td
|
||||
+++ b/include/clang/Basic/Attr.td
|
||||
@@ -2194,9 +2194,8 @@ def DLLImport : InheritableAttr, TargetSpecificAttr<TargetWindows> {
|
||||
let Documentation = [DLLImportDocs];
|
||||
}
|
||||
|
||||
-def SelectAny : InheritableAttr {
|
||||
- let Spellings = [Declspec<"selectany">];
|
||||
- let LangOpts = [MicrosoftExt];
|
||||
+def SelectAny : InheritableAttr, TargetSpecificAttr<TargetWindows> {
|
||||
+ let Spellings = [Declspec<"selectany">, GCC<"selectany">];
|
||||
let Documentation = [Undocumented];
|
||||
}
|
||||
|
||||
--
|
||||
2.12.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 180bffbe07c0c43e7f103debc8d8d777cb027096 Mon Sep 17 00:00:00 2001
|
||||
From 4fea4f3cc0f23cc4aacc727cff812303a63a83b5 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Thu, 2 Feb 2017 12:21:45 +0100
|
||||
Subject: [PATCH 3/9] fix libclang name for mingw
|
||||
Subject: [PATCH 2/5] fix libclang name for mingw
|
||||
|
||||
---
|
||||
tools/libclang/CMakeLists.txt | 2 +-
|
||||
@@ -21,5 +21,5 @@ index 477e53dd15..dc2e3538fa 100644
|
||||
else()
|
||||
set(output_name "clang")
|
||||
--
|
||||
2.12.0
|
||||
2.13.3
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
From 0e31fbf4e602f857cd33c1b5b446da354b64df11 Mon Sep 17 00:00:00 2001
|
||||
From 5042e15216190f11cfb12f0c81c187c7353fb1d5 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Sun, 28 Jun 2015 19:12:19 +0100
|
||||
Subject: [PATCH 5/9] Set the x86 arch name to i686 for mingw-w64
|
||||
Subject: [PATCH 3/5] Set the x86 arch name to i686 for mingw-w64
|
||||
|
||||
---
|
||||
lib/Driver/Driver.cpp | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
|
||||
index b8ae7e4c31..a76ef16c8a 100644
|
||||
index ba4d0e836b..9f8c850b22 100644
|
||||
--- a/lib/Driver/Driver.cpp
|
||||
+++ b/lib/Driver/Driver.cpp
|
||||
@@ -381,6 +381,11 @@ static llvm::Triple computeTargetTriple(const Driver &D,
|
||||
@@ -429,6 +429,11 @@ static llvm::Triple computeTargetTriple(const Driver &D,
|
||||
|
||||
if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
|
||||
Target.setArch(AT);
|
||||
@@ -24,5 +24,5 @@ index b8ae7e4c31..a76ef16c8a 100644
|
||||
|
||||
// Handle -miamcu flag.
|
||||
--
|
||||
2.12.0
|
||||
2.13.3
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
From b1025201e074846b13132a7c417fa776312816fc Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Thu, 2 Feb 2017 12:26:19 +0100
|
||||
Subject: [PATCH 4/9] don't use GCC headers
|
||||
|
||||
---
|
||||
lib/Driver/MinGWToolChain.cpp | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/lib/Driver/MinGWToolChain.cpp b/lib/Driver/MinGWToolChain.cpp
|
||||
index e971869fb5..252c5e818f 100644
|
||||
--- a/lib/Driver/MinGWToolChain.cpp
|
||||
+++ b/lib/Driver/MinGWToolChain.cpp
|
||||
@@ -208,6 +208,7 @@ void MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
||||
if (DriverArgs.hasArg(options::OPT_nostdlibinc))
|
||||
return;
|
||||
|
||||
+#ifndef LLVM_ON_WIN32
|
||||
if (GetRuntimeLibType(DriverArgs) == ToolChain::RLT_Libgcc) {
|
||||
llvm::SmallString<1024> IncludeDir(GccLibDir);
|
||||
llvm::sys::path::append(IncludeDir, "include");
|
||||
@@ -218,6 +219,7 @@ void MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
||||
Base + Arch + "/sys-root/mingw/include");
|
||||
addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str());
|
||||
}
|
||||
+#endif
|
||||
addSystemInclude(DriverArgs, CC1Args,
|
||||
Base + Arch + llvm::sys::path::get_separator() + "include");
|
||||
addSystemInclude(DriverArgs, CC1Args, Base + "include");
|
||||
--
|
||||
2.12.0
|
||||
|
||||
25
mingw-w64-clang/0104-link-pthread-with-mingw.patch
Normal file
25
mingw-w64-clang/0104-link-pthread-with-mingw.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From 9498118b65fa150f074efb52b4507b53434a90ad Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Thu, 2 Feb 2017 12:33:51 +0100
|
||||
Subject: [PATCH 4/5] link pthread with mingw
|
||||
|
||||
---
|
||||
lib/Driver/ToolChains/MinGW.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/Driver/ToolChains/MinGW.cpp b/lib/Driver/ToolChains/MinGW.cpp
|
||||
index 632b76d92b..23da2d6376 100644
|
||||
--- a/lib/Driver/ToolChains/MinGW.cpp
|
||||
+++ b/lib/Driver/ToolChains/MinGW.cpp
|
||||
@@ -215,7 +215,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
if (Args.hasArg(options::OPT_pg))
|
||||
CmdArgs.push_back("-lgmon");
|
||||
|
||||
- if (Args.hasArg(options::OPT_pthread))
|
||||
+ if (!Args.hasArg(options::OPT_no_pthread))
|
||||
CmdArgs.push_back("-lpthread");
|
||||
|
||||
// add system libraries
|
||||
--
|
||||
2.13.3
|
||||
|
||||
26
mingw-w64-clang/0105-use-emulated-tls-with-mingw.patch
Normal file
26
mingw-w64-clang/0105-use-emulated-tls-with-mingw.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 89e43bd7141cc12f6b4eca71b549d6b2eb6030c0 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Wed, 1 Mar 2017 19:56:37 +0100
|
||||
Subject: [PATCH 5/5] use emulated tls with mingw
|
||||
|
||||
---
|
||||
lib/Driver/ToolChains/Clang.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp
|
||||
index 6a6b90f868..f7967fe79b 100644
|
||||
--- a/lib/Driver/ToolChains/Clang.cpp
|
||||
+++ b/lib/Driver/ToolChains/Clang.cpp
|
||||
@@ -3207,7 +3207,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
// Emulated TLS is enabled by default on Android and OpenBSD, and can be enabled
|
||||
// manually with -femulated-tls.
|
||||
bool EmulatedTLSDefault = Triple.isAndroid() || Triple.isOSOpenBSD() ||
|
||||
- Triple.isWindowsCygwinEnvironment();
|
||||
+ Triple.isWindowsCygwinEnvironment() ||
|
||||
+ Triple.isWindowsGNUEnvironment();
|
||||
if (Args.hasFlag(options::OPT_femulated_tls, options::OPT_fno_emulated_tls,
|
||||
EmulatedTLSDefault))
|
||||
CmdArgs.push_back("-femulated-tls");
|
||||
--
|
||||
2.13.3
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From 2156ae73b265c3c77803b5ee1e46af45b52fccc3 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Thu, 2 Feb 2017 12:33:51 +0100
|
||||
Subject: [PATCH 6/9] link pthread with mingw
|
||||
|
||||
---
|
||||
lib/Driver/Tools.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
|
||||
index 339f6976cd..7a6e1f6f36 100644
|
||||
--- a/lib/Driver/Tools.cpp
|
||||
+++ b/lib/Driver/Tools.cpp
|
||||
@@ -11428,7 +11428,8 @@ void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
if (Args.hasArg(options::OPT_pg))
|
||||
CmdArgs.push_back("-lgmon");
|
||||
|
||||
- if (Args.hasArg(options::OPT_pthread))
|
||||
+ // it might break libc++
|
||||
+ if (!Args.hasArg(options::OPT_no_pthread))
|
||||
CmdArgs.push_back("-lpthread");
|
||||
|
||||
// add system libraries
|
||||
--
|
||||
2.12.0
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From 2243dd85c1e5c27edf76cc7b5e2c836518ab2a6b Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Fri, 3 Feb 2017 11:04:25 +0100
|
||||
Subject: [PATCH 7/9] enable __float128 for X86 MinGW
|
||||
|
||||
---
|
||||
lib/Basic/Targets.cpp | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
|
||||
index d69a0ff4ab..9fe6c51be2 100644
|
||||
--- a/lib/Basic/Targets.cpp
|
||||
+++ b/lib/Basic/Targets.cpp
|
||||
@@ -4443,7 +4443,9 @@ static void addMinGWDefines(const LangOptions &Opts, MacroBuilder &Builder) {
|
||||
class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
|
||||
public:
|
||||
MinGWX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||
- : WindowsX86_32TargetInfo(Triple, Opts) {}
|
||||
+ : WindowsX86_32TargetInfo(Triple, Opts) {
|
||||
+ this->HasFloat128 = true;
|
||||
+ }
|
||||
void getTargetDefines(const LangOptions &Opts,
|
||||
MacroBuilder &Builder) const override {
|
||||
WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
|
||||
@@ -4735,6 +4737,7 @@ public:
|
||||
// with x86 FP ops. Weird.
|
||||
LongDoubleWidth = LongDoubleAlign = 128;
|
||||
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
|
||||
+ this->HasFloat128 = true;
|
||||
}
|
||||
|
||||
void getTargetDefines(const LangOptions &Opts,
|
||||
--
|
||||
2.12.0
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From 28f3e2bd27cb8e3f7a182a17d45af72303a47862 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Pavlov <alexpux@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 20:14:51 +0100
|
||||
Subject: [PATCH 8/9] Don't create cl executable for mingw
|
||||
|
||||
---
|
||||
tools/driver/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
|
||||
index f6e26fa11f..901b6d62e4 100644
|
||||
--- a/tools/driver/CMakeLists.txt
|
||||
+++ b/tools/driver/CMakeLists.txt
|
||||
@@ -61,7 +61,7 @@ add_dependencies(clang clang-headers)
|
||||
if(NOT CLANG_LINKS_TO_CREATE)
|
||||
set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
|
||||
|
||||
- if (WIN32)
|
||||
+ if (MSVC)
|
||||
list(APPEND CLANG_LINKS_TO_CREATE ../msbuild-bin/cl)
|
||||
endif()
|
||||
endif()
|
||||
--
|
||||
2.12.0
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From 7b80268c2f6475fcb932b961680ba6acdd33758d Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Wed, 1 Mar 2017 19:56:37 +0100
|
||||
Subject: [PATCH 9/9] use emulated tls with mingw
|
||||
|
||||
---
|
||||
lib/Driver/Tools.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
|
||||
index 7a6e1f6f36..4c7d40a549 100644
|
||||
--- a/lib/Driver/Tools.cpp
|
||||
+++ b/lib/Driver/Tools.cpp
|
||||
@@ -5423,7 +5423,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
|
||||
// Emulated TLS is enabled by default on Android, and can be enabled manually
|
||||
// with -femulated-tls.
|
||||
- bool EmulatedTLSDefault = Triple.isAndroid() || Triple.isWindowsCygwinEnvironment();
|
||||
+ bool EmulatedTLSDefault = Triple.isAndroid() || Triple.isWindowsCygwinEnvironment()
|
||||
+ || Triple.isWindowsGNUEnvironment();
|
||||
if (Args.hasFlag(options::OPT_femulated_tls, options::OPT_fno_emulated_tls,
|
||||
EmulatedTLSDefault))
|
||||
CmdArgs.push_back("-femulated-tls");
|
||||
--
|
||||
2.12.0
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
From 67f899a1294d8ad56ea60b02a6ed5b111e2c2d24 Mon Sep 17 00:00:00 2001
|
||||
From 9a4406ce9d21da7042974c049f3715e1a1e606fb Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Tue, 16 Aug 2016 16:00:52 -0700
|
||||
Subject: [PATCH 2/2] mingw-w64: __udivdi3 mangle hack
|
||||
Subject: [PATCH 1/2] mingw-w64: __udivdi3 mangle hack
|
||||
|
||||
---
|
||||
lib/builtins/udivdi3.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/builtins/udivdi3.c b/lib/builtins/udivdi3.c
|
||||
index dc68e15..4c616fd 100644
|
||||
index dc68e154b..4c616fde2 100644
|
||||
--- a/lib/builtins/udivdi3.c
|
||||
+++ b/lib/builtins/udivdi3.c
|
||||
@@ -17,7 +17,12 @@
|
||||
@@ -23,5 +26,5 @@ index dc68e15..4c616fd 100644
|
||||
return __udivmoddi4(a, b, 0);
|
||||
}
|
||||
--
|
||||
2.8.3
|
||||
2.14.1.windows.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From b65c6b61099d87369d756a4137ea731a3a45f192 Mon Sep 17 00:00:00 2001
|
||||
From 056e6d2e8010dbf7777fa6d5d88496c1f9a49100 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Wed, 15 Feb 2017 19:21:48 +0100
|
||||
Subject: [PATCH] compiler-rt: fix mingw build
|
||||
Subject: [PATCH 2/2] compiler-rt: fix mingw build
|
||||
|
||||
---
|
||||
lib/profile/InstrProfilingPort.h | 2 +-
|
||||
@@ -21,4 +21,5 @@ index 578935195..3bda151ad 100644
|
||||
#endif
|
||||
#endif
|
||||
--
|
||||
2.11.1
|
||||
2.14.1.windows.1
|
||||
|
||||
|
||||
@@ -1,230 +0,0 @@
|
||||
From 5bd9ff32fea92a763d99186619946764793bec87 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Sat, 6 Aug 2016 02:33:13 -0700
|
||||
Subject: [PATCH] COFF: gnu driver support
|
||||
|
||||
Notes:
|
||||
-aligncomm is not needed anymore
|
||||
we should patch mingw-w64 to use _ImageBase
|
||||
A new seperate driver should be made.
|
||||
Now that this works we should be able to revisit
|
||||
this with Rui
|
||||
|
||||
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp
|
||||
index ffd6936..c927355 100644
|
||||
--- a/COFF/Driver.cpp
|
||||
+++ b/COFF/Driver.cpp
|
||||
@@ -130,6 +130,7 @@ void LinkerDriver::parseDirectives(StringRef S) {
|
||||
case OPT_fastfail:
|
||||
case OPT_guardsym:
|
||||
case OPT_throwingnew:
|
||||
+ case OPT_aligncomm:
|
||||
break;
|
||||
default:
|
||||
fatal(Arg->getSpelling() + " is not allowed in .drectve");
|
||||
@@ -158,6 +159,31 @@ StringRef LinkerDriver::doFindFile(StringRef Filename) {
|
||||
return Filename;
|
||||
}
|
||||
|
||||
+// Searches a given library from input search paths, which are filled
|
||||
+// from -L command line switches. Returns a path to an existent library file.
|
||||
+StringRef LinkerDriver::searchLibrary(StringRef Filename) {
|
||||
+
|
||||
+ std::vector<std::string> Names;
|
||||
+ if (Filename[0] == ':') {
|
||||
+ Names.push_back(Filename.drop_front());
|
||||
+ } else {
|
||||
+ //TODO: Link with static only
|
||||
+ //if (!Config->Static)
|
||||
+ Names.push_back(("lib" + Filename + ".dll.a").str());
|
||||
+ Names.push_back(("lib" + Filename + ".a").str());
|
||||
+ }
|
||||
+
|
||||
+ for (const std::string &Name : Names) {
|
||||
+ for (StringRef Dir : SearchPaths) {
|
||||
+ SmallString<128> Path = Dir;
|
||||
+ llvm::sys::path::append(Path, Name.c_str());
|
||||
+ if (llvm::sys::fs::exists(Path.str()))
|
||||
+ return Alloc.save(Path.str());
|
||||
+ }
|
||||
+ }
|
||||
+ fatal("Unable to find library -l" + Filename);
|
||||
+}
|
||||
+
|
||||
// Resolves a file path. This never returns the same path
|
||||
// (in that case, it returns None).
|
||||
Optional<StringRef> LinkerDriver::findFile(StringRef Filename) {
|
||||
@@ -526,6 +552,9 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
||||
// for /defaultlib option.
|
||||
std::vector<StringRef> Paths;
|
||||
std::vector<MemoryBufferRef> MBs;
|
||||
+ for (auto *Arg : Args.filtered(OPT_l))
|
||||
+ if (Optional<StringRef> Path = searchLibrary(Arg->getValue()))
|
||||
+ Paths.push_back(*Path);
|
||||
for (auto *Arg : Args.filtered(OPT_INPUT))
|
||||
if (Optional<StringRef> Path = findFile(Arg->getValue()))
|
||||
Paths.push_back(*Path);
|
||||
@@ -655,6 +684,8 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
||||
Config->ImageBase = getDefaultImageBase();
|
||||
|
||||
Symtab.addRelative(mangle("__ImageBase"), 0);
|
||||
+ // no mangle because mingw has defines to stop it for i686
|
||||
+ Symtab.addRelative("__image_base__", 0);
|
||||
if (Config->Machine == I386) {
|
||||
Config->SEHTable = Symtab.addRelative("___safe_se_handler_table", 0);
|
||||
Config->SEHCount = Symtab.addAbsolute("___safe_se_handler_count", 0);
|
||||
diff --git a/COFF/Driver.h b/COFF/Driver.h
|
||||
index 0afde18..530baff 100644
|
||||
--- a/COFF/Driver.h
|
||||
+++ b/COFF/Driver.h
|
||||
@@ -87,6 +87,9 @@ private:
|
||||
StringRef doFindFile(StringRef Filename);
|
||||
StringRef doFindLib(StringRef Filename);
|
||||
|
||||
+ // Searches for a gnu library
|
||||
+ StringRef searchLibrary(StringRef Path);
|
||||
+
|
||||
// Parses LIB environment which contains a list of search paths.
|
||||
void addLibSearchPaths();
|
||||
|
||||
diff --git a/COFF/DriverUtils.cpp b/COFF/DriverUtils.cpp
|
||||
index 5d7dc2b..571761c 100644
|
||||
--- a/COFF/DriverUtils.cpp
|
||||
+++ b/COFF/DriverUtils.cpp
|
||||
@@ -86,6 +86,19 @@ MachineTypes getMachineType(StringRef S) {
|
||||
fatal("unknown /machine argument: " + S);
|
||||
}
|
||||
|
||||
+StringRef GNUMachineToStr(MachineTypes MT) {
|
||||
+ switch (MT) {
|
||||
+ case ARMNT:
|
||||
+ return "arm";
|
||||
+ case AMD64:
|
||||
+ return "x86_64";
|
||||
+ case I386:
|
||||
+ return "x86";
|
||||
+ default:
|
||||
+ llvm_unreachable("unknown machine type");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
StringRef machineToStr(MachineTypes MT) {
|
||||
switch (MT) {
|
||||
case ARMNT:
|
||||
@@ -591,7 +604,7 @@ static const llvm::opt::OptTable::Info infoTable[] = {
|
||||
|
||||
class COFFOptTable : public llvm::opt::OptTable {
|
||||
public:
|
||||
- COFFOptTable() : OptTable(infoTable, true) {}
|
||||
+ COFFOptTable() : OptTable(infoTable) {}
|
||||
};
|
||||
|
||||
// Parses a given list of options.
|
||||
diff --git a/COFF/Options.td b/COFF/Options.td
|
||||
index 3866993..a097325 100644
|
||||
--- a/COFF/Options.td
|
||||
+++ b/COFF/Options.td
|
||||
@@ -94,7 +94,41 @@ def help_q : Flag<["/?", "-?"], "">, Alias<help>;
|
||||
def nosymtab : F<"nosymtab">;
|
||||
|
||||
// Flags for debugging
|
||||
-def lldmap : Joined<["/", "-"], "lldmap:">;
|
||||
+def lldmap : Joined<["/", "-"], "debugmap:">;
|
||||
+
|
||||
+def output : Separate<["-"], "o">, Alias<out>;
|
||||
+def L : Joined<["-"], "L">, Alias<libpath>;
|
||||
+def e : Separate<["-"], "e">, Alias<entry>;
|
||||
+def subs : Separate<["--"], "subsystem">, Alias<subsystem>;
|
||||
+
|
||||
+def outlib : Separate<["--"], "out-implib">, Alias<implib>;
|
||||
+
|
||||
+def l : JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">;
|
||||
+
|
||||
+def enable_auto_image_base: Flag<["--"], "enable-auto-image-base">;
|
||||
+
|
||||
+def unexported_symbols_list : Separate<["-"], "unexported_symbols_list">;
|
||||
+def reexported_symbols_list : Separate<["-"], "reexported_symbols_list">;
|
||||
+def force_symbols_not_weak_list : Separate<["-"], "force_symbols_not_weak_list">;
|
||||
+def force_symbols_weak_list : Separate<["-"], "force_symbols_weak_list">;
|
||||
+
|
||||
+def major_image_version : Separate<["--"], "major-image-version">;
|
||||
+def minor_image_version : Separate<["--"], "minor-image-version">;
|
||||
+
|
||||
+
|
||||
+def shared: Flag<["--"], "shared">, Alias<dll>;
|
||||
+
|
||||
+// Used to silence some gnu warnings
|
||||
+def aligncomm : P<"aligncomm", "Comm Alignment">;
|
||||
+def Bdynamic: Flag<["-"], "Bdynamic">;
|
||||
+
|
||||
+// Used to override gnu pe targets
|
||||
+def m : Separate<["-"], "m">, MetaVarName<"<emulation>">,
|
||||
+ HelpText<"Select target emulation">;
|
||||
+
|
||||
+// Select an optional flavor
|
||||
+def flavor: Separate<["-"], "flavor">,
|
||||
+ HelpText<"Flavor for linking, options are gnu/darwin/link">;
|
||||
|
||||
//==============================================================================
|
||||
// The flags below do nothing. They are defined only for link.exe compatibility.
|
||||
diff --git a/COFF/SymbolTable.cpp b/COFF/SymbolTable.cpp
|
||||
index df9da4c..1f5552d 100644
|
||||
--- a/COFF/SymbolTable.cpp
|
||||
+++ b/COFF/SymbolTable.cpp
|
||||
@@ -210,9 +210,10 @@ void SymbolTable::addSymbol(SymbolBody *New) {
|
||||
// compare() returns -1, 0, or 1 if the lhs symbol is less preferable,
|
||||
// equivalent (conflicting), or more preferable, respectively.
|
||||
int Comp = Existing->compare(New);
|
||||
- if (Comp == 0)
|
||||
- fatal("duplicate symbol: " + Existing->getDebugName() + " and " +
|
||||
- New->getDebugName());
|
||||
+ // disable for now because of _free_locale in libc++ with mingw
|
||||
+ //if (Comp == 0)
|
||||
+ // fatal("duplicate symbol: " + Existing->getDebugName() + " and " +
|
||||
+ // New->getDebugName());
|
||||
if (Comp < 0)
|
||||
Sym->Body = New;
|
||||
}
|
||||
diff --git a/tools/lld/lld.cpp b/tools/lld/lld.cpp
|
||||
index 8805e02..d6baefd 100644
|
||||
--- a/tools/lld/lld.cpp
|
||||
+++ b/tools/lld/lld.cpp
|
||||
@@ -51,6 +51,24 @@ static Flavor getFlavor(StringRef S) {
|
||||
.Default(Invalid);
|
||||
}
|
||||
|
||||
+static bool isPETarget(const std::vector<const char *> &V) {
|
||||
+ for (auto It = V.begin(); It != V.end(); It++) {
|
||||
+ if (*It == StringRef("-m")) {
|
||||
+ It++;
|
||||
+ if (It == V.end())
|
||||
+ return false;
|
||||
+ if (*It == StringRef("i386pe"))
|
||||
+ return true;
|
||||
+ if (*It == StringRef("i386pep"))
|
||||
+ return true;
|
||||
+ if (*It == StringRef("thumb2pe"))
|
||||
+ return true;
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static Flavor parseProgname(StringRef Progname) {
|
||||
#if __APPLE__
|
||||
// Use Darwin driver for "ld" on Darwin.
|
||||
@@ -101,6 +119,10 @@ int main(int Argc, const char **Argv) {
|
||||
llvm_shutdown_obj Shutdown;
|
||||
|
||||
std::vector<const char *> Args(Argv, Argv + Argc);
|
||||
+
|
||||
+ if (isPETarget(Args))
|
||||
+ return !coff::link(Args);
|
||||
+
|
||||
switch (parseFlavor(Args)) {
|
||||
case Gnu:
|
||||
return !elf::link(Args);
|
||||
--
|
||||
2.8.3
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
From 1abddce89f69fee1d7352d8019638ca954fcd3a9 Mon Sep 17 00:00:00 2001
|
||||
From: Petr Hosek <phosek@chromium.org>
|
||||
Date: Fri, 23 Dec 2016 00:22:47 +0000
|
||||
Subject: [PATCH] [CMake] Add install target for the lld tool
|
||||
|
||||
This is necessary for the distribution targets which assume that
|
||||
each component has an install target. This also moves the CMake
|
||||
macros into a separate file akin to other LLVM projects.
|
||||
|
||||
Differential Revision: https://reviews.llvm.org/D27876
|
||||
|
||||
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@290391 91177308-0d34-0410-b5e6-96231b3b80d8
|
||||
---
|
||||
CMakeLists.txt | 10 ++++------
|
||||
cmake/modules/AddLLD.cmake | 45 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
tools/lld/CMakeLists.txt | 7 ++-----
|
||||
3 files changed, 51 insertions(+), 11 deletions(-)
|
||||
create mode 100644 cmake/modules/AddLLD.cmake
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 58101e1..23cef2e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -106,6 +106,8 @@ endif()
|
||||
|
||||
list (APPEND CMAKE_MODULE_PATH "${LLD_SOURCE_DIR}/cmake/modules")
|
||||
|
||||
+include(AddLLD)
|
||||
+
|
||||
option(LLD_USE_VTUNE
|
||||
"Enable VTune user task tracking."
|
||||
OFF)
|
||||
@@ -118,6 +120,8 @@ if (LLD_USE_VTUNE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+option(LLD_BUILD_TOOLS
|
||||
+ "Build the lld tools. If OFF, just generate build targets." ON)
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-wd4530) # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
|
||||
@@ -138,12 +142,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
endif()
|
||||
|
||||
-macro(add_lld_library name)
|
||||
- add_llvm_library(${name} ${ARGN})
|
||||
- set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
|
||||
-endmacro(add_lld_library)
|
||||
-
|
||||
-
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(tools/lld)
|
||||
|
||||
diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
|
||||
new file mode 100644
|
||||
index 0000000..752ca7f
|
||||
--- /dev/null
|
||||
+++ b/cmake/modules/AddLLD.cmake
|
||||
@@ -0,0 +1,45 @@
|
||||
+macro(add_lld_library name)
|
||||
+ add_llvm_library(${name} ${ARGN})
|
||||
+ set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
|
||||
+endmacro(add_lld_library)
|
||||
+
|
||||
+macro(add_lld_executable name)
|
||||
+ add_llvm_executable(${name} ${ARGN})
|
||||
+ set_target_properties(${name} PROPERTIES FOLDER "lld executables")
|
||||
+endmacro(add_lld_executable)
|
||||
+
|
||||
+macro(add_lld_tool name)
|
||||
+ if (NOT LLD_BUILD_TOOLS)
|
||||
+ set(EXCLUDE_FROM_ALL ON)
|
||||
+ endif()
|
||||
+
|
||||
+ add_lld_executable(${name} ${ARGN})
|
||||
+
|
||||
+ if (LLD_BUILD_TOOLS)
|
||||
+ if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
|
||||
+ NOT LLVM_DISTRIBUTION_COMPONENTS)
|
||||
+ set(export_to_lldtargets EXPORT lldTargets)
|
||||
+ set_property(GLOBAL PROPERTY LLD_HAS_EXPORTS True)
|
||||
+ endif()
|
||||
+
|
||||
+ install(TARGETS ${name}
|
||||
+ ${export_to_lldtargets}
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ COMPONENT ${name})
|
||||
+
|
||||
+ if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
+ add_custom_target(install-${name}
|
||||
+ DEPENDS ${name}
|
||||
+ COMMAND "${CMAKE_COMMAND}"
|
||||
+ -DCMAKE_INSTALL_COMPONENT=${name}
|
||||
+ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
+ endif()
|
||||
+ set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
|
||||
+ endif()
|
||||
+endmacro()
|
||||
+
|
||||
+macro(add_lld_symlink name dest)
|
||||
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
|
||||
+ # Always generate install targets
|
||||
+ llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
|
||||
+endmacro()
|
||||
diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
|
||||
index 5951da6..0c946a3 100644
|
||||
--- a/tools/lld/CMakeLists.txt
|
||||
+++ b/tools/lld/CMakeLists.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
-add_llvm_executable(lld
|
||||
+add_lld_tool(lld
|
||||
lld.cpp
|
||||
)
|
||||
|
||||
@@ -17,8 +17,5 @@ if(NOT LLD_SYMLINKS_TO_CREATE)
|
||||
endif()
|
||||
|
||||
foreach(link ${LLD_SYMLINKS_TO_CREATE})
|
||||
- add_llvm_tool_symlink(${link} lld ALWAYS_GENERATE)
|
||||
- # Always generate install targets
|
||||
- llvm_install_symlink(${link} lld ALWAYS_GENERATE)
|
||||
+ add_lld_symlink(${link} lld)
|
||||
endforeach()
|
||||
-
|
||||
@@ -1,243 +1,27 @@
|
||||
From b45cafc920b84ea40f9760266473c0da2260c58e Mon Sep 17 00:00:00 2001
|
||||
From 5ad3d8c960e46a85e6fa3ec457dafdd53394ef77 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Mon, 20 Mar 2017 18:33:53 +0100
|
||||
Subject: [PATCH] workarounds to build libc++ with MinGW
|
||||
|
||||
Based on Martell's patches
|
||||
---
|
||||
cmake/Modules/CheckLibcxxAtomic.cmake | 2 +-
|
||||
cmake/config-ix.cmake | 6 +++++-
|
||||
include/__config | 5 +++--
|
||||
include/locale | 8 ++++++++
|
||||
include/support/win32/locale_win32.h | 26 ++++++++++++++++++++------
|
||||
include/support/win32/support.h | 5 +++--
|
||||
lib/CMakeLists.txt | 2 +-
|
||||
src/locale.cpp | 2 +-
|
||||
src/new.cpp | 2 +-
|
||||
src/support/win32/locale_win32.cpp | 4 ++++
|
||||
src/support/win32/support.cpp | 2 ++
|
||||
src/system_error.cpp | 2 +-
|
||||
12 files changed, 56 insertions(+), 17 deletions(-)
|
||||
src/support/win32/support.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/Modules/CheckLibcxxAtomic.cmake b/cmake/Modules/CheckLibcxxAtomic.cmake
|
||||
index a7ae667..4f9de3e 100644
|
||||
--- a/cmake/Modules/CheckLibcxxAtomic.cmake
|
||||
+++ b/cmake/Modules/CheckLibcxxAtomic.cmake
|
||||
@@ -9,7 +9,7 @@ INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
function(check_cxx_atomics varname)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
- set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
|
||||
+ set(CMAKE_REQUIRED_FLAGS "-std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
|
||||
if (${LIBCXX_GCC_TOOLCHAIN})
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
|
||||
endif()
|
||||
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
|
||||
index 4f13b78..1590399 100644
|
||||
--- a/cmake/config-ix.cmake
|
||||
+++ b/cmake/config-ix.cmake
|
||||
@@ -24,7 +24,11 @@ endif()
|
||||
# required during compilation (which has the -nodefaultlibs). libc is
|
||||
# required for the link to go through. We remove sanitizers from the
|
||||
# configuration checks to avoid spurious link errors.
|
||||
-check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
+if (MINGW)
|
||||
+ SET(LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG NO)
|
||||
+else()
|
||||
+ check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
+endif()
|
||||
if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
|
||||
if (LIBCXX_HAS_C_LIB)
|
||||
diff --git a/include/__config b/include/__config
|
||||
index 340c573..db9b74a 100644
|
||||
--- a/include/__config
|
||||
+++ b/include/__config
|
||||
@@ -222,7 +222,7 @@
|
||||
// including accesses to the special files under /dev. C++11's
|
||||
// std::random_device is instead exposed through a NaCl syscall.
|
||||
# define _LIBCPP_USING_NACL_RANDOM
|
||||
-#elif defined(_LIBCPP_WIN32API)
|
||||
+#elif defined(_MSC_VER)
|
||||
# define _LIBCPP_USING_WIN32_RANDOM
|
||||
#else
|
||||
# define _LIBCPP_USING_DEV_RANDOM
|
||||
@@ -930,7 +935,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
defined(__linux__) || \
|
||||
defined(__APPLE__) || \
|
||||
defined(__CloudABI__) || \
|
||||
- defined(__sun__)
|
||||
+ defined(__sun__) || \
|
||||
+ defined(__MINGW32__)
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# elif defined(_LIBCPP_WIN32API)
|
||||
# define _LIBCPP_HAS_THREAD_API_WIN32
|
||||
diff --git a/include/locale b/include/locale
|
||||
index 9cef429..ad3586a 100644
|
||||
--- a/include/locale
|
||||
+++ b/include/locale
|
||||
@@ -695,7 +695,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
||||
typename remove_reference<decltype(errno)>::type __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
+#ifdef __MINGW32__
|
||||
+ long long __ll = strtoll(__a, &__p2, __base);
|
||||
+#else
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
||||
+#endif
|
||||
typename remove_reference<decltype(errno)>::type __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
@@ -735,7 +739,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
||||
typename remove_reference<decltype(errno)>::type __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
+#ifdef __MINGW32__
|
||||
+ unsigned long long __ll = strtoull(__a, &__p2, __base);
|
||||
+#else
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
||||
+#endif
|
||||
typename remove_reference<decltype(errno)>::type __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h
|
||||
index ebf5bda..525cfc7 100644
|
||||
--- a/include/support/win32/locale_win32.h
|
||||
+++ b/include/support/win32/locale_win32.h
|
||||
@@ -11,7 +11,11 @@
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
||||
|
||||
+#ifdef __MINGW32__
|
||||
+#define _VC_CRT_MAJOR_VERSION 6
|
||||
+#else
|
||||
#include <crtversion.h>
|
||||
+#endif
|
||||
|
||||
#if _VC_CRT_MAJOR_VERSION < 14
|
||||
// ctype mask table defined in msvcrt.dll
|
||||
@@ -40,16 +44,26 @@ int wctob_l( wint_t c, locale_t loc );
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
|
||||
{
|
||||
+#ifdef __MINGW32__
|
||||
+ return MB_CUR_MAX;
|
||||
+#else
|
||||
return ___mb_cur_max_l_func(__l);
|
||||
+#endif
|
||||
}
|
||||
|
||||
+#ifdef __MINGW32__
|
||||
+# define strtod_l _strtod_l
|
||||
+# define strtof_l _strtod_l
|
||||
+# define strtold_l _strtod_l
|
||||
+#else
|
||||
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
|
||||
-#define mbtowc_l _mbtowc_l
|
||||
-#define strtoll_l _strtoi64_l
|
||||
-#define strtoull_l _strtoui64_l
|
||||
-#define strtof_l _strtof_l
|
||||
-#define strtod_l _strtod_l
|
||||
-#define strtold_l _strtold_l
|
||||
+# define mbtowc_l _mbtowc_l
|
||||
+# define strtoll_l _strtoi64_l
|
||||
+# define strtoull_l _strtoui64_l
|
||||
+# define strtof_l _strtof_l
|
||||
+# define strtod_l _strtod_l
|
||||
+# define strtold_l _strtold_l
|
||||
+#endif
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
diff --git a/include/support/win32/support.h b/include/support/win32/support.h
|
||||
index f961344..501cd06 100644
|
||||
--- a/include/support/win32/support.h
|
||||
+++ b/include/support/win32/support.h
|
||||
@@ -37,12 +37,13 @@ extern "C" {
|
||||
|
||||
int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
|
||||
int asprintf(char **sptr, const char *__restrict fmt, ...);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
|
||||
size_t nmc, size_t len, mbstate_t *__restrict ps);
|
||||
size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
|
||||
size_t nwc, size_t len, mbstate_t *__restrict ps);
|
||||
-}
|
||||
-#endif // __MINGW32__
|
||||
|
||||
#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14
|
||||
#define snprintf _snprintf
|
||||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||||
index cc3ed16..3c2716f 100644
|
||||
--- a/lib/CMakeLists.txt
|
||||
+++ b/lib/CMakeLists.txt
|
||||
@@ -101,8 +101,8 @@ endif()
|
||||
# Setup flags.
|
||||
if (NOT WIN32)
|
||||
add_flags_if_supported(-fPIC)
|
||||
+ add_link_flags_if_supported(-nodefaultlibs)
|
||||
endif()
|
||||
-add_link_flags_if_supported(-nodefaultlibs)
|
||||
|
||||
if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY)
|
||||
if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION)
|
||||
diff --git a/src/locale.cpp b/src/locale.cpp
|
||||
index 338ffde..5c44346 100644
|
||||
--- a/src/locale.cpp
|
||||
+++ b/src/locale.cpp
|
||||
@@ -1114,7 +1114,7 @@ ctype<char>::classic_table() _NOEXCEPT
|
||||
#if _VC_CRT_MAJOR_VERSION < 14
|
||||
// This is assumed to be safe, which is a nonsense assumption because we're
|
||||
// going to end up dereferencing it later...
|
||||
- return _ctype+1; // internal ctype mask table defined in msvcrt.dll
|
||||
+ return (const long unsigned int*)(_ctype + 1); // internal ctype mask table defined in msvcrt.dll
|
||||
#else
|
||||
return __pctype_func();
|
||||
#endif
|
||||
diff --git a/src/new.cpp b/src/new.cpp
|
||||
index b1e8ee3..e57b773 100644
|
||||
--- a/src/new.cpp
|
||||
+++ b/src/new.cpp
|
||||
@@ -162,7 +162,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
|
||||
if (static_cast<size_t>(alignment) < sizeof(void*))
|
||||
alignment = std::align_val_t(sizeof(void*));
|
||||
void* p;
|
||||
-#if defined(_LIBCPP_MSVCRT)
|
||||
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr)
|
||||
#else
|
||||
while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0)
|
||||
diff --git a/src/support/win32/locale_win32.cpp b/src/support/win32/locale_win32.cpp
|
||||
index ee13811..f6ac5ed 100644
|
||||
--- a/src/support/win32/locale_win32.cpp
|
||||
+++ b/src/support/win32/locale_win32.cpp
|
||||
@@ -13,7 +13,11 @@
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
+#ifdef __MINGW32__
|
||||
+#define _VC_CRT_MAJOR_VERSION 6
|
||||
+#else
|
||||
#include <crtversion.h>
|
||||
+#endif
|
||||
|
||||
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
|
||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp
|
||||
index e989681..0628767 100644
|
||||
index dbd1c4c41..fa8cabd65 100644
|
||||
--- a/src/support/win32/support.cpp
|
||||
+++ b/src/support/win32/support.cpp
|
||||
@@ -17,6 +17,7 @@
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <cstring> // strcpy, wcsncpy
|
||||
#include <cwchar> // mbstate_t
|
||||
|
||||
// Some of these functions aren't standard or if they conform, the name does not.
|
||||
|
||||
+#ifndef __MINGW32__
|
||||
int asprintf(char **sptr, const char *__restrict format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -51,6 +52,7 @@ int vasprintf( char **sptr, const char *__restrict format, va_list ap )
|
||||
-
|
||||
+#ifndef __MINGW64_VERSION_MAJOR
|
||||
// Like sprintf, but when return value >= 0 it returns
|
||||
// a pointer to a malloc'd string in *sptr.
|
||||
// If return >= 0, use free to delete *sptr.
|
||||
@@ -40,6 +40,7 @@ int vasprintf( char **sptr, const char *__restrict format, va_list ap )
|
||||
*sptr = p;
|
||||
return count;
|
||||
}
|
||||
@@ -245,18 +29,6 @@ index e989681..0628767 100644
|
||||
|
||||
// Returns >= 0: the number of wide characters found in the
|
||||
// multi byte sequence src (of src_size_bytes), that fit in the buffer dst
|
||||
diff --git a/src/system_error.cpp b/src/system_error.cpp
|
||||
index c547124..42171ef 100644
|
||||
--- a/src/system_error.cpp
|
||||
+++ b/src/system_error.cpp
|
||||
@@ -65,7 +65,7 @@ constexpr size_t strerror_buff_size = 1024;
|
||||
|
||||
string do_strerror_r(int ev);
|
||||
|
||||
-#if defined(_LIBCPP_MSVCRT)
|
||||
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
string do_strerror_r(int ev) {
|
||||
char buffer[strerror_buff_size];
|
||||
if (::strerror_s(buffer, strerror_buff_size, ev) == 0)
|
||||
--
|
||||
2.12.0
|
||||
2.14.1.windows.1
|
||||
|
||||
|
||||
172
mingw-w64-clang/0501-fixes-to-get-lldb-building.patch
Normal file
172
mingw-w64-clang/0501-fixes-to-get-lldb-building.patch
Normal file
@@ -0,0 +1,172 @@
|
||||
From b8a3387eee86d609b18ac880e7897252de62a0c5 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Fri, 15 Sep 2017 15:03:12 +0200
|
||||
Subject: [PATCH] fixes to get lldb building
|
||||
|
||||
---
|
||||
cmake/LLDBDependencies.cmake | 6 ++++++
|
||||
include/lldb/Host/windows/PosixApi.h | 14 ++++++++++----
|
||||
include/lldb/Host/windows/windows.h | 4 ++++
|
||||
source/Host/common/MainLoop.cpp | 1 +
|
||||
source/Host/windows/Windows.cpp | 3 +++
|
||||
.../gdb-remote/GDBRemoteCommunicationServerPlatform.cpp | 1 +
|
||||
source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | 1 +
|
||||
tools/lldb-mi/MIDataTypes.h | 2 ++
|
||||
tools/lldb-mi/Platform.h | 4 ++++
|
||||
9 files changed, 32 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/cmake/LLDBDependencies.cmake b/cmake/LLDBDependencies.cmake
|
||||
index 55ce379..ae65ebe 100644
|
||||
--- a/cmake/LLDBDependencies.cmake
|
||||
+++ b/cmake/LLDBDependencies.cmake
|
||||
@@ -6,6 +6,12 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
ws2_32
|
||||
rpcrt4
|
||||
)
|
||||
+ if (MINGW)
|
||||
+ list(APPEND LLDB_SYSTEM_LIBS
|
||||
+ dbghelp
|
||||
+ psapi
|
||||
+ )
|
||||
+ endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT LLDB_DISABLE_LIBEDIT)
|
||||
diff --git a/include/lldb/Host/windows/PosixApi.h b/include/lldb/Host/windows/PosixApi.h
|
||||
index de70266..51fba95 100644
|
||||
--- a/include/lldb/Host/windows/PosixApi.h
|
||||
+++ b/include/lldb/Host/windows/PosixApi.h
|
||||
@@ -73,13 +73,9 @@ typedef uint32_t pid_t;
|
||||
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
-#endif // _MSC_VER
|
||||
-
|
||||
// Various useful posix functions that are not present in Windows. We provide
|
||||
// custom implementations.
|
||||
int vasprintf(char **ret, const char *fmt, va_list ap);
|
||||
-char *strcasestr(const char *s, const char *find);
|
||||
-char *realpath(const char *name, char *resolved);
|
||||
|
||||
int usleep(uint32_t useconds);
|
||||
char *basename(char *path);
|
||||
@@ -88,6 +84,16 @@ char *dirname(char *path);
|
||||
int strcasecmp(const char *s1, const char *s2);
|
||||
int strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
|
||||
+#elif __MINGW64_VERSION_MAJOR
|
||||
+
|
||||
+// pid_t definition
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+char *strcasestr(const char *s, const char *find);
|
||||
+char *realpath(const char *name, char *resolved);
|
||||
+
|
||||
// empty functions
|
||||
inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; }
|
||||
|
||||
diff --git a/include/lldb/Host/windows/windows.h b/include/lldb/Host/windows/windows.h
|
||||
index 3dc9f77..ca138c1 100644
|
||||
--- a/include/lldb/Host/windows/windows.h
|
||||
+++ b/include/lldb/Host/windows/windows.h
|
||||
@@ -28,4 +28,8 @@
|
||||
#define FAR
|
||||
#define NEAR
|
||||
|
||||
+#ifndef _MSC_VER
|
||||
+#include <sys/stat.h>
|
||||
+#endif
|
||||
+
|
||||
#endif // LLDB_lldb_windows_h_
|
||||
diff --git a/source/Host/common/MainLoop.cpp b/source/Host/common/MainLoop.cpp
|
||||
index d0e0d00..cd1d4a8 100644
|
||||
--- a/source/Host/common/MainLoop.cpp
|
||||
+++ b/source/Host/common/MainLoop.cpp
|
||||
@@ -27,6 +27,7 @@
|
||||
#if HAVE_SYS_EVENT_H
|
||||
#include <sys/event.h>
|
||||
#elif defined(LLVM_ON_WIN32)
|
||||
+#include "lldb/Host/windows/windows.h"
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <poll.h>
|
||||
diff --git a/source/Host/windows/Windows.cpp b/source/Host/windows/Windows.cpp
|
||||
index 9d0e70e..aaf06b0 100644
|
||||
--- a/source/Host/windows/Windows.cpp
|
||||
+++ b/source/Host/windows/Windows.cpp
|
||||
@@ -43,6 +43,8 @@ bool wideToUtf8(const wchar_t *wide, char *buf, size_t bufSize) {
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
+
|
||||
int vasprintf(char **ret, const char *fmt, va_list ap) {
|
||||
char *buf;
|
||||
int len;
|
||||
@@ -69,6 +71,7 @@ int vasprintf(char **ret, const char *fmt, va_list ap) {
|
||||
va_end(ap2);
|
||||
return len;
|
||||
}
|
||||
+#endif
|
||||
|
||||
char *strcasestr(const char *s, const char *find) {
|
||||
char c, sc;
|
||||
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
|
||||
index 977c34c..9bec1d8 100644
|
||||
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
|
||||
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
// C Includes
|
||||
+#include <unistd.h>
|
||||
// C++ Includes
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
|
||||
index 54a472d..196e012 100644
|
||||
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
|
||||
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
|
||||
@@ -11,6 +11,7 @@
|
||||
#define liblldb_ProcessGDBRemote_h_
|
||||
|
||||
// C Includes
|
||||
+#include <unistd.h>
|
||||
// C++ Includes
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
diff --git a/tools/lldb-mi/MIDataTypes.h b/tools/lldb-mi/MIDataTypes.h
|
||||
index 34fe457..8372e8c 100644
|
||||
--- a/tools/lldb-mi/MIDataTypes.h
|
||||
+++ b/tools/lldb-mi/MIDataTypes.h
|
||||
@@ -19,6 +19,8 @@
|
||||
// Windows headers:
|
||||
#ifdef _WIN32
|
||||
|
||||
+#include <windows.h>
|
||||
+
|
||||
// Debugging:
|
||||
#ifdef _DEBUG
|
||||
#include <crtdbg.h> // C-runtime debugging library (defines _ASSERT).
|
||||
diff --git a/tools/lldb-mi/Platform.h b/tools/lldb-mi/Platform.h
|
||||
index ce2de1b..d334d75 100644
|
||||
--- a/tools/lldb-mi/Platform.h
|
||||
+++ b/tools/lldb-mi/Platform.h
|
||||
@@ -78,8 +78,12 @@ typedef void (*sighandler_t)(int);
|
||||
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
+
|
||||
+#ifndef __MINGW64_VERSION_MAJOR
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
+#endif
|
||||
+
|
||||
#include <unistd.h>
|
||||
|
||||
#include <pthread.h>
|
||||
--
|
||||
2.14.1.windows.1
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
From 273fab668205311f4850fc025f7735f1019392a1 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Thu, 16 Feb 2017 00:37:27 +0100
|
||||
Subject: [PATCH] hacky changes to get lldb building
|
||||
|
||||
---
|
||||
cmake/LLDBDependencies.cmake | 6 ++++++
|
||||
include/lldb/Host/windows/PosixApi.h | 18 +++++++++++-------
|
||||
source/Host/windows/Windows.cpp | 2 ++
|
||||
tools/lldb-mi/MIDataTypes.h | 7 +++++++
|
||||
tools/lldb-mi/Platform.h | 4 ++++
|
||||
5 files changed, 30 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/cmake/LLDBDependencies.cmake b/cmake/LLDBDependencies.cmake
|
||||
index e12a52268..53b348caa 100644
|
||||
--- a/cmake/LLDBDependencies.cmake
|
||||
+++ b/cmake/LLDBDependencies.cmake
|
||||
@@ -94,6 +94,12 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
ws2_32
|
||||
rpcrt4
|
||||
)
|
||||
+ if (MINGW)
|
||||
+ list(APPEND LLDB_USED_LIBS
|
||||
+ dbghelp
|
||||
+ psapi
|
||||
+ )
|
||||
+ endif ()
|
||||
endif ()
|
||||
|
||||
# Linux-only libraries
|
||||
diff --git a/include/lldb/Host/windows/PosixApi.h b/include/lldb/Host/windows/PosixApi.h
|
||||
index 4f2573781..519038296 100644
|
||||
--- a/include/lldb/Host/windows/PosixApi.h
|
||||
+++ b/include/lldb/Host/windows/PosixApi.h
|
||||
@@ -73,23 +73,27 @@ typedef uint32_t pid_t;
|
||||
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
-#endif // _MSC_VER
|
||||
+#elif __MINGW64_VERSION_MAJOR
|
||||
+#include <sys/types.h>
|
||||
+#endif
|
||||
|
||||
// Various useful posix functions that are not present in Windows. We provide
|
||||
// custom implementations.
|
||||
+#ifndef __MINGW64_VERSION_MAJOR
|
||||
+int chdir(const char *path);
|
||||
+char *getcwd(char *path, int max);
|
||||
int vasprintf(char **ret, const char *fmt, va_list ap);
|
||||
+int usleep(uint32_t useconds);
|
||||
+int strcasecmp(const char *s1, const char *s2);
|
||||
+int strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
+#endif
|
||||
+
|
||||
char *strcasestr(const char *s, const char *find);
|
||||
char *realpath(const char *name, char *resolved);
|
||||
|
||||
-int usleep(uint32_t useconds);
|
||||
-char *getcwd(char *path, int max);
|
||||
-int chdir(const char *path);
|
||||
char *basename(char *path);
|
||||
char *dirname(char *path);
|
||||
|
||||
-int strcasecmp(const char *s1, const char *s2);
|
||||
-int strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
-
|
||||
// empty functions
|
||||
inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; }
|
||||
|
||||
diff --git a/source/Host/windows/Windows.cpp b/source/Host/windows/Windows.cpp
|
||||
index 21afc6d85..4f75442e1 100644
|
||||
--- a/source/Host/windows/Windows.cpp
|
||||
+++ b/source/Host/windows/Windows.cpp
|
||||
@@ -50,6 +50,7 @@ bool wideToUtf8(const wchar_t *wide, char *buf, size_t bufSize) {
|
||||
}
|
||||
}
|
||||
|
||||
+#ifndef __MINGW64_VERSION_MAJOR
|
||||
int vasprintf(char **ret, const char *fmt, va_list ap) {
|
||||
char *buf;
|
||||
int len;
|
||||
@@ -76,6 +77,7 @@ int vasprintf(char **ret, const char *fmt, va_list ap) {
|
||||
va_end(ap2);
|
||||
return len;
|
||||
}
|
||||
+#endif
|
||||
|
||||
char *strcasestr(const char *s, const char *find) {
|
||||
char c, sc;
|
||||
diff --git a/tools/lldb-mi/MIDataTypes.h b/tools/lldb-mi/MIDataTypes.h
|
||||
index 34fe45751..5522201d6 100644
|
||||
--- a/tools/lldb-mi/MIDataTypes.h
|
||||
+++ b/tools/lldb-mi/MIDataTypes.h
|
||||
@@ -40,9 +40,16 @@ const bool failure = false;
|
||||
|
||||
// Portability issues
|
||||
#ifdef _WIN64
|
||||
+# ifdef _MSC_VER
|
||||
typedef unsigned __int64 size_t;
|
||||
typedef __int64 MIint;
|
||||
typedef unsigned __int64 MIuint;
|
||||
+# else
|
||||
+# include <stdint.h>
|
||||
+typedef uint64_t size_t;
|
||||
+typedef int64_t MIint;
|
||||
+typedef uint64_t MIuint;
|
||||
+# endif
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
typedef unsigned int size_t;
|
||||
diff --git a/tools/lldb-mi/Platform.h b/tools/lldb-mi/Platform.h
|
||||
index 1b6ff5549..147bb57a4 100644
|
||||
--- a/tools/lldb-mi/Platform.h
|
||||
+++ b/tools/lldb-mi/Platform.h
|
||||
@@ -79,8 +79,12 @@ typedef void (*sighandler_t)(int);
|
||||
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
+
|
||||
+#ifndef __MINGW64_VERSION_MAJOR
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
+#endif
|
||||
+
|
||||
#include <unistd.h>
|
||||
|
||||
#include <pthread.h>
|
||||
--
|
||||
2.12.0
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
diff -urN lldb-3.9.0.src.orig/source/Host/windows/FileSystem.cpp lldb-3.9.0.src/source/Host/windows/FileSystem.cpp
|
||||
--- lldb-3.9.0.src.orig/source/Host/windows/FileSystem.cpp 2016-03-22 18:58:09.000000000 +0100
|
||||
+++ lldb-3.9.0.src/source/Host/windows/FileSystem.cpp 2016-11-10 01:55:34.663530600 +0100
|
||||
@@ -276,7 +276,7 @@
|
||||
return -EINVAL;
|
||||
}
|
||||
int stat_result;
|
||||
-#ifdef _USE_32BIT_TIME_T
|
||||
+#if defined(_USE_32BIT_TIME_T) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
struct _stat32 file_stats;
|
||||
stat_result = ::_wstat32(wpath.c_str(), &file_stats);
|
||||
#else
|
||||
diff -urN lldb-3.9.0.src.orig/source/Host/windows/FileSystem.cpp lldb-3.9.0.src/source/Host/windows/FileSystem.cpp
|
||||
--- lldb-3.9.0.src.orig/source/Host/windows/FileSystem.cpp 2016-03-22 18:58:09.000000000 +0100
|
||||
+++ lldb-3.9.0.src/source/Host/windows/FileSystem.cpp 2016-11-10 01:55:34.663530600 +0100
|
||||
@@ -276,7 +276,7 @@
|
||||
return -EINVAL;
|
||||
}
|
||||
int stat_result;
|
||||
-#ifdef _USE_32BIT_TIME_T
|
||||
+#if defined(_USE_32BIT_TIME_T) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
struct _stat32 file_stats;
|
||||
stat_result = ::_wstat32(wpath.c_str(), &file_stats);
|
||||
#else
|
||||
@@ -1,17 +1,42 @@
|
||||
From dfe4f4533d720f2e057f35b104b3fd50cf9d0f32 Mon Sep 17 00:00:00 2001
|
||||
From 8d0335a3e369eca60ff53c5a6a0936aafcaaf13b Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Fri, 17 Mar 2017 21:20:49 +0100
|
||||
Subject: [PATCH] libunwind add support for mingw-w64
|
||||
|
||||
---
|
||||
include/unwind.h | 2 +-
|
||||
src/AddressSpace.hpp | 15 ++++++++-------
|
||||
src/assembly.h | 2 ++
|
||||
src/config.h | 16 +++++++++++++++-
|
||||
4 files changed, 26 insertions(+), 9 deletions(-)
|
||||
cmake/config-ix.cmake | 13 +++++++++++++
|
||||
include/unwind.h | 2 +-
|
||||
src/AddressSpace.hpp | 10 ++++++----
|
||||
src/assembly.h | 2 ++
|
||||
src/config.h | 10 ++++++++--
|
||||
5 files changed, 30 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
|
||||
index 40a5dd1..e2041af 100644
|
||||
--- a/cmake/config-ix.cmake
|
||||
+++ b/cmake/config-ix.cmake
|
||||
@@ -29,6 +29,19 @@ if (LIBUNWIND_HAS_NODEFAULTLIBS_FLAG)
|
||||
elseif (LIBUNWIND_HAS_GCC_S_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
|
||||
endif ()
|
||||
+ if (MINGW)
|
||||
+ # Mingw64 requires quite a few "C" runtime libraries in order for basic
|
||||
+ # programs to link successfully with -nodefaultlibs.
|
||||
+ if (LIBUNWIND_USE_COMPILER_RT)
|
||||
+ set(MINGW_RUNTIME ${LIBUNWIND_BUILTINS_LIBRARY})
|
||||
+ else ()
|
||||
+ set(MINGW_RUNTIME gcc_s gcc)
|
||||
+ endif()
|
||||
+ set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32
|
||||
+ shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
|
||||
+ moldname mingwex msvcrt)
|
||||
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
|
||||
+ endif()
|
||||
if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
|
||||
endif ()
|
||||
diff --git a/include/unwind.h b/include/unwind.h
|
||||
index 1d163ca..e54f39d 100644
|
||||
index fc7d122..db10654 100644
|
||||
--- a/include/unwind.h
|
||||
+++ b/include/unwind.h
|
||||
@@ -122,7 +122,7 @@ struct _Unwind_Exception {
|
||||
@@ -24,7 +49,7 @@ index 1d163ca..e54f39d 100644
|
||||
// above fields which has the side effect of causing this whole struct to
|
||||
// round up to 32 bytes in size. To be more explicit, we add pad fields
|
||||
diff --git a/src/AddressSpace.hpp b/src/AddressSpace.hpp
|
||||
index 67aa664..f61e620 100644
|
||||
index 2ed52a5..b18851f 100644
|
||||
--- a/src/AddressSpace.hpp
|
||||
+++ b/src/AddressSpace.hpp
|
||||
@@ -18,7 +18,7 @@
|
||||
@@ -36,7 +61,7 @@ index 67aa664..f61e620 100644
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
@@ -109,7 +109,7 @@ struct UnwindInfoSections {
|
||||
@@ -68,7 +68,7 @@ struct UnwindInfoSections {
|
||||
/// making local unwinds fast.
|
||||
class __attribute__((visibility("hidden"))) LocalAddressSpace {
|
||||
public:
|
||||
@@ -45,32 +70,7 @@ index 67aa664..f61e620 100644
|
||||
typedef uint64_t pint_t;
|
||||
typedef int64_t sint_t;
|
||||
#else
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
};
|
||||
|
||||
inline uintptr_t LocalAddressSpace::getP(pint_t addr) {
|
||||
-#ifdef __LP64__
|
||||
+#if defined(__LP64__) || defined(_WIN64)
|
||||
return get64(addr);
|
||||
#else
|
||||
return get32(addr);
|
||||
@@ -306,7 +306,7 @@ LocalAddressSpace::getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
|
||||
return result;
|
||||
}
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#ifdef __APPLE__
|
||||
struct dyld_unwind_sections
|
||||
{
|
||||
const struct mach_header* mh;
|
||||
@@ -324,13 +324,13 @@ LocalAddressSpace::getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
|
||||
// In 10.6.x and earlier, we need to implement this functionality. Note
|
||||
// that this requires a newer version of libmacho (from cctools) than is
|
||||
// present in libSystem on 10.6.x (for getsectiondata).
|
||||
- static inline bool _dyld_find_unwind_sections(void* addr,
|
||||
+ static inline bool _dyld_find_unwind_sections(void* addr,
|
||||
dyld_unwind_sections* info) {
|
||||
// Find mach-o image containing address.
|
||||
@@ -290,7 +290,7 @@ LocalAddressSpace::getEncodedP(pint_t &addr, pint_t end, uint8_t encoding,
|
||||
Dl_info dlinfo;
|
||||
if (!dladdr(addr, &dlinfo))
|
||||
return false;
|
||||
@@ -79,15 +79,17 @@ index 67aa664..f61e620 100644
|
||||
const struct mach_header_64 *mh = (const struct mach_header_64 *)dlinfo.dli_fbase;
|
||||
#else
|
||||
const struct mach_header *mh = (const struct mach_header *)dlinfo.dli_fbase;
|
||||
@@ -445,6 +445,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
|
||||
},
|
||||
&cb_data);
|
||||
return static_cast<bool>(found);
|
||||
+#elif defined(_WIN32)
|
||||
#else
|
||||
#error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires _LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
|
||||
@@ -327,7 +327,9 @@ extern char __exidx_end;
|
||||
// independent ELF header traversal is not provided by <link.h> on some
|
||||
// systems (e.g., FreeBSD). On these systems the data structures are
|
||||
// just called Elf_XXX. Define ElfW() locally.
|
||||
+#ifndef _WIN32
|
||||
#include <link.h>
|
||||
+#endif
|
||||
#if !defined(ElfW)
|
||||
#define ElfW(type) Elf_##type
|
||||
#endif
|
||||
@@ -468,7 +469,7 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
|
||||
@@ -478,7 +480,7 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
|
||||
inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
|
||||
size_t bufLen,
|
||||
unw_word_t *offset) {
|
||||
@@ -97,7 +99,7 @@ index 67aa664..f61e620 100644
|
||||
if (dladdr((void *)addr, &dyldInfo)) {
|
||||
if (dyldInfo.dli_sname != NULL) {
|
||||
diff --git a/src/assembly.h b/src/assembly.h
|
||||
index 9fb9905..6391f22 100644
|
||||
index d28cbc9..df55679 100644
|
||||
--- a/src/assembly.h
|
||||
+++ b/src/assembly.h
|
||||
@@ -26,6 +26,8 @@
|
||||
@@ -110,41 +112,36 @@ index 9fb9905..6391f22 100644
|
||||
#define HIDDEN_DIRECTIVE .hidden
|
||||
#endif
|
||||
diff --git a/src/config.h b/src/config.h
|
||||
index 4e4dd99..f6002af 100644
|
||||
index ac8d7d9..07e7c1a 100644
|
||||
--- a/src/config.h
|
||||
+++ b/src/config.h
|
||||
@@ -40,6 +40,16 @@
|
||||
@@ -37,6 +37,13 @@
|
||||
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
|
||||
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
|
||||
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
|
||||
#endif
|
||||
+#elif defined(_WIN32)
|
||||
+ // #define _LIBUNWIND_BUILD_SJLJ_APIS
|
||||
+ // #define _LIBUNWIND_SUPPORT_FRAME_APIS
|
||||
+ #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
|
||||
+ #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
|
||||
+ // #define _LIBUNWIND_SUPPORT_DWARF_UNWIND
|
||||
+ // #define _LIBUNWIND_SUPPORT_DWARF_INDEX
|
||||
+ #define bzero(s,n) memset(s,0,n)
|
||||
+ // libcxx may have defined __USE_MINGW_ANSI_STDIO.
|
||||
+ // Here we would like to get the regular versions, not the _mingw ones.
|
||||
+ #undef __USE_MINGW_ANSI_STDIO
|
||||
#else
|
||||
#if defined(__ARM_DWARF_EH__) || !defined(__arm__)
|
||||
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
|
||||
@@ -52,9 +62,13 @@
|
||||
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
|
||||
@@ -44,11 +51,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
-// FIXME: these macros are not correct for COFF targets
|
||||
+#if defined(_WIN32)
|
||||
+#define _LIBUNWIND_EXPORT
|
||||
+#define _LIBUNWIND_HIDDEN
|
||||
+#else
|
||||
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
|
||||
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
|
||||
+#endif
|
||||
|
||||
#if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
|
||||
#define _LIBUNWIND_BUILD_SJLJ_APIS 1
|
||||
-#if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
+#if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS) || defined(_WIN32)
|
||||
#define _LIBUNWIND_EXPORT
|
||||
#define _LIBUNWIND_HIDDEN
|
||||
#else
|
||||
- // FIXME: these macros are not correct for COFF targets
|
||||
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
|
||||
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
--
|
||||
2.12.0
|
||||
2.14.1
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From a5908c964e8d40c084a912ec1ecfd45127c732d0 Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Mon, 20 Mar 2017 18:44:00 +0100
|
||||
Subject: [PATCH] fix visibility for libc++abi on win32
|
||||
|
||||
---
|
||||
src/private_typeinfo.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/private_typeinfo.h b/src/private_typeinfo.h
|
||||
index f3d3e1d..99651a7 100644
|
||||
--- a/src/private_typeinfo.h
|
||||
+++ b/src/private_typeinfo.h
|
||||
@@ -16,7 +16,9 @@
|
||||
#include <cstddef>
|
||||
|
||||
namespace __cxxabiv1 {
|
||||
+#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
+#endif
|
||||
|
||||
class _LIBCXXABI_TYPE_VIS __shim_type_info : public std::type_info {
|
||||
public:
|
||||
@@ -248,7 +250,9 @@ public:
|
||||
_LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const;
|
||||
};
|
||||
|
||||
+#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
+#endif
|
||||
|
||||
} // __cxxabiv1
|
||||
|
||||
--
|
||||
2.12.0
|
||||
|
||||
39
mingw-w64-clang/0801-Don-t-build-LLVMPolly-on-WIN32.patch
Normal file
39
mingw-w64-clang/0801-Don-t-build-LLVMPolly-on-WIN32.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From fbb0c64cb855fbc25c0420aea712ed1390a6ecba Mon Sep 17 00:00:00 2001
|
||||
From: Mateusz Mikula <mati865@gmail.com>
|
||||
Date: Fri, 15 Sep 2017 14:25:27 +0200
|
||||
Subject: [PATCH] Don't build LLVMPolly on WIN32
|
||||
|
||||
---
|
||||
cmake/CMakeLists.txt | 2 +-
|
||||
lib/CMakeLists.txt | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
|
||||
index 969292c..2c7d81a 100644
|
||||
--- a/cmake/CMakeLists.txt
|
||||
+++ b/cmake/CMakeLists.txt
|
||||
@@ -10,7 +10,7 @@ else()
|
||||
endif()
|
||||
|
||||
set(POLLY_CONFIG_EXPORTED_TARGETS Polly ${ISL_TARGET})
|
||||
-if (NOT MSVC)
|
||||
+if (NOT WIN32)
|
||||
# LLVMPolly is a dummy target on Win
|
||||
list(APPEND POLLY_CONFIG_EXPORTED_TARGETS LLVMPolly)
|
||||
endif()
|
||||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||||
index 1141de5..3e0a8bc 100644
|
||||
--- a/lib/CMakeLists.txt
|
||||
+++ b/lib/CMakeLists.txt
|
||||
@@ -119,7 +119,7 @@ endif ()
|
||||
|
||||
# Create a loadable module Polly.so that can be loaded using
|
||||
# LLVM's/clang's "-load" option.
|
||||
-if (MSVC)
|
||||
+if (WIN32)
|
||||
# Add dummy target, because loadable modules are not supported on Windows
|
||||
add_custom_target(LLVMPolly)
|
||||
set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
|
||||
--
|
||||
2.14.1.windows.1
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
# Contributor: Mateusz Mikuła <mati865@gmail.com>
|
||||
# Contributor: wirx6 <wirx654@gmail.com>
|
||||
|
||||
# choose the compiler that will be used to build clang
|
||||
# clang is fine but there are problems with libcxxabi
|
||||
_compiler=gcc # clang, gcc
|
||||
# We can switch to clang when it fully works with mingw-w64
|
||||
#_compiler=clang
|
||||
|
||||
_realname=clang
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
@@ -21,7 +20,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
"${MINGW_PACKAGE_PREFIX}-llvm"
|
||||
"${MINGW_PACKAGE_PREFIX}-lldb"
|
||||
"${MINGW_PACKAGE_PREFIX}-polly")
|
||||
pkgver=4.0.0
|
||||
pkgver=5.0.0
|
||||
pkgrel=1
|
||||
pkgdesc="C language family frontend for LLVM (mingw-w64)"
|
||||
arch=('any')
|
||||
@@ -49,32 +48,24 @@ source=(https://llvm.org/releases/${pkgver}/llvm-${pkgver}.src.tar.xz{,.sig}
|
||||
https://llvm.org/releases/${pkgver}/lldb-${pkgver}.src.tar.xz{,.sig}
|
||||
https://llvm.org/releases/${pkgver}/libunwind-${pkgver}.src.tar.xz{,.sig}
|
||||
https://llvm.org/releases/${pkgver}/polly-${pkgver}.src.tar.xz{,.sig}
|
||||
"0001-genlib-named-as-llvm-dlltool.patch"
|
||||
"0002-mingw-w64-use-MSVC-style-ByteAlignment.patch"
|
||||
"0003-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
|
||||
"0004-Globally-provide-DESTDIR-for-all-platforms.patch"
|
||||
"0005-not-install-msvc-files.patch"
|
||||
"0006-llvm-config-look-for-unversioned-shared-lib-on-win32.patch"
|
||||
"0007-add-pthread-as-system-lib-for-mingw.patch"
|
||||
"0008-fix-bugpoint-multiple-definition.patch"
|
||||
"0101-mingw-w64-enable-support-for-__declspec-selectany.patch"
|
||||
"0102-Allow-build-static-clang-library-for-mingw.patch"
|
||||
"0103-fix-libclang-name-for-mingw.patch"
|
||||
"0104-don-t-use-GCC-headers.patch"
|
||||
"0105-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
"0106-link-pthread-with-mingw.patch"
|
||||
"0107-enable-__float128-for-X86-MinGW.patch"
|
||||
"0108-Don-t-create-cl-executable-for-mingw.patch"
|
||||
"0109-use-emulated-tls-with-mingw.patch"
|
||||
"0001-mingw-w64-use-MSVC-style-ByteAlignment.patch"
|
||||
"0002-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
|
||||
"0003-Globally-provide-DESTDIR-for-all-platforms.patch"
|
||||
"0004-llvm-config-look-for-unversioned-shared-lib-on-win32.patch"
|
||||
"0005-add-pthread-as-system-lib-for-mingw.patch"
|
||||
"0006-fix-bugpoint-multiple-definition.patch"
|
||||
"0101-Allow-build-static-clang-library-for-mingw.patch"
|
||||
"0102-fix-libclang-name-for-mingw.patch"
|
||||
"0103-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
"0104-link-pthread-with-mingw.patch"
|
||||
"0105-use-emulated-tls-with-mingw.patch"
|
||||
"0201-mingw-w64-__udivdi3-mangle-hack.patch"
|
||||
"0202-compiler-rt-fix-mingw-build.patch"
|
||||
"0301-COFF-gnu-driver-support.patch"
|
||||
"0302-add-install-target-for-the-lld-tool.patch"
|
||||
"0401-mingw-w64-hack-and-slash-fixes-for-libc.patch"
|
||||
"0501-minor-fixes-to-get-lldb-building.patch"
|
||||
"0501-fixes-to-get-lldb-building.patch"
|
||||
"0502-hack-to-use-64-bit-time-for-mingw.patch"
|
||||
"0601-libunwind-add-support-for-mingw-w64.patch"
|
||||
"0701-fix-visibility-for-libc-abi-on-win32.patch")
|
||||
"0801-Don-t-build-LLVMPolly-on-WIN32.patch")
|
||||
# Some patch notes :)
|
||||
#0001-0099 -> llvm
|
||||
#0101-0199 -> clang
|
||||
@@ -84,54 +75,47 @@ source=(https://llvm.org/releases/${pkgver}/llvm-${pkgver}.src.tar.xz{,.sig}
|
||||
#0501-0599 -> lldb
|
||||
#0601-0699 -> libunwind
|
||||
#0701-0799 -> libc++abi
|
||||
sha256sums=('8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be'
|
||||
#0801-0899 -> polly
|
||||
sha256sums=('e35dcbae6084adcf4abb32514127c5eabd7d63b733852ccdb31e06f1373136da'
|
||||
'SKIP'
|
||||
'cea5f88ebddb30e296ca89130c83b9d46c2d833685e2912303c828054c4dc98a'
|
||||
'019f23c2192df793ac746595e94a403908749f8e0c484b403476d2611dd20970'
|
||||
'SKIP'
|
||||
'd3f25b23bef24c305137e6b44f7e81c51bbec764c119e01512a9bd2330be3115'
|
||||
'd5ad5266462134a482b381f1f8115b6cad3473741b3bb7d1acc7f69fd0f0c0b3'
|
||||
'SKIP'
|
||||
'31544baafbee0d6c652637f6dfa19ca91afe5ca577e07752f4b2c23656bc6304'
|
||||
'e96c8a6150b3538be43279a44f8a3e7b74e4bd324255537ba3017ce74304cdad'
|
||||
'SKIP'
|
||||
'4f4d33c4ad69bf9e360eebe6b29b7b19486948b1a41decf89d4adec12473cf96'
|
||||
'eae5981e9a21ef0decfcac80a1af584ddb064a32805f95a57c7c83a5eb28c9b1'
|
||||
'SKIP'
|
||||
'dca9cb619662ad2d3a0d685c4366078345247218c3702dd35bcaaa23f63481d8'
|
||||
'176918c7eb22245c3a5c56ef055e4d69f5345b4a98833e0e8cb1a19cab6b8911'
|
||||
'SKIP'
|
||||
'41b7d37eb128fd362ab3431be5244cf50325bb3bb153895735c5bacede647c99'
|
||||
'87d078b959c4a6e5ff9fd137c2f477cadb1245f93812512996f73986a6d973c6'
|
||||
'SKIP'
|
||||
'33e06457b9ce0563c89b11ccc7ccabf9cff71b83571985a5bf8684c9150e7502'
|
||||
'399a7920a5278d42c46a7bf7e4191820ec2301457a7d0d4fcc9a4ac05dd53897'
|
||||
'SKIP'
|
||||
'2dbd8f05c662c1c9f11270fc9d0c63b419ddc988095e0ad107ed911cf882033d'
|
||||
'c0a0ca32105e9881d86b7ca886220147e686edc97fdb9f3657c6659dc6568b7d'
|
||||
'SKIP'
|
||||
'0755efa9f969373d4d543123bbed4b3f9a835f6302875c1379c5745857725973'
|
||||
'9a70e2333d54f97760623d89512c4831d6af29e78b77a33d824413ce98587f6f'
|
||||
'SKIP'
|
||||
'27a5dbf95e8aa9e0bbe3d6c5d1e83c92414d734357aa0d6c16020a65dc4dcd97'
|
||||
'44694254a2b105cec13ce0560f207e8552e6116c181b8d21bda728559cf67042'
|
||||
'SKIP'
|
||||
'3f55d2114805110e370fab6630763c359d83b07c356f61b86afc32feb7cf7514'
|
||||
'78b6951956360a8e05fdc7020bc7e1996da75b499022f9213465070fc238529c'
|
||||
'aceffb61d57c7c01bc2d9d5461f961df26cffdffaaabb8dda9f219acfe59c77a'
|
||||
'bccdb99553424121927b3f82086efb2adeee230f18944504ddd93d2d72371d5c'
|
||||
'c840f4e2286385c4ab3503c02976fd2459516fdc05e44f702d648afaaaebd97f'
|
||||
'f06f57af203811f6a4c62ac3f1e4545628db13185f5e7d3225d4b1104ca69be1'
|
||||
'c57d5f2904158b992378906bcddbae79d0566cdb07cc74fbd9b2d76d52661a12'
|
||||
'5d1fbbe39221af57ae078e5387f43fec602541838b3608cd3f6517bb2364ae54'
|
||||
'afdd708e2431874da4e03d9f51848840ec30ef64b4d440c8dfd50446b2f5ce1a'
|
||||
'8ba3968939f9a7c6a51849aaf1ab6126f85aa612349570b3644f855929d496fc'
|
||||
'1740ffa1d23fdee2b147a46cfed4d186bf7d3dc626bb3a1d3ca925147895a2d4'
|
||||
'e8c8ebbcc7353548974e640b76bfe13d6b89afc832066e0d7156fe242b561a93'
|
||||
'066e61c097fcad202b3b4f26dbe667719a9f5ae872837250629d69fe06bd1af1'
|
||||
'cae561cb643daeb68e9ec2716928ba79b459ec2064829e54ecd1edcc378d293b'
|
||||
'8a636174bff1a05872777b935e27c15c3b87683b57c4277de0d1e9ecc1ca5548'
|
||||
'f2931ac1ebcc33faa1fa320ebe76143baf9d7635f4819e0f9e37924e70f30d39'
|
||||
'9f9a12749869bb6c5817d6d5231417195c2e3bd80c10059b3f3e70b010159c26'
|
||||
'fb1ef06b26e88d37d52c3e0b3b261089e92bb7c08231ec8fa234465fdbdab308'
|
||||
'29e61097ca4f9b1df304e1e7a8f65e6d8ed452e9eb88d9d8cc6ff78b64d84aa8'
|
||||
'852d55907b469739fca96b043e41c596824ad9d933268ce65a82100b975e91fb'
|
||||
'0f2cf89298303911a20e9cee7208ed418d91cf700af611a142dc735c708e1435'
|
||||
'84e929fd0f59a90f8c46cf831f420a36e5e4dff359f2ae9338c42ea20f1243d7'
|
||||
'5782b351170ab747c046efb79244a36de2c531014d5b719e7398f1597a10b948'
|
||||
'fbb5f936a0c23529a7ec43d458ea22c033a6c84c2017178ad3645b03d8584bcf'
|
||||
'1ebe995823d427177bf79c4c73e205f708c58e25616b4183d5981a1b4c8130e0'
|
||||
'eecb723ed6fa59d9debd84a11bcede607020beadfdd0988778392dd7a1820963')
|
||||
'd5b11097084f8a03dd3002c2adb27b4fec99cf290404049f1a4e1185274bde67'
|
||||
'5081a1a9d8074b275f3087d4d80a13ce5d1c20bc1962819953790e54275930c8'
|
||||
'46e10ce71525836d67466af954542c7133b646d7cc81dc30388f42dc27c7a6d6'
|
||||
'ef273f4b3abb2e0ee5c452362fe82195c3f1787bd6788ed24234aaf8180a015e'
|
||||
'5303e8a2d64a4c08a2088a3610d74cfda3adbf5fdf172c4ca1f0ddc8701e3cf2'
|
||||
'f6e04b5e2a65e1eaa4ab6d14427cf17b1e79625a428430dd16a441578b31df55'
|
||||
'8599e0ca38c96cff811a17f0cffd9ff970632a0357ae8e6076b4dff03a18182c'
|
||||
'1e602bc8d51e77942e0ea7bb6174f8c2256817887dca8d941bba063c06d6845d'
|
||||
'1bbc52f951eb1a1162b8c01a3a951b1da8612572d346d603272229bd84c4d2e3'
|
||||
'47621da0a866702525429fbe4b584eb5d719a93b249a90c0e7dbdfc2cf33ab44'
|
||||
'4260da29db788e478503bcf3e3b1522991be3545828776cf7bc94df48f484328'
|
||||
'bafaf7d06bec3ed7fba58e8a926e7b472b5e16442b6ee9dd8c7ee6c0cce9792a'
|
||||
'a9e1c001701508c6ffd808cf530e0f6a756253a5cdb72d166e7987fa5ab64960'
|
||||
'da44cca549bc7fb9e04f0f038a1ed68ba99cdfec834fc241ab13880bd0aa3b0f'
|
||||
'df0fcd73d46207d23b4f6952de75ab626084560e9d9c698c3eb8d5ec071b308c'
|
||||
'a2bbb4d75d2d02b08a44a9f767b7f4ff11a546ae1ed79d06c3fc254218ac54e0'
|
||||
'79d811b916b2ff718fd3b68b4211dd7548a7b51badc510d9e83eeac4229338a3'
|
||||
'bc394e597f8939b6f6630bd88c990f951738aaadacded2f3be71c658e9608fe7')
|
||||
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D' # Hans Wennborg, Google.
|
||||
'11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard
|
||||
noextract=(cfe-${pkgver}.src.tar.xz
|
||||
@@ -153,58 +137,43 @@ prepare() {
|
||||
[[ -d ${srcdir}/lldb-${pkgver} ]] || tar -xJvf ${srcdir}/lldb-${pkgver}.src.tar.xz -C ${srcdir} || true
|
||||
|
||||
cd "${srcdir}/llvm-${pkgver}.src"
|
||||
# cleanup files created by patch
|
||||
rm -rf lib/DLLDriver/CMakeLists.txt \
|
||||
lib/DLLDriver/Config.h \
|
||||
lib/DLLDriver/DllDriver.cpp \
|
||||
lib/DLLDriver/LLVMBuild.txt \
|
||||
lib/DLLDriver/Librarian.cpp \
|
||||
lib/DLLDriver/ModuleDef.cpp \
|
||||
lib/DLLDriver/Options.td \
|
||||
include/llvm/DllDriver/DllDriver.h || true
|
||||
patch -p1 -i "${srcdir}/0001-genlib-named-as-llvm-dlltool.patch"
|
||||
patch -p1 -i "${srcdir}/0002-mingw-w64-use-MSVC-style-ByteAlignment.patch"
|
||||
patch -p1 -i "${srcdir}/0003-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
|
||||
patch -p1 -i "${srcdir}/0004-Globally-provide-DESTDIR-for-all-platforms.patch"
|
||||
patch -p1 -i "${srcdir}/0005-not-install-msvc-files.patch"
|
||||
patch -p1 -i "${srcdir}/0006-llvm-config-look-for-unversioned-shared-lib-on-win32.patch"
|
||||
patch -p1 -i "${srcdir}/0007-add-pthread-as-system-lib-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0008-fix-bugpoint-multiple-definition.patch"
|
||||
patch -p1 -i "${srcdir}/0001-mingw-w64-use-MSVC-style-ByteAlignment.patch"
|
||||
patch -p1 -i "${srcdir}/0002-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
|
||||
patch -p1 -i "${srcdir}/0003-Globally-provide-DESTDIR-for-all-platforms.patch"
|
||||
patch -p1 -i "${srcdir}/0004-llvm-config-look-for-unversioned-shared-lib-on-win32.patch"
|
||||
patch -p1 -i "${srcdir}/0005-add-pthread-as-system-lib-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0006-fix-bugpoint-multiple-definition.patch"
|
||||
|
||||
cd "${srcdir}/cfe-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0101-mingw-w64-enable-support-for-__declspec-selectany.patch"
|
||||
patch -p1 -i "${srcdir}/0102-Allow-build-static-clang-library-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0103-fix-libclang-name-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0104-don-t-use-GCC-headers.patch"
|
||||
patch -p1 -i "${srcdir}/0105-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
patch -p1 -i "${srcdir}/0106-link-pthread-with-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0107-enable-__float128-for-X86-MinGW.patch"
|
||||
patch -p1 -i "${srcdir}/0108-Don-t-create-cl-executable-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0109-use-emulated-tls-with-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0101-Allow-build-static-clang-library-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0102-fix-libclang-name-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0103-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
patch -p1 -i "${srcdir}/0104-link-pthread-with-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0105-use-emulated-tls-with-mingw.patch"
|
||||
|
||||
cd "${srcdir}/compiler-rt-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0201-mingw-w64-__udivdi3-mangle-hack.patch"
|
||||
patch -p1 -i "${srcdir}/0202-compiler-rt-fix-mingw-build.patch"
|
||||
|
||||
# not ported for 4.0
|
||||
#cd "${srcdir}/lld-${pkgver}.src"
|
||||
## cleanup file created by patch
|
||||
#rm -rf cmake/modules/AddLLD.cmake || true
|
||||
#patch -p1 -i "${srcdir}/0301-COFF-gnu-driver-support.patch"
|
||||
#patch -p1 -i "${srcdir}/0302-add-install-target-for-the-lld-tool.patch"
|
||||
|
||||
cd "${srcdir}/libcxx-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0401-mingw-w64-hack-and-slash-fixes-for-libc.patch"
|
||||
|
||||
cd "${srcdir}/lldb-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0501-minor-fixes-to-get-lldb-building.patch"
|
||||
patch -p1 -i "${srcdir}/0502-hack-to-use-64-bit-time-for-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0501-fixes-to-get-lldb-building.patch"
|
||||
# There was big refactor/cleanup and it doesn't apply any more
|
||||
# https://github.com/llvm-mirror/lldb/commit/456b31d616f3c71be31315ae26f6c8e174f4fd51#diff-2c5e3e9a387d499896aa082d15141bfb
|
||||
# However 32 bit lldb is still crashing without it; temporary leaving patch for the reference until it's solved
|
||||
#patch -p1 -i "${srcdir}/0502-hack-to-use-64-bit-time-for-mingw.patch"
|
||||
|
||||
cd "${srcdir}/libunwind-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0601-libunwind-add-support-for-mingw-w64.patch"
|
||||
|
||||
cd "${srcdir}/libcxxabi-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0701-fix-visibility-for-libc-abi-on-win32.patch"
|
||||
#cd "${srcdir}/libcxxabi-${pkgver}.src"
|
||||
|
||||
cd "${srcdir}/polly-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0801-Don-t-build-LLVMPolly-on-WIN32.patch"
|
||||
|
||||
# At the present, clang must reside inside the LLVM source code tree to build
|
||||
# See https://bugs.llvm.org/show_bug.cgi?id=4840
|
||||
@@ -246,17 +215,11 @@ build() {
|
||||
# "Ninja" cant install each component seperately
|
||||
# https://github.com/martine/ninja/issues/932
|
||||
|
||||
if [ "${_compiler}" == "gcc" ]; then
|
||||
export CC='gcc'
|
||||
export CXX='g++'
|
||||
elif [ "${_compiler}" == "clang" ]; then
|
||||
if [ "${_compiler}" == "clang" ]; then
|
||||
#export CC='clang -stdlib=libc++'
|
||||
#export CXX='clang++ -stdlib=libc++'
|
||||
export CC='clang'
|
||||
export CXX='clang++'
|
||||
else
|
||||
msg "undefined compiler"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
@@ -336,7 +299,8 @@ package_compiler-rt() {
|
||||
package_libcxxabi() {
|
||||
pkgdesc="C++ Standard Library Support (mingw-w64)"
|
||||
url="https://libcxxabi.llvm.org/"
|
||||
depends="${MINGW_PACKAGE_PREFIX}-libunwind"
|
||||
# Don't depend on libunwind until it actually works as installing it breaks some packages
|
||||
#depends="${MINGW_PACKAGE_PREFIX}-libunwind"
|
||||
|
||||
cd "${srcdir}/llvm-${pkgver}.src"
|
||||
make -C ../build-${CARCH}/projects/libcxxabi -j1 DESTDIR="${pkgdir}" install
|
||||
|
||||
Reference in New Issue
Block a user