clang: update to 4.0.0 (#2294)

This commit is contained in:
Mateusz Mikuła
2017-03-21 10:15:50 +01:00
committed by Алексей
parent f083f27fb1
commit 35954325aa
44 changed files with 859 additions and 2919 deletions

View File

@@ -1,7 +1,7 @@
From 5e9f6cde2f8389190f318da10d8d4e70939a0e3a Mon Sep 17 00:00:00 2001
From 462496b4bc03a0243f4c43f7e40ac70cedd1dcec Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Tue, 9 Aug 2016 17:52:46 -0700
Subject: [PATCH 1/3] genlib: named as llvm-dlltool
Subject: [PATCH 1/6] genlib: named as llvm-dlltool
A PE COFF spec compliant import library generator.
Intended to be used with mingw-w64.
@@ -9,10 +9,32 @@ Intended to be used with mingw-w64.
Supports:
PE COFF spec (section 8, Import Library Format)
PE COFF spec (Aux Format 3: Weak Externals)
---
include/llvm/DllDriver/DllDriver.h | 24 ++
lib/CMakeLists.txt | 1 +
lib/DLLDriver/CMakeLists.txt | 11 +
lib/DLLDriver/Config.h | 119 ++++++++
lib/DLLDriver/DllDriver.cpp | 185 ++++++++++++
lib/DLLDriver/LLVMBuild.txt | 22 ++
lib/DLLDriver/Librarian.cpp | 603 +++++++++++++++++++++++++++++++++++++
lib/DLLDriver/ModuleDef.cpp | 321 ++++++++++++++++++++
lib/DLLDriver/Options.td | 5 +
lib/Object/ArchiveWriter.cpp | 3 +-
tools/llvm-ar/CMakeLists.txt | 2 +
tools/llvm-ar/llvm-ar.cpp | 6 +-
12 files changed, 1300 insertions(+), 2 deletions(-)
create mode 100644 include/llvm/DllDriver/DllDriver.h
create mode 100644 lib/DLLDriver/CMakeLists.txt
create mode 100644 lib/DLLDriver/Config.h
create mode 100644 lib/DLLDriver/DllDriver.cpp
create mode 100644 lib/DLLDriver/LLVMBuild.txt
create mode 100644 lib/DLLDriver/Librarian.cpp
create mode 100644 lib/DLLDriver/ModuleDef.cpp
create mode 100644 lib/DLLDriver/Options.td
diff --git a/include/llvm/DllDriver/DllDriver.h b/include/llvm/DllDriver/DllDriver.h
new file mode 100644
index 0000000..79fb7b7
index 00000000000..79fb7b76deb
--- /dev/null
+++ b/include/llvm/DllDriver/DllDriver.h
@@ -0,0 +1,24 @@
@@ -41,18 +63,19 @@ index 0000000..79fb7b7
+
+#endif
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 9449421..03988a6 100644
index 76549540ce0..bebb628e06d 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -20,4 +20,5 @@ add_subdirectory(LineEditor)
@@ -21,5 +21,6 @@ add_subdirectory(LineEditor)
add_subdirectory(ProfileData)
add_subdirectory(Fuzzer)
add_subdirectory(Passes)
+add_subdirectory(DLLDriver)
add_subdirectory(LibDriver)
add_subdirectory(XRay)
diff --git a/lib/DLLDriver/CMakeLists.txt b/lib/DLLDriver/CMakeLists.txt
new file mode 100644
index 0000000..91fb2f0
index 00000000000..91fb2f08de0
--- /dev/null
+++ b/lib/DLLDriver/CMakeLists.txt
@@ -0,0 +1,11 @@
@@ -69,7 +92,7 @@ index 0000000..91fb2f0
+add_dependencies(LLVMDllDriver DllOptionsTableGen)
diff --git a/lib/DLLDriver/Config.h b/lib/DLLDriver/Config.h
new file mode 100644
index 0000000..d5a3d26
index 00000000000..d5a3d261de0
--- /dev/null
+++ b/lib/DLLDriver/Config.h
@@ -0,0 +1,119 @@
@@ -195,7 +218,7 @@ index 0000000..d5a3d26
\ No newline at end of file
diff --git a/lib/DLLDriver/DllDriver.cpp b/lib/DLLDriver/DllDriver.cpp
new file mode 100644
index 0000000..aa9adc8
index 00000000000..aa9adc84688
--- /dev/null
+++ b/lib/DLLDriver/DllDriver.cpp
@@ -0,0 +1,185 @@
@@ -386,7 +409,7 @@ index 0000000..aa9adc8
+}
diff --git a/lib/DLLDriver/LLVMBuild.txt b/lib/DLLDriver/LLVMBuild.txt
new file mode 100644
index 0000000..8e2b1d65
index 00000000000..8e2b1d651f2
--- /dev/null
+++ b/lib/DLLDriver/LLVMBuild.txt
@@ -0,0 +1,22 @@
@@ -414,7 +437,7 @@ index 0000000..8e2b1d65
+required_libraries = Object Option Support
diff --git a/lib/DLLDriver/Librarian.cpp b/lib/DLLDriver/Librarian.cpp
new file mode 100644
index 0000000..486733e
index 00000000000..486733e6c5c
--- /dev/null
+++ b/lib/DLLDriver/Librarian.cpp
@@ -0,0 +1,603 @@
@@ -1023,7 +1046,7 @@ index 0000000..486733e
+}
diff --git a/lib/DLLDriver/ModuleDef.cpp b/lib/DLLDriver/ModuleDef.cpp
new file mode 100644
index 0000000..428049a
index 00000000000..428049abc5d
--- /dev/null
+++ b/lib/DLLDriver/ModuleDef.cpp
@@ -0,0 +1,321 @@
@@ -1350,7 +1373,7 @@ index 0000000..428049a
+} // namespace llvm
diff --git a/lib/DLLDriver/Options.td b/lib/DLLDriver/Options.td
new file mode 100644
index 0000000..62f33f3
index 00000000000..62f33f386e8
--- /dev/null
+++ b/lib/DLLDriver/Options.td
@@ -0,0 +1,5 @@
@@ -1360,10 +1383,10 @@ index 0000000..62f33f3
+def out: JoinedOrSeparate<["-"], "o">, HelpText<"Set output file">;
+def dll: JoinedOrSeparate<["-"], "d">, HelpText<"Set dll name">;
diff --git a/lib/Object/ArchiveWriter.cpp b/lib/Object/ArchiveWriter.cpp
index 4ede536..4e8c5f0 100644
index f8e3c5a0a03..d5f067ed675 100644
--- a/lib/Object/ArchiveWriter.cpp
+++ b/lib/Object/ArchiveWriter.cpp
@@ -285,7 +285,8 @@ writeSymbolTable(raw_fd_ostream &Out, object::Archive::Kind Kind,
@@ -299,7 +299,8 @@ writeSymbolTable(raw_fd_ostream &Out, object::Archive::Kind Kind,
continue;
if (!(Symflags & object::SymbolRef::SF_Global))
continue;
@@ -1374,7 +1397,7 @@ index 4ede536..4e8c5f0 100644
unsigned NameOffset = NameOS.tell();
diff --git a/tools/llvm-ar/CMakeLists.txt b/tools/llvm-ar/CMakeLists.txt
index 86233df..94cc205 100644
index 3bb0c8f7b7c..14732b47b93 100644
--- a/tools/llvm-ar/CMakeLists.txt
+++ b/tools/llvm-ar/CMakeLists.txt
@@ -1,6 +1,7 @@
@@ -1385,13 +1408,13 @@ index 86233df..94cc205 100644
LibDriver
Object
Support
@@ -12,3 +13,4 @@ add_llvm_tool(llvm-ar
@@ -15,3 +16,4 @@ add_llvm_tool(llvm-ar
add_llvm_tool_symlink(llvm-ranlib llvm-ar)
add_llvm_tool_symlink(llvm-lib llvm-ar)
+add_llvm_tool_symlink(llvm-dlltool llvm-ar)
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 40e4a3a..1ebded3 100644
index b99a396da62..23e323c8082 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -16,6 +16,7 @@
@@ -1402,7 +1425,7 @@ index 40e4a3a..1ebded3 100644
#include "llvm/LibDriver/LibDriver.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ArchiveWriter.h"
@@ -844,6 +845,9 @@ int main(int argc, char **argv) {
@@ -850,6 +851,9 @@ int main(int argc, char **argv) {
llvm::InitializeAllAsmParsers();
StringRef Stem = sys::path::stem(ToolName);
@@ -1412,7 +1435,7 @@ index 40e4a3a..1ebded3 100644
if (Stem.find("ranlib") == StringRef::npos &&
Stem.find("lib") != StringRef::npos)
return libDriverMain(makeArrayRef(argv, argc));
@@ -859,5 +863,5 @@ int main(int argc, char **argv) {
@@ -865,5 +869,5 @@ int main(int argc, char **argv) {
return ranlib_main();
if (Stem.find("ar") != StringRef::npos)
return ar_main();
@@ -1420,5 +1443,5 @@ index 40e4a3a..1ebded3 100644
+ fail("Not ranlib, ar, lib or dlltool!");
}
--
2.8.3
2.11.0.windows.3

View File

@@ -1,30 +0,0 @@
From bb716cb613551806c92d48b7a96c2cd7e76a7e06 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Sat, 1 Oct 2016 09:37:25 +0000
Subject: [PATCH] COFF: Fix short import lib import name type bitshift
As per the PE COFF spec (section 8.3, Import Name Type)
Offset: 18 Size 2 bits Name: Type
Offset: 20 Size 3 bits Name: Name Type
Offset: 20 added based on 18+2
Partially commited as rL279069
Differential Revision: https://reviews.llvm.org/D23540
diff --git a/include/llvm/Support/COFF.h b/include/llvm/Support/COFF.h
index 7dad3e8..1ca781b9 100644
--- a/include/llvm/Support/COFF.h
+++ b/include/llvm/Support/COFF.h
@@ -657,7 +657,7 @@ namespace COFF {
}
ImportNameType getNameType() const {
- return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 3);
+ return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 2);
}
};
--
2.7.4

View File

@@ -1,16 +1,19 @@
From c659c69306254b8068af5582803f79508e79ba63 Mon Sep 17 00:00:00 2001
From da82422a5f9c9709ba3ac15b52891b8b310278ad Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Tue, 16 Aug 2016 12:55:01 -0700
Subject: [PATCH 3/3] mingw-w64: use MSVC style ByteAlignment
Subject: [PATCH 2/6] 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 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/MC/WinCOFFStreamer.cpp b/lib/MC/WinCOFFStreamer.cpp
index 5c6407e..f86cbc5 100644
index 6383d879403..06a5aef0e3b 100644
--- a/lib/MC/WinCOFFStreamer.cpp
+++ b/lib/MC/WinCOFFStreamer.cpp
@@ -208,7 +208,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
@@ -217,7 +217,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
auto *Symbol = cast<MCSymbolCOFF>(S);
const Triple &T = getContext().getObjectFileInfo()->getTargetTriple();
@@ -19,7 +22,7 @@ index 5c6407e..f86cbc5 100644
if (ByteAlignment > 32)
report_fatal_error("alignment is limited to 32-bytes");
@@ -220,7 +220,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
@@ -229,7 +229,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
Symbol->setExternal(true);
Symbol->setCommon(Size, ByteAlignment);
@@ -29,5 +32,5 @@ index 5c6407e..f86cbc5 100644
raw_svector_ostream OS(Directive);
const MCObjectFileInfo *MFI = getContext().getObjectFileInfo();
--
2.8.3
2.11.0.windows.3

View File

@@ -1,11 +1,14 @@
From 12d299345b51c1686c1d82986de6de020970bb57 Mon Sep 17 00:00:00 2001
From fffcfe99dab9c1ef714067d337159fbefbd5d139 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Sun, 28 Jun 2015 20:14:51 +0100
Subject: [PATCH] Fix GetHostTriple for mingw-w64 in msys
Subject: [PATCH 3/6] Fix GetHostTriple for mingw-w64 in msys
---
cmake/modules/GetHostTriple.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/modules/GetHostTriple.cmake b/cmake/modules/GetHostTriple.cmake
index 671a8ce..45c47e1 100644
index 0cad1db4eff..47e9f986e15 100644
--- a/cmake/modules/GetHostTriple.cmake
+++ b/cmake/modules/GetHostTriple.cmake
@@ -8,11 +8,11 @@ function( get_host_triple var )
@@ -21,7 +24,7 @@ index 671a8ce..45c47e1 100644
+ set( value "i686-w64-mingw32" )
endif()
else( MSVC )
set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
--
2.4.5
2.11.0.windows.3

View File

@@ -0,0 +1,27 @@
From 44b291e8ebb6d4a80843cf9b46b4804b0f0d6515 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
---
cmake/modules/LLVMInstallSymlink.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
index 482697b06ba..61c4b9dea80 100644
--- a/cmake/modules/LLVMInstallSymlink.cmake
+++ b/cmake/modules/LLVMInstallSymlink.cmake
@@ -3,9 +3,9 @@
# See PR8397.
function(install_symlink name target outdir)
+set(DESTDIR $ENV{DESTDIR})
if(UNIX)
set(LINK_OR_COPY create_symlink)
- set(DESTDIR $ENV{DESTDIR})
else()
set(LINK_OR_COPY copy)
endif()
--
2.11.0.windows.3

View File

@@ -1,11 +0,0 @@
--- llvm-3.9.0.src/CMakeLists.txt.orig 2016-09-09 08:09:42.327036300 +0300
+++ llvm-3.9.0.src/CMakeLists.txt 2016-09-09 08:09:51.787577400 +0300
@@ -768,7 +768,7 @@
endif()
add_subdirectory(test)
add_subdirectory(unittests)
- if (MSVC)
+ if (WIN32)
# This utility is used to prevent crashing tests from calling Dr. Watson on
# Windows.
add_subdirectory(utils/KillTheDoctor)

View File

@@ -0,0 +1,22 @@
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

View File

@@ -1,18 +1,17 @@
From ffec0c88ac778aa809e7bf99c6e61f0b4ef17e3d Mon Sep 17 00:00:00 2001
From cccec8226592a0a635a4f00d5bf6f72803616e38 Mon Sep 17 00:00:00 2001
From: Mateusz Mikula <mati865@gmail.com>
Date: Fri, 20 Jan 2017 23:56:47 +0100
Subject: [PATCH] fix llvm-config shared lib version on win32
Date: Thu, 2 Feb 2017 11:48:25 +0100
Subject: [PATCH 6/6] llvm-config: look for unversioned shared lib on win32
Signed-off-by: Mateusz Mikula <mati865@gmail.com>
---
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 94d426b..402df01 100644
index 25344e4cd01..24aeba7cb0f 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -345,7 +345,7 @@ int main(int argc, char **argv) {
@@ -351,7 +351,7 @@ int main(int argc, char **argv) {
const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE));
if (HostTriple.isOSWindows()) {
SharedExt = "dll";
@@ -21,8 +20,8 @@ index 94d426b..402df01 100644
if (HostTriple.isOSCygMing()) {
StaticExt = "a";
StaticPrefix = "lib";
@@ -382,8 +382,10 @@ int main(int argc, char **argv) {
const bool BuiltSharedLibs = std::strcmp(LLVM_ENABLE_SHARED, "ON") == 0;
@@ -389,8 +389,10 @@ int main(int argc, char **argv) {
const bool BuiltSharedLibs = !!LLVM_ENABLE_SHARED;
bool DyLibExists = false;
- const std::string DyLibName =

View File

@@ -1,13 +0,0 @@
--- a/cmake/modules/LLVMInstallSymlink.cmake
+++ b/cmake/modules/LLVMInstallSymlink.cmake
@@ -3,9 +3,9 @@
# See PR8397.
function(install_symlink name target outdir)
+set(DESTDIR $ENV{DESTDIR})
if(UNIX)
set(LINK_OR_COPY create_symlink)
- set(DESTDIR $ENV{DESTDIR})
else()
set(LINK_OR_COPY copy)
endif()

View File

@@ -0,0 +1,25 @@
From 6caf7048b2a66fa2beb198e52e5c62fa08b786e8 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
---
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
--- a/lib/Support/CMakeLists.txt
+++ b/lib/Support/CMakeLists.txt
@@ -2,6 +2,9 @@ set(system_libs)
if( MSVC OR MINGW )
# libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
set(system_libs ${system_libs} psapi shell32 ole32 uuid)
+ if( MINGW )
+ set(system_libs ${system_libs} pthread)
+ endif()
elseif( CMAKE_HOST_UNIX )
if( HAVE_LIBRT )
set(system_libs ${system_libs} rt)
--
2.12.0

View File

@@ -1,86 +0,0 @@
From c36be93ddb85a15935ff32c3942628fabf698a26 Mon Sep 17 00:00:00 2001
From: Chris Bieneman <beanz@apple.com>
Date: Tue, 1 Nov 2016 20:19:33 +0000
Subject: [PATCH] Fix llvm-shlib cmake build
Summary:
This fixes a few things that used to work with a Makefile build, but were broken in cmake.
1. Treat MINGW like a Linux system.
2. The shlib should never contain other shared libraries.
Patch By: Valentin Churavy
Reviewers: axw, beanz
Subscribers: modocache, beanz, mgorny
Differential Revision: https://reviews.llvm.org/D25865
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285737 91177308-0d34-0410-b5e6-96231b3b80d8
---
tools/llvm-shlib/CMakeLists.txt | 42 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/tools/llvm-shlib/CMakeLists.txt b/tools/llvm-shlib/CMakeLists.txt
index 3fe672d..edadb82 100644
--- a/tools/llvm-shlib/CMakeLists.txt
+++ b/tools/llvm-shlib/CMakeLists.txt
@@ -8,29 +8,27 @@ set(SOURCES
llvm_map_components_to_libnames(LIB_NAMES ${LLVM_DYLIB_COMPONENTS})
-if(LLVM_LINK_LLVM_DYLIB)
- if(LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
- message(WARNING "Using LLVM_LINK_LLVM_DYLIB with LLVM_DYLIB_EXPORTED_SYMBOL_FILE may not work. Use at your own risk.")
- endif()
-
- # libLLVM.so should not have any dependencies on any other LLVM
- # shared libraries. When using the "all" pseudo-component,
- # LLVM_AVAILABLE_LIBS is added to the dependencies, which may
- # contain shared libraries (e.g. libLTO).
- #
- # Also exclude libLLVMTableGen for the following reasons:
- # - it is only used by internal *-tblgen utilities;
- # - it pollutes the global options space.
- foreach(lib ${LIB_NAMES})
- get_target_property(t ${lib} TYPE)
- if("${lib}" STREQUAL "LLVMTableGen")
- elseif("x${t}" STREQUAL "xSTATIC_LIBRARY")
- list(APPEND FILTERED_LIB_NAMES ${lib})
- endif()
- endforeach()
- set(LIB_NAMES ${FILTERED_LIB_NAMES})
+if(LLVM_LINK_LLVM_DYLIB AND LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
+ message(WARNING "Using LLVM_LINK_LLVM_DYLIB with LLVM_DYLIB_EXPORTED_SYMBOL_FILE may not work. Use at your own risk.")
endif()
+# libLLVM.so should not have any dependencies on any other LLVM
+# shared libraries. When using the "all" pseudo-component,
+# LLVM_AVAILABLE_LIBS is added to the dependencies, which may
+# contain shared libraries (e.g. libLTO).
+#
+# Also exclude libLLVMTableGen for the following reasons:
+# - it is only used by internal *-tblgen utilities;
+# - it pollutes the global options space.
+foreach(lib ${LIB_NAMES})
+ get_target_property(t ${lib} TYPE)
+ if("${lib}" STREQUAL "LLVMTableGen")
+ elseif("x${t}" STREQUAL "xSTATIC_LIBRARY")
+ list(APPEND FILTERED_LIB_NAMES ${lib})
+ endif()
+endforeach()
+set(LIB_NAMES ${FILTERED_LIB_NAMES})
+
if(LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
set(LLVM_EXPORTED_SYMBOL_FILE ${LLVM_DYLIB_EXPORTED_SYMBOL_FILE})
add_custom_target(libLLVMExports DEPENDS ${LLVM_EXPORTED_SYMBOL_FILE})
@@ -39,7 +37,7 @@ endif()
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
list(REMOVE_DUPLICATES LIB_NAMES)
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") # FIXME: It should be "GNU ld for elf"
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR MINGW) # FIXME: It should be "GNU ld for elf"
# GNU ld doesn't resolve symbols in the version script.
set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")

View File

@@ -1,8 +0,0 @@
--- llvm-3.9.1.src/tools/msbuild/CMakeLists.txt.orig 2017-01-17 20:02:22.438672900 +0300
+++ llvm-3.9.1.src/tools/msbuild/CMakeLists.txt 2017-01-17 20:02:29.920100800 +0300
@@ -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}")

View File

@@ -1,44 +0,0 @@
From 42df5ed300973bfa10f155dd967768684c86f932 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Fri, 27 May 2016 20:30:18 -0700
Subject: [PATCH 1/4] Revert "Revert r253898 and r253899, this breaks mingw
compilation on openSUSE."
This reverts commit 0e2452f3055e2e2cad06a55c5ca9c2be13404781.
diff --git a/lib/Driver/MinGWToolChain.cpp b/lib/Driver/MinGWToolChain.cpp
index 938440b..c5287bb 100644
--- a/lib/Driver/MinGWToolChain.cpp
+++ b/lib/Driver/MinGWToolChain.cpp
@@ -66,23 +66,17 @@ MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
: ToolChain(D, Triple, Args) {
getProgramPaths().push_back(getDriver().getInstalledDir());
-// In Windows there aren't any standard install locations, we search
-// for gcc on the PATH. In Linux the base is always /usr.
-#ifdef LLVM_ON_WIN32
+ // On Windows if there is no sysroot we search for gcc on the PATH.
if (getDriver().SysRoot.size())
- Base = getDriver().SysRoot;
+ Base = getDriver().SysRoot;
+#ifdef LLVM_ON_WIN32
else if (llvm::ErrorOr<std::string> GPPName =
llvm::sys::findProgramByName("gcc"))
Base = llvm::sys::path::parent_path(
llvm::sys::path::parent_path(GPPName.get()));
- else
- Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
-#else
- if (getDriver().SysRoot.size())
- Base = getDriver().SysRoot;
- else
- Base = "/usr";
#endif
+ if (!Base.size())
+ Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
Base += llvm::sys::path::get_separator();
findGccLibDir();
--
2.8.3

View File

@@ -1,14 +1,17 @@
From 05d6add74e34a5ff2aeadec722df981be2760e52 Mon Sep 17 00:00:00 2001
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 3/4] mingw-w64: enable support for __declspec(selectany)
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 7da1efe..2d4be9e 100644
index d7db7186b3..ddb41c0eb8 100644
--- a/include/clang/Basic/Attr.td
+++ b/include/clang/Basic/Attr.td
@@ -2097,9 +2097,8 @@ def DLLImport : InheritableAttr, TargetSpecificAttr<TargetWindows> {
@@ -2194,9 +2194,8 @@ def DLLImport : InheritableAttr, TargetSpecificAttr<TargetWindows> {
let Documentation = [DLLImportDocs];
}
@@ -21,5 +24,5 @@ index 7da1efe..2d4be9e 100644
}
--
2.8.3
2.12.0

View File

@@ -0,0 +1,25 @@
From c1c93aaa9b8a903ce3f761ae2dabb20daf521f5c 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
---
tools/libclang/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index 2dd6703076..477e53dd15 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -74,7 +74,7 @@ if( LLVM_ENABLE_PIC )
set(ENABLE_SHARED SHARED)
endif()
-if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32)
+if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND (NOT MSVC))
set(ENABLE_STATIC STATIC)
endif()
--
2.12.0

View File

@@ -1,45 +0,0 @@
From ee9923897d733a852efe1e8836a1a98f41ea6cf9 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Wed, 16 Dec 2015 02:07:06 -0800
Subject: [PATCH 2/4] mingw-w64: setup new defaults for target
runtime: compiler-rt
c++ lib: libc++
linker: lld
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index 61c559c..78fde9b 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -677,6 +677,15 @@ public:
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
+ RuntimeLibType GetDefaultRuntimeLibType() const override {
+ return RuntimeLibType::RLT_CompilerRT;
+ }
+
+ CXXStdlibType
+ GetCXXStdlibType(const llvm::opt::ArgList &Args) const override {
+ return ToolChain::CST_Libcxx;
+ }
+
protected:
Tool *getTool(Action::ActionClass AC) const override;
Tool *buildLinker() const override;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 4900e20..6673e78 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -10443,7 +10443,7 @@ void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// handled somewhere else.
Args.ClaimAllArgs(options::OPT_w);
- StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
+ StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "lld");
if (LinkerName.equals_lower("lld")) {
CmdArgs.push_back("-flavor");
CmdArgs.push_back("gnu");
--
2.8.3

View File

@@ -0,0 +1,25 @@
From 180bffbe07c0c43e7f103debc8d8d777cb027096 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
---
tools/libclang/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index 477e53dd15..dc2e3538fa 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -78,7 +78,7 @@ if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND (NOT MSVC))
set(ENABLE_STATIC STATIC)
endif()
-if(WIN32)
+if(MSVC)
set(output_name "libclang")
else()
set(output_name "clang")
--
2.12.0

View File

@@ -0,0 +1,32 @@
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

View File

@@ -1,49 +0,0 @@
From 5364db7f4d3f9204530f33a05388b6f54f515b21 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Fri, 5 Aug 2016 21:50:38 -0700
Subject: [PATCH 4/4] mingw-w64: support static builds of libc++
Static builds require libc++abi to be linked
Will add support for both modes in future
diff --git a/lib/Driver/MinGWToolChain.cpp b/lib/Driver/MinGWToolChain.cpp
index c5287bb..9090be5 100644
--- a/lib/Driver/MinGWToolChain.cpp
+++ b/lib/Driver/MinGWToolChain.cpp
@@ -242,3 +242,18 @@ void MinGW::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
break;
}
}
+
+void MinGW::AddCXXStdlibLibArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+ switch (GetCXXStdlibType(Args)) {
+ case ToolChain::CST_Libcxx:
+ CmdArgs.push_back("-lc++");
+ // Support only static libc++ for now
+ CmdArgs.push_back("-lc++abi");
+ break;
+
+ case ToolChain::CST_Libstdcxx:
+ CmdArgs.push_back("-lstdc++");
+ break;
+ }
+}
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index 78fde9b..d490969 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -673,6 +673,10 @@ public:
void
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
+
+ void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+ llvm::opt::ArgStringList &CmdArgs) const override;
+
void AddClangCXXStdlibIncludeArgs(
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
--
2.8.3

View File

@@ -1,14 +1,17 @@
From 57def79f5d6e97f5b353b22a5fb856e627cdf061 Mon Sep 17 00:00:00 2001
From 0e31fbf4e602f857cd33c1b5b446da354b64df11 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Sun, 28 Jun 2015 19:12:19 +0100
Subject: [PATCH] Set the x86 arch name to i686 for mingw-w64
Subject: [PATCH 5/9] 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 5451132..a6852b6 100644
index b8ae7e4c31..a76ef16c8a 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -1991,6 +1991,12 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple,
@@ -381,6 +381,11 @@ static llvm::Triple computeTargetTriple(const Driver &D,
if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
Target.setArch(AT);
@@ -17,10 +20,9 @@ index 5451132..a6852b6 100644
+ if (AT == llvm::Triple::x86 && Target.isWindowsGNUEnvironment() &&
+ Target.getVendorName().equals(StringRef("w64")))
+ Target.setArchName(StringRef("i686"));
+
}
return Target;
// Handle -miamcu flag.
--
2.4.5
2.12.0

View File

@@ -1,11 +0,0 @@
--- cfe-3.7.0.src/tools/libclang/CMakeLists.txt.orig 2015-12-25 10:56:22.521432100 +0300
+++ cfe-3.7.0.src/tools/libclang/CMakeLists.txt 2015-12-25 12:18:32.484593900 +0300
@@ -74,7 +74,7 @@
set(ENABLE_SHARED SHARED)
endif()
-if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32)
+if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND (NOT WIN32 OR MINGW))
set(ENABLE_STATIC STATIC)
endif()

View File

@@ -1,19 +0,0 @@
diff -urN cfe-3.9.0.src.orig/tools/libclang/CMakeLists.txt cfe-3.9.0.src/tools/libclang/CMakeLists.txt
--- cfe-3.9.0.src.orig/tools/libclang/CMakeLists.txt 2016-03-03 12:09:43.000000000 +0100
+++ cfe-3.9.0.src/tools/libclang/CMakeLists.txt 2016-09-26 19:40:33.887171200 +0200
@@ -97,6 +97,15 @@
Support
)
+if(MINGW)
+ set_target_properties(libclang
+ PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME clang
+ RUNTIME_OUTPUT_NAME libclang
+ ARCHIVE_OUTPUT_NAME clang)
+endif()
+
if(ENABLE_SHARED)
if(WIN32)
set_target_properties(libclang

View File

@@ -0,0 +1,26 @@
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

View File

@@ -1,21 +0,0 @@
From 12d299345b51c1686c1d82986de6de020970bb57 Mon Sep 17 00:00:00 2001
From: Alexey Pavlov <alexpux@gmail.com>
Date: Sun, 25 Dec 2015 20:14:51 +0100
Subject: [PATCH] Don't create cl executable for mingw
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index 671a8ce..45c47e1 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -66,7 +66,7 @@
if(NOT CLANG_LINKS_TO_CREATE)
set(CLANG_LINKS_TO_CREATE clang++ clang-cl)
- if (WIN32)
+ if (MSVC)
list(APPEND CLANG_LINKS_TO_CREATE ../msbuild-bin/cl)
endif()
endif()
--
2.4.5

View File

@@ -0,0 +1,35 @@
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

View File

@@ -0,0 +1,25 @@
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

View File

@@ -1,19 +0,0 @@
diff -urN cfe-3.9.0.src.orig/lib/Driver/MinGWToolChain.cpp cfe-3.9.0.src/lib/Driver/MinGWToolChain.cpp
--- cfe-3.9.0.src.orig/lib/Driver/MinGWToolChain.cpp 2016-01-12 11:41:20.000000000 +0100
+++ cfe-3.9.0.src/lib/Driver/MinGWToolChain.cpp 2016-11-14 10:19:31.658427300 +0100
@@ -201,6 +201,7 @@
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");
@@ -211,6 +212,7 @@
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");

View File

@@ -0,0 +1,26 @@
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

File diff suppressed because it is too large Load Diff

View File

@@ -1,32 +0,0 @@
diff -urN cfe-3.9.0.src.orig/lib/Driver/Tools.cpp cfe-3.9.0.src/lib/Driver/Tools.cpp
--- cfe-3.9.0.src.orig/lib/Driver/Tools.cpp 2016-08-13 22:43:56.000000000 +0200
+++ cfe-3.9.0.src/lib/Driver/Tools.cpp 2016-10-20 17:35:19.119164300 +0200
@@ -2608,7 +2608,7 @@
case llvm::Triple::wasm32:
case llvm::Triple::wasm64:
getWebAssemblyTargetFeatures(Args, Features);
- break;
+ break;
case llvm::Triple::sparc:
case llvm::Triple::sparcel:
case llvm::Triple::sparcv9:
@@ -5008,7 +5008,8 @@
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()
+ || getToolChain().getTriple().isWindowsGNUEnvironment();
if (Args.hasFlag(options::OPT_femulated_tls, options::OPT_fno_emulated_tls,
EmulatedTLSDefault))
CmdArgs.push_back("-femulated-tls");
@@ -10490,7 +10491,8 @@
if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back("-lgmon");
- if (Args.hasArg(options::OPT_pthread))
+ if (!Args.hasArg(options::OPT_no_pthread) &&
+ (TC.GetCXXStdlibType(Args) != ToolChain::CST_Libcxx))
CmdArgs.push_back("-lpthread");
// add system libraries

View File

@@ -1,54 +0,0 @@
From 3a07c87d4dc20c8d6b02a1d6cf38a5d1eb245a7f Mon Sep 17 00:00:00 2001
From: Benjamin Kramer <benny.kra@googlemail.com>
Date: Sun, 8 Jan 2017 22:58:07 +0000
Subject: [PATCH] Use the correct ObjC EH personality
This fixes ObjC exceptions on Win64 (which uses SEH), among others.
Patch by Jonathan Schleifer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291408 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/CodeGen/CGCleanup.h | 2 ++
lib/CodeGen/CGException.cpp | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/lib/CodeGen/CGCleanup.h b/lib/CodeGen/CGCleanup.h
index 2166490..105c562 100644
--- a/lib/CodeGen/CGCleanup.h
+++ b/lib/CodeGen/CGCleanup.h
@@ -616,6 +616,8 @@ struct EHPersonality {
static const EHPersonality GNU_C_SJLJ;
static const EHPersonality GNU_C_SEH;
static const EHPersonality GNU_ObjC;
+ static const EHPersonality GNU_ObjC_SJLJ;
+ static const EHPersonality GNU_ObjC_SEH;
static const EHPersonality GNUstep_ObjC;
static const EHPersonality GNU_ObjCXX;
static const EHPersonality NeXT_ObjC;
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 7b7880e..f908bf2 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -97,6 +97,10 @@ EHPersonality::GNU_CPlusPlus_SEH = { "__gxx_personality_seh0", nullptr };
const EHPersonality
EHPersonality::GNU_ObjC = {"__gnu_objc_personality_v0", "objc_exception_throw"};
const EHPersonality
+EHPersonality::GNU_ObjC_SJLJ = {"__gnu_objc_personality_sj0", "objc_exception_throw"};
+const EHPersonality
+EHPersonality::GNU_ObjC_SEH = {"__gnu_objc_personality_seh0", "objc_exception_throw"};
+const EHPersonality
EHPersonality::GNU_ObjCXX = { "__gnustep_objcxx_personality_v0", nullptr };
const EHPersonality
EHPersonality::GNUstep_ObjC = { "__gnustep_objc_personality_v0", nullptr };
@@ -137,6 +141,10 @@ static const EHPersonality &getObjCPersonality(const llvm::Triple &T,
// fallthrough
case ObjCRuntime::GCC:
case ObjCRuntime::ObjFW:
+ if (L.SjLjExceptions)
+ return EHPersonality::GNU_ObjC_SJLJ;
+ else if (useLibGCCSEHPersonality(T))
+ return EHPersonality::GNU_ObjC_SEH;
return EHPersonality::GNU_ObjC;
}
llvm_unreachable("bad runtime kind");

View File

@@ -0,0 +1,24 @@
From b65c6b61099d87369d756a4137ea731a3a45f192 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
---
lib/profile/InstrProfilingPort.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/profile/InstrProfilingPort.h b/lib/profile/InstrProfilingPort.h
index 578935195..3bda151ad 100644
--- a/lib/profile/InstrProfilingPort.h
+++ b/lib/profile/InstrProfilingPort.h
@@ -44,7 +44,7 @@
#define COMPILER_RT_GETHOSTNAME(Name, Len) ((void)(Name), (void)(Len), (-1))
#else
#define COMPILER_RT_GETHOSTNAME(Name, Len) lprofGetHostName(Name, Len)
-#ifndef _MSC_VER
+#ifndef _WIN32
#define COMPILER_RT_HAS_UNAME 1
#endif
#endif
--
2.11.1

View File

@@ -1,41 +0,0 @@
diff -urN compiler-rt-3.9.0.src.orig/lib/profile/InstrProfilingPort.h compiler-rt-3.9.0.src/lib/profile/InstrProfilingPort.h
--- compiler-rt-3.9.0.src.orig/lib/profile/InstrProfilingPort.h 2016-07-15 20:48:14.000000000 +0200
+++ compiler-rt-3.9.0.src/lib/profile/InstrProfilingPort.h 2016-09-23 00:20:25.833117600 +0200
@@ -10,7 +10,7 @@
#ifndef PROFILE_INSTRPROFILING_PORT_H_
#define PROFILE_INSTRPROFILING_PORT_H_
-#ifdef _MSC_VER
+#ifdef _WIN32
#define COMPILER_RT_ALIGNAS(x) __declspec(align(x))
#define COMPILER_RT_VISIBILITY
/* FIXME: selectany does not have the same semantics as weak. */
@@ -33,14 +33,14 @@
#define COMPILER_RT_SEG ""
#endif
-#ifdef _MSC_VER
+#ifdef _WIN32
#define COMPILER_RT_SECTION(Sect) __declspec(allocate(Sect))
#else
#define COMPILER_RT_SECTION(Sect) __attribute__((section(Sect)))
#endif
#define COMPILER_RT_MAX_HOSTLEN 128
-#ifdef _MSC_VER
+#ifdef _WIN32
#define COMPILER_RT_GETHOSTNAME(Name, Len) gethostname(Name, Len)
#elif defined(__ORBIS__)
#define COMPILER_RT_GETHOSTNAME(Name, Len) ((void)(Name), (void)(Len), (-1))
@@ -50,9 +50,9 @@
#endif
#if COMPILER_RT_HAS_ATOMICS == 1
-#ifdef _MSC_VER
+#ifdef _WIN32
#include <windows.h>
-#if _MSC_VER < 1900
+#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if defined(_WIN64)

View File

@@ -1,172 +0,0 @@
From 1bfb013604fbda1cdabf941ee1cef05105c09508 Mon Sep 17 00:00:00 2001
From: Pavel Labath <labath@google.com>
Date: Mon, 9 Jan 2017 09:57:08 +0000
Subject: [PATCH] [lld][cmake] Fix LLVM_LINK_LLVM_DYLIB build
Summary:
Lld's build had a couple of issues which prevented a successfull
LLVM_LINK_LLVM_DYLIB compilation.
- add_llvm_library vs llvm_add_library: One adds a library to libLLVM.so, other
one doesn't. Lld was using the wrong one, causing symbols to be mupltiply
defined in things linking to libLLVM.
- confusion when to use LINK_LIBS vs LINK_COMPONENTS in llvm_add_library
- not using LLVM_LINK_COMPONENTS for add_lld_tool
With these fixes lld compiles and it's test suite passes both in
LLVM_LINK_LLVM_DYLIB mode and without it.
Reviewers: ruiu, beanz
Subscribers: llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D28397
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@291432 91177308-0d34-0410-b5e6-96231b3b80d8
---
cmake/modules/AddLLD.cmake | 2 +-
lib/Config/CMakeLists.txt | 4 ++--
lib/Core/CMakeLists.txt | 4 ++--
lib/Driver/CMakeLists.txt | 8 +++++---
lib/ReaderWriter/CMakeLists.txt | 6 ++++--
lib/ReaderWriter/MachO/CMakeLists.txt | 11 +++++++----
lib/ReaderWriter/YAML/CMakeLists.txt | 5 ++++-
tools/lld/CMakeLists.txt | 5 ++++-
8 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
index 752ca7f..906b295 100644
--- a/cmake/modules/AddLLD.cmake
+++ b/cmake/modules/AddLLD.cmake
@@ -1,5 +1,5 @@
macro(add_lld_library name)
- add_llvm_library(${name} ${ARGN})
+ llvm_add_library(${name} ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
endmacro(add_lld_library)
diff --git a/lib/Config/CMakeLists.txt b/lib/Config/CMakeLists.txt
index e971b0b..3e142b6 100644
--- a/lib/Config/CMakeLists.txt
+++ b/lib/Config/CMakeLists.txt
@@ -4,6 +4,6 @@ add_lld_library(lldConfig
ADDITIONAL_HEADER_DIRS
${LLD_INCLUDE_DIR}/lld/Config
- LINK_LIBS
- LLVMSupport
+ LINK_COMPONENTS
+ Support
)
diff --git a/lib/Core/CMakeLists.txt b/lib/Core/CMakeLists.txt
index d89ca4a..7f4c47f 100644
--- a/lib/Core/CMakeLists.txt
+++ b/lib/Core/CMakeLists.txt
@@ -12,6 +12,6 @@ add_lld_library(lldCore
ADDITIONAL_HEADER_DIRS
${LLD_INCLUDE_DIR}/lld/Core
- LINK_LIBS
- LLVMSupport
+ LINK_COMPONENTS
+ Support
)
diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt
index 1bd1f21..be75872 100644
--- a/lib/Driver/CMakeLists.txt
+++ b/lib/Driver/CMakeLists.txt
@@ -8,15 +8,17 @@ add_lld_library(lldDriver
ADDITIONAL_HEADER_DIRS
${LLD_INCLUDE_DIR}/lld/Driver
+ LINK_COMPONENTS
+ Object
+ Option
+ Support
+
LINK_LIBS
lldConfig
lldMachO
lldCore
lldReaderWriter
lldYAML
- LLVMObject
- LLVMOption
- LLVMSupport
)
add_dependencies(lldDriver DriverOptionsTableGen)
diff --git a/lib/ReaderWriter/CMakeLists.txt b/lib/ReaderWriter/CMakeLists.txt
index 4408d9c..8751d56 100644
--- a/lib/ReaderWriter/CMakeLists.txt
+++ b/lib/ReaderWriter/CMakeLists.txt
@@ -11,9 +11,11 @@ add_lld_library(lldReaderWriter
ADDITIONAL_HEADER_DIRS
${LLD_INCLUDE_DIR}/lld/ReaderWriter
+ LINK_COMPONENTS
+ Object
+ Support
+
LINK_LIBS
lldCore
lldYAML
- LLVMObject
- LLVMSupport
)
diff --git a/lib/ReaderWriter/MachO/CMakeLists.txt b/lib/ReaderWriter/MachO/CMakeLists.txt
index 6a1064d..3b06985 100644
--- a/lib/ReaderWriter/MachO/CMakeLists.txt
+++ b/lib/ReaderWriter/MachO/CMakeLists.txt
@@ -18,11 +18,14 @@ add_lld_library(lldMachO
StubsPass.cpp
TLVPass.cpp
WriterMachO.cpp
+
+ LINK_COMPONENTS
+ Object
+ Support
+
LINK_LIBS
lldCore
lldYAML
- LLVMObject
- LLVMSupport
${PTHREAD_LIB}
)
diff --git a/lib/ReaderWriter/YAML/CMakeLists.txt b/lib/ReaderWriter/YAML/CMakeLists.txt
index 5c25444..0e63574 100644
--- a/lib/ReaderWriter/YAML/CMakeLists.txt
+++ b/lib/ReaderWriter/YAML/CMakeLists.txt
@@ -1,6 +1,9 @@
add_lld_library(lldYAML
ReaderWriterYAML.cpp
+
+ LINK_COMPONENTS
+ Support
+
LINK_LIBS
lldCore
- LLVMSupport
)
diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
index 0c946a3..2df1069 100644
--- a/tools/lld/CMakeLists.txt
+++ b/tools/lld/CMakeLists.txt
@@ -1,3 +1,7 @@
+set(LLVM_LINK_COMPONENTS
+ Support
+ )
+
add_lld_tool(lld
lld.cpp
)
@@ -6,7 +10,6 @@ target_link_libraries(lld
lldDriver
lldCOFF
lldELF
- LLVMSupport
)
install(TARGETS lld

View File

@@ -1,124 +1,156 @@
From 57d48bf47108014aa5e0c5435c107581e86e3045 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Sat, 6 Aug 2016 03:54:22 -0700
Subject: [PATCH] mingw-w64 hack and slash fixes for libc++
From b45cafc920b84ea40f9760266473c0da2260c58e 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
CMAKE_HOST_WIN32 change can be upstreamed in a different patch
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(-)
This is very hacky but gets libcxx to compile
Make sure you only install the headers after building
Will need to run the test suite and do more work here
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 219d1b7..2a9337f 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -27,7 +27,7 @@ if (LIBCXX_INSTALL_HEADERS)
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)
if (LIBCXX_NEEDS_SITE_CONFIG)
set(UNIX_CAT cat)
- if (WIN32)
+ if (CMAKE_HOST_WIN32)
set(UNIX_CAT type)
endif()
# Generate and install a custom __config header. The new header is created
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 353ca10..b58c350 100644
index 340c573..db9b74a 100644
--- a/include/__config
+++ b/include/__config
@@ -152,6 +152,8 @@
# // If mingw not explicitly detected, assume using MS C runtime only.
# ifndef __MINGW32__
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
+# else
+# define _LIBCPP_HAS_NO_CONSTEXPR
# endif
#endif // _WIN32
@@ -177,7 +179,7 @@
@@ -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(_WIN32)
-#elif defined(_LIBCPP_WIN32API)
+#elif defined(_MSC_VER)
# define _LIBCPP_USING_WIN32_RANDOM
#else
# define _LIBCPP_USING_DEV_RANDOM
@@ -831,7 +833,8 @@ extern "C" void __sanitizer_annotate_contiguous_container(
@@ -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
# else
# error "No thread API"
# 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 7f3710e..d167309 100644
index ebf5bda..525cfc7 100644
--- a/include/support/win32/locale_win32.h
+++ b/include/support/win32/locale_win32.h
@@ -64,6 +64,15 @@ isupper_l(int c, _locale_t loc)
return _isupper_l((int)c, loc);
}
+#define open _open
+#define close _close
+#define read _read
+
+#define strtod_l _strtod_l
+
+// TODO: add _strtof_l to mingw-w64
+#define strtof_l _strtod_l
+
#define isdigit_l _isdigit_l
#define isxdigit_l _isxdigit_l
#define strcoll_l _strcoll_l
@@ -93,6 +102,33 @@ int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...);
int asprintf_l( char **ret, locale_t loc, const char *format, ... );
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
@@ -11,7 +11,11 @@
#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
+#ifdef __MINGW32__
+
+// Stubs
+inline _locale_t _get_current_locale(void) {
+ return NULL;
+}
+
+inline _locale_t _create_locale(int _Category,const char *_Locale) {
+ _locale_t loc;
+ return loc;
+}
+//extern "C" void _free_locale(_locale_t _Locale) {}
+//void __cdecl _free_locale(_locale_t _Locale);
+//inline _locale_t _free_locale(_locale_t _Locale) {
+// _locale_t loc;
+// return loc;
+//}
+
+
+#include <time.h>
+
+inline size_t _strftime_l(char* s, size_t n, const char * f, const struct tm * tm, _locale_t l)
+{
+ return strftime(s, n, f, tm);
+}
+
+#define _VC_CRT_MAJOR_VERSION 6
+#else
#include <crtversion.h>
+#endif
// not-so-pressing FIXME: use locale to determine blank characters
inline int isblank_l( int c, locale_t /*loc*/ )
@@ -104,7 +140,7 @@ inline int iswblank_l( wint_t c, locale_t /*loc*/ )
return ( c == L' ' || c == L'\t' );
#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
}
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
inline int isblank( int c, locale_t /*loc*/ )
{ return ( c == ' ' || c == '\t' ); }
inline int iswblank( wint_t c, locale_t /*loc*/ )
+#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 5765bab..4955b3a 100644
index f961344..501cd06 100644
--- a/include/support/win32/support.h
+++ b/include/support/win32/support.h
@@ -37,12 +37,13 @@ extern "C" {
@@ -126,7 +158,7 @@ index 5765bab..4955b3a 100644
int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
int asprintf(char **sptr, const char *__restrict fmt, ...);
+}
+#endif // __MINGW32__
+#endif
+
size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
size_t nmc, size_t len, mbstate_t *__restrict ps);
@@ -135,102 +167,69 @@ index 5765bab..4955b3a 100644
-}
-#endif // __MINGW32__
#if defined(_LIBCPP_MSVCRT)
#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14
#define snprintf _snprintf
diff --git a/include/type_traits b/include/type_traits
index 0d578bb..88dfd99 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -1671,7 +1671,7 @@ _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);
// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000)
-#if !defined(_LIBCPP_MSVC)
+#if !defined(_LIBCPP_MSVC) && !defined(__MINGW32__)
_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000);
#endif // !_LIBCPP_MSVC
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index cabf2e6..8729707 100644
index cc3ed16..3c2716f 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -33,9 +33,11 @@ add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}"
add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+if(NOT MINGW)
add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,--whole-archive" "-Wl,-Bstatic")
add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,-Bdynamic" "-Wl,--no-whole-archive")
+endif()
if (APPLE AND LLVM_USE_SANITIZER)
if ("${LLVM_USE_SANITIZER}" STREQUAL "Address")
@@ -71,9 +73,14 @@ add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
-# Setup flags.
add_flags_if_supported(-fPIC)
-add_link_flags_if_supported(-nodefaultlibs)
+
+# Setup flags.
+if (NOT MINGW)
@@ -101,8 +101,8 @@ endif()
# Setup flags.
if (NOT WIN32)
add_flags_if_supported(-fPIC)
+ add_link_flags_if_supported(-nodefaultlibs)
+else()
+ add_library_flags(-lc++abi)
+endif()
endif()
-add_link_flags_if_supported(-nodefaultlibs)
if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"))
if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY)
if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION)
diff --git a/src/locale.cpp b/src/locale.cpp
index da2fd11..03696a7 100644
index 338ffde..5c44346 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -26,9 +26,9 @@
#include "cstring"
#include "cwctype"
#include "__sso_allocator"
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+#if defined(_LIBCPP_MSVCRT)
#include "support/win32/locale_win32.h"
-#elif !defined(__ANDROID__)
+#elif !defined(__ANDROID__) && !defined(__MINGW32__)
#include <langinfo.h>
@@ -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
#include <stdlib.h>
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 5a43743..b220afe 100644
index ee13811..f6ac5ed 100644
--- a/src/support/win32/locale_win32.cpp
+++ b/src/support/win32/locale_win32.cpp
@@ -8,6 +8,11 @@
//
//===----------------------------------------------------------------------===//
@@ -13,7 +13,11 @@
#include <memory>
#include <type_traits>
+#ifdef __MINGW32__
+#define _GNU_SOURCE
+#include <support/win32/support.h>
+#define _VC_CRT_MAJOR_VERSION 6
+#else
#include <crtversion.h>
+#endif
+
#include <locale>
#include <cstdarg> // va_start, va_end
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..0d60ef4 100644
index e989681..0628767 100644
--- a/src/support/win32/support.cpp
+++ b/src/support/win32/support.cpp
@@ -8,6 +8,10 @@
//
//===----------------------------------------------------------------------===//
+#ifdef __MINGW32__
+#define _GNU_SOURCE
+#endif
+
#include <cstdarg> // va_start, va_end
#include <cstddef> // size_t
#include <cstdlib> // malloc
@@ -17,6 +21,7 @@
@@ -17,6 +17,7 @@
// Some of these functions aren't standard or if they conform, the name does not.
@@ -238,7 +237,7 @@ index e989681..0d60ef4 100644
int asprintf(char **sptr, const char *__restrict format, ...)
{
va_list ap;
@@ -51,6 +56,7 @@ int vasprintf( char **sptr, const char *__restrict format, va_list ap )
@@ -51,6 +52,7 @@ int vasprintf( char **sptr, const char *__restrict format, va_list ap )
*sptr = p;
return count;
}
@@ -247,22 +246,17 @@ index e989681..0d60ef4 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 87f35ae..fdd56ea 100644
index c547124..42171ef 100644
--- a/src/system_error.cpp
+++ b/src/system_error.cpp
@@ -70,6 +70,12 @@ string do_strerror_r(int ev) {
char* ret = ::strerror_r(ev, buffer, strerror_buff_size);
return string(ret);
}
+#elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+string do_strerror_r(int ev) {
+ char buffer[strerror_buff_size];
+ std::snprintf(buffer, strerror_buff_size, "Win32 Unsupported %d", ev);
+ return string(buffer);
+}
#else
// POSIX version
@@ -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.8.3
2.12.0

View File

@@ -1,29 +0,0 @@
diff -urN libcxx-3.9.0.origlibcxx/include/__config libcxx-3.9.0libcxx/include/__config
--- libcxx-3.9.0.origlibcxx/include/__config 2016-09-21 16:28:09.452978000 +0200
+++ libcxx-3.9.0libcxx/include/__config 2016-09-25 01:19:05.170475000 +0200
@@ -150,8 +150,6 @@
# // If mingw not explicitly detected, assume using MS C runtime only.
# ifndef __MINGW32__
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
-# else
-# define _LIBCPP_HAS_NO_CONSTEXPR
# endif
#endif // _WIN32
@@ -496,8 +494,14 @@
#endif
// Determine if GCC supports relaxed constexpr
-#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
-#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+// GCC 6.X is retarded, it thinks it supports __cpp_constexpr 201304 but ...
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297
+#if defined(__clang__) || __GNUC__ > 6
+# if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
+# define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+# endif
+#elif defined(__GNUC__)
+# define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#endif
// GCC 5 will support variable templates

View File

@@ -1,256 +0,0 @@
diff -urN lldb-3.9.0.src.orig/cmake/LLDBDependencies.cmake lldb-3.9.0.src/cmake/LLDBDependencies.cmake
--- lldb-3.9.0.src.orig/cmake/LLDBDependencies.cmake 2016-06-29 14:30:18.000000000 +0200
+++ lldb-3.9.0.src/cmake/LLDBDependencies.cmake 2016-11-06 12:57:45.641325900 +0100
@@ -92,6 +92,7 @@
lldbPluginProcessWindowsCommon
Ws2_32
Rpcrt4
+ dbghelp
)
endif ()
diff -urN lldb-3.9.0.src.orig/cmake/modules/LLDBConfig.cmake lldb-3.9.0.src/cmake/modules/LLDBConfig.cmake
--- lldb-3.9.0.src.orig/cmake/modules/LLDBConfig.cmake 2016-05-26 18:11:04.000000000 +0200
+++ lldb-3.9.0.src/cmake/modules/LLDBConfig.cmake 2016-11-06 17:50:27.409562300 +0100
@@ -248,8 +248,10 @@
endif()
# Use the Unicode (UTF-16) APIs by default on Win32
-if (CMAKE_SYSTEM_NAME MATCHES "Windows")
- add_definitions( /D _UNICODE /D UNICODE )
+if (MSVC)
+ add_definitions( /D _UNICODE /D UNICODE )
+elseif (WIN32)
+ add_definitions( -municode )
endif()
set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
diff -urN lldb-3.9.0.src.orig/include/lldb/Host/windows/win32.h lldb-3.9.0.src/include/lldb/Host/windows/win32.h
--- lldb-3.9.0.src.orig/include/lldb/Host/windows/win32.h 2015-08-20 22:53:15.000000000 +0200
+++ lldb-3.9.0.src/include/lldb/Host/windows/win32.h 2016-11-06 12:57:45.653320700 +0100
@@ -14,7 +14,9 @@
#include <time.h>
// posix utilities
+#ifndef __MINGW64_VERSION_MAJOR
int vasprintf(char **ret, const char *fmt, va_list ap);
+#endif
char * strcasestr(const char *s, const char* find);
char* realpath(const char * name, char * resolved);
@@ -33,6 +35,7 @@
# define S_IWUSR S_IWRITE /* write, user */
# define S_IXUSR 0 /* execute, user */
#endif
+#ifndef __MINGW64_VERSION_MAJOR
#define S_IRGRP 0 /* read, group */
#define S_IWGRP 0 /* write, group */
#define S_IXGRP 0 /* execute, group */
@@ -42,6 +45,7 @@
#define S_IRWXU 0
#define S_IRWXG 0
#define S_IRWXO 0
+#endif // __MINGW64_VERSION_MAJOR
#ifdef _MSC_VER
@@ -93,7 +97,7 @@
// timespec
// MSVC 2015 and higher have timespec. Otherwise we need to define it ourselves.
-#if defined(_MSC_VER) && _MSC_VER >= 1900
+#if defined(_MSC_VER) && _MSC_VER >= 1900 || defined(__MINGW64_VERSION_MAJOR)
#include <time.h>
#else
struct timespec
diff -urN lldb-3.9.0.src.orig/include/lldb/lldb-defines.h lldb-3.9.0.src/include/lldb/lldb-defines.h
--- lldb-3.9.0.src.orig/include/lldb/lldb-defines.h 2015-07-24 02:23:29.000000000 +0200
+++ lldb-3.9.0.src/include/lldb/lldb-defines.h 2016-11-06 15:22:20.184084400 +0100
@@ -12,7 +12,7 @@
#include "lldb/lldb-types.h"
-#if defined (_MSC_VER)
+#if defined (_WIN32)
#if defined(EXPORT_LIBLLDB)
#define LLDB_API __declspec(dllexport)
#elif defined(IMPORT_LIBLLDB)
@@ -20,7 +20,7 @@
#else
#define LLDB_API
#endif
-#else // defined (_MSC_VER)
+#else // defined (_WIN32)
#define LLDB_API
#endif
diff -urN lldb-3.9.0.src.orig/include/lldb/Utility/TaskPool.h lldb-3.9.0.src/include/lldb/Utility/TaskPool.h
--- lldb-3.9.0.src.orig/include/lldb/Utility/TaskPool.h 2015-11-03 23:29:20.000000000 +0100
+++ lldb-3.9.0.src/include/lldb/Utility/TaskPool.h 2016-11-06 12:57:45.664322400 +0100
@@ -29,6 +29,7 @@
#include <cassert>
#include <cstdint>
#include <future>
+#include <functional>
#include <list>
#include <queue>
#include <thread>
diff -urN lldb-3.9.0.src.orig/source/API/CMakeLists.txt lldb-3.9.0.src/source/API/CMakeLists.txt
--- lldb-3.9.0.src.orig/source/API/CMakeLists.txt 2016-06-23 10:35:37.000000000 +0200
+++ lldb-3.9.0.src/source/API/CMakeLists.txt 2016-11-06 12:57:45.670323200 +0100
@@ -101,7 +101,7 @@
endif()
endif()
-if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT MINGW )
# Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
# so only it needs to explicitly link against ${PYTHON_LIBRARY}
if (MSVC AND NOT LLDB_DISABLE_PYTHON)
diff -urN lldb-3.9.0.src.orig/source/Host/common/File.cpp lldb-3.9.0.src/source/Host/common/File.cpp
--- lldb-3.9.0.src.orig/source/Host/common/File.cpp 2016-08-12 20:10:54.000000000 +0200
+++ lldb-3.9.0.src/source/Host/common/File.cpp 2016-11-06 12:57:45.676322400 +0100
@@ -17,6 +17,7 @@
#ifdef _WIN32
#include "lldb/Host/windows/windows.h"
+#include <share.h>
#else
#include <sys/ioctl.h>
#endif
diff -urN lldb-3.9.0.src.orig/source/Host/windows/ProcessRunLock.cpp lldb-3.9.0.src/source/Host/windows/ProcessRunLock.cpp
--- lldb-3.9.0.src.orig/source/Host/windows/ProcessRunLock.cpp 2015-05-15 00:50:19.000000000 +0200
+++ lldb-3.9.0.src/source/Host/windows/ProcessRunLock.cpp 2016-11-06 12:57:45.685323900 +0100
@@ -3,7 +3,7 @@
namespace
{
-#if defined(__MINGW32__)
+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
// Taken from WinNT.h
typedef struct _RTL_SRWLOCK {
PVOID Ptr;
diff -urN lldb-3.9.0.src.orig/source/Host/windows/Windows.cpp lldb-3.9.0.src/source/Host/windows/Windows.cpp
--- lldb-3.9.0.src.orig/source/Host/windows/Windows.cpp 2016-04-19 03:09:37.000000000 +0200
+++ lldb-3.9.0.src/source/Host/windows/Windows.cpp 2016-11-06 12:57:45.690322800 +0100
@@ -53,6 +53,7 @@
}
}
+#ifndef __MINGW64_VERSION_MAJOR
int vasprintf(char **ret, const char *fmt, va_list ap)
{
char *buf;
@@ -79,6 +80,7 @@
va_end(ap2);
return len;
}
+#endif //__MINGW64_VERSION_MAJOR
char* strcasestr(const char *s, const char* find)
{
diff -urN lldb-3.9.0.src.orig/source/Symbol/ClangASTContext.cpp lldb-3.9.0.src/source/Symbol/ClangASTContext.cpp
--- lldb-3.9.0.src.orig/source/Symbol/ClangASTContext.cpp 2016-07-14 21:31:18.000000000 +0200
+++ lldb-3.9.0.src/source/Symbol/ClangASTContext.cpp 2016-11-06 12:57:45.699323500 +0100
@@ -4903,7 +4903,6 @@
case clang::BuiltinType::Half:
case clang::BuiltinType::Float:
- case clang::BuiltinType::Float128:
case clang::BuiltinType::Double:
case clang::BuiltinType::LongDouble:
return lldb::eEncodingIEEE754;
diff -urN lldb-3.9.0.src.orig/source/Target/ProcessLaunchInfo.cpp lldb-3.9.0.src/source/Target/ProcessLaunchInfo.cpp
--- lldb-3.9.0.src.orig/source/Target/ProcessLaunchInfo.cpp 2016-05-11 18:59:04.000000000 +0200
+++ lldb-3.9.0.src/source/Target/ProcessLaunchInfo.cpp 2016-11-06 12:57:45.708324500 +0100
@@ -362,7 +362,7 @@
__FUNCTION__);
int open_flags = O_RDWR | O_NOCTTY;
-#if !defined(_MSC_VER)
+#if !defined(_WIN32)
// We really shouldn't be specifying platform specific flags
// that are intended for a system call in generic code. But
// this will have to do for now.
diff -urN lldb-3.9.0.src.orig/source/Utility/PseudoTerminal.cpp lldb-3.9.0.src/source/Utility/PseudoTerminal.cpp
--- lldb-3.9.0.src.orig/source/Utility/PseudoTerminal.cpp 2015-05-12 03:10:56.000000000 +0200
+++ lldb-3.9.0.src/source/Utility/PseudoTerminal.cpp 2016-11-06 12:57:45.728347300 +0100
@@ -20,7 +20,11 @@
#ifdef _WIN32
#include "lldb/Host/windows/win32.h"
+
+#ifndef __MINGW64_VERSION_MAJOR
typedef uint32_t pid_t;
+#endif
+
// empty functions
int posix_openpt(int flag) { return 0; }
@@ -364,4 +368,3 @@
m_slave_fd = invalid_fd;
return fd;
}
-
diff -urN lldb-3.9.0.src.orig/tools/driver/Driver.cpp lldb-3.9.0.src/tools/driver/Driver.cpp
--- lldb-3.9.0.src.orig/tools/driver/Driver.cpp 2016-04-15 01:31:17.000000000 +0200
+++ lldb-3.9.0.src/tools/driver/Driver.cpp 2016-11-06 17:01:16.257838300 +0100
@@ -1308,13 +1308,13 @@
}
int
-#ifdef WIN32
+#ifdef MSVC
wmain(int argc, wchar_t const *wargv[])
#else
main(int argc, char const *argv[])
#endif
{
-#ifdef _WIN32
+#ifdef MSVC
// Convert wide arguments to UTF-8
std::vector<std::string> argvStrings(argc);
std::vector<const char *> argvPointers(argc);
diff -urN lldb-3.9.0.src.orig/tools/lldb-mi/MIDataTypes.h lldb-3.9.0.src/tools/lldb-mi/MIDataTypes.h
--- lldb-3.9.0.src.orig/tools/lldb-mi/MIDataTypes.h 2015-07-21 13:27:40.000000000 +0200
+++ lldb-3.9.0.src/tools/lldb-mi/MIDataTypes.h 2016-11-06 12:57:45.745348400 +0100
@@ -40,12 +40,12 @@
#define MIunused(x) (void) x;
// Portability issues
-#ifdef _WIN64
+#if defined(_WIN64) && defined(_MSC_VER)
typedef unsigned __int64 size_t;
typedef __int64 MIint;
typedef unsigned __int64 MIuint;
#else
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
typedef unsigned int size_t;
typedef int MIint;
typedef unsigned int MIuint;
@@ -53,7 +53,10 @@
typedef int MIint;
typedef unsigned int MIuint;
+#ifndef __MINGW32__
#define MAX_PATH 4096
+#endif
+
#endif // _WIN32
#endif // _WIN64
diff -urN lldb-3.9.0.src.orig/tools/lldb-mi/Platform.h lldb-3.9.0.src/tools/lldb-mi/Platform.h
--- lldb-3.9.0.src.orig/tools/lldb-mi/Platform.h 2016-03-22 18:58:09.000000000 +0100
+++ lldb-3.9.0.src/tools/lldb-mi/Platform.h 2016-11-06 12:57:45.750349300 +0100
@@ -86,8 +86,10 @@
#include <getopt.h>
#include <libgen.h>
+#ifndef __MINGW64_VERSION_MAJOR
#include <sys/ioctl.h>
#include <termios.h>
+#endif // __MINGW64_VERSION_MAJOR
#include <unistd.h>
#include <pthread.h>

View File

@@ -0,0 +1,130 @@
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

View File

@@ -2,11 +2,11 @@ diff -urN lldb-3.9.0.src.orig/source/Host/windows/FileSystem.cpp lldb-3.9.0.src/
--- 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;
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);
struct _stat32 file_stats;
stat_result = ::_wstat32(wpath.c_str(), &file_stats);
#else

View File

@@ -1,14 +1,20 @@
From 81b5dabfed88d2976faf587598361c054630ef95 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Tue, 21 Jul 2015 04:35:55 +0100
From dfe4f4533d720f2e057f35b104b3fd50cf9d0f32 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(-)
diff --git a/include/unwind.h b/include/unwind.h
index 31fb871..e8c63d7 100644
index 1d163ca..e54f39d 100644
--- a/include/unwind.h
+++ b/include/unwind.h
@@ -121,7 +121,7 @@ struct _Unwind_Exception {
@@ -122,7 +122,7 @@ struct _Unwind_Exception {
_Unwind_Exception *exc);
uintptr_t private_1; // non-zero means forced unwind
uintptr_t private_2; // holds sp that phase1 found for phase2 to use
@@ -18,7 +24,7 @@ index 31fb871..e8c63d7 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 567cbda..fd0b233 100644
index 67aa664..f61e620 100644
--- a/src/AddressSpace.hpp
+++ b/src/AddressSpace.hpp
@@ -18,7 +18,7 @@
@@ -30,7 +36,7 @@ index 567cbda..fd0b233 100644
#include <dlfcn.h>
#endif
@@ -104,7 +104,7 @@ struct UnwindInfoSections {
@@ -109,7 +109,7 @@ struct UnwindInfoSections {
/// making local unwinds fast.
class __attribute__((visibility("hidden"))) LocalAddressSpace {
public:
@@ -39,7 +45,7 @@ index 567cbda..fd0b233 100644
typedef uint64_t pint_t;
typedef int64_t sint_t;
#else
@@ -156,7 +156,7 @@ public:
@@ -161,7 +161,7 @@ public:
};
inline uintptr_t LocalAddressSpace::getP(pint_t addr) {
@@ -48,7 +54,32 @@ index 567cbda..fd0b233 100644
return get64(addr);
#else
return get32(addr);
@@ -434,6 +434,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
@@ -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.
Dl_info dlinfo;
if (!dladdr(addr, &dlinfo))
return false;
-#if __LP64__
+#if defined(__LP64__) || defined(_WIN64)
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);
@@ -56,32 +87,17 @@ index 567cbda..fd0b233 100644
#else
#error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires _LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
#endif
@@ -457,7 +458,9 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
@@ -468,7 +469,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) {
-#ifndef _LIBUNWIND_IS_BAREMETAL
+#ifdef _WIN32
+// FIXME: support DLLs on Windows.
+#elif !defined(_LIBUNWIND_IS_BAREMETAL)
+#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
Dl_info dyldInfo;
if (dladdr((void *)addr, &dyldInfo)) {
if (dyldInfo.dli_sname != NULL) {
diff --git a/src/UnwindLevel1-gcc-ext.c b/src/UnwindLevel1-gcc-ext.c
index 28ba092..0decf77 100644
--- a/src/UnwindLevel1-gcc-ext.c
+++ b/src/UnwindLevel1-gcc-ext.c
@@ -29,7 +29,7 @@
_LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
#if _LIBUNWIND_ARM_EHABI
- _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n",
+ _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%" PRIdPTR "\n",
(void *)exception_object,
(long)exception_object->unwinder_cache.reserved1);
#else
diff --git a/src/assembly.h b/src/assembly.h
index f46a24d..4d6c3e1 100644
index 9fb9905..6391f22 100644
--- a/src/assembly.h
+++ b/src/assembly.h
@@ -26,6 +26,8 @@
@@ -94,10 +110,10 @@ index f46a24d..4d6c3e1 100644
#define HIDDEN_DIRECTIVE .hidden
#endif
diff --git a/src/config.h b/src/config.h
index c9ec087..6f14e92 100644
index 4e4dd99..f6002af 100644
--- a/src/config.h
+++ b/src/config.h
@@ -39,6 +39,16 @@
@@ -40,6 +40,16 @@
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
#endif
@@ -114,7 +130,7 @@ index c9ec087..6f14e92 100644
#else
#if defined(__ARM_DWARF_EH__) || !defined(__arm__)
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
@@ -51,9 +51,13 @@
@@ -52,9 +62,13 @@
#endif
#endif
@@ -130,5 +146,5 @@ index c9ec087..6f14e92 100644
#if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
#define _LIBUNWIND_BUILD_SJLJ_APIS 1
--
2.4.5
2.12.0

View File

@@ -0,0 +1,36 @@
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

View File

@@ -18,17 +18,14 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-lld"
"${MINGW_PACKAGE_PREFIX}-libunwind"
"${MINGW_PACKAGE_PREFIX}-llvm"
"${MINGW_PACKAGE_PREFIX}-lldb"
)
pkgver=3.9.1
pkgrel=3
"${MINGW_PACKAGE_PREFIX}-lldb")
pkgver=4.0.0
pkgrel=1
pkgdesc="C language family frontend for LLVM (mingw-w64)"
arch=('any')
url="http://llvm.org"
license=("custom:University of Illinois/NCSA Open Source License")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
$([[ "$_compiler" == "gcc" ]] && echo \
"${MINGW_PACKAGE_PREFIX}-gcc")
$([[ "$_compiler" == "clang" ]] && echo \
"${MINGW_PACKAGE_PREFIX}-clang")
"${MINGW_PACKAGE_PREFIX}-libffi"
@@ -50,95 +47,84 @@ source=(http://llvm.org/releases/${pkgver}/llvm-${pkgver}.src.tar.xz{,.sig}
http://llvm.org/releases/${pkgver}/lldb-${pkgver}.src.tar.xz{,.sig}
http://llvm.org/releases/${pkgver}/libunwind-${pkgver}.src.tar.xz{,.sig}
"0001-genlib-named-as-llvm-dlltool.patch"
"0002-COFF-Fix-short-import-lib-import-name-type-bitshift.patch"
"0003-mingw-w64-use-MSVC-style-ByteAlignment.patch"
"0004-killthedoctor-mingw.patch"
"0005-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
"0006-use-DESTDIR-on-windows.patch"
"0007-fix-llvm-shlib-cmake-build.patch"
"0008-not-install-msvc-files.patch"
"0009-fix-llvm-config-shared-lib-version-on-win32.patch"
"0101-Revert-Revert-r253898-and-r253899-this-breaks-mingw-.patch"
"0102-mingw-w64-setup-new-defaults-for-target.patch"
"0103-mingw-w64-enable-support-for-__declspec-selectany.patch"
"0104-mingw-w64-support-static-builds-of-libc.patch"
"0105-mingw-enable-static-libclang.patch"
"0106-generate-libclang-instead-of-liblibclang.patch"
"0107-dont-create-cl-mingw.patch"
"0108-dont-use-gcc-headers.patch"
"0109-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
"0110-enable-support-for-float128.patch"
"0111-fix-clang-with-libstdc.patch"
"0112-objc-eh-personality.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"
"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"
"0201-mingw-w64-__udivdi3-mangle-hack.patch"
"0202-mingw-fixes-for-compiler-rt.patch"
"0202-compiler-rt-fix-mingw-build.patch"
"0301-COFF-gnu-driver-support.patch"
"0302-add-install-target-for-the-lld-tool.patch"
"0303-Fix-LLVM_LINK_LLVM_DYLIB-build.patch"
"0401-mingw-w64-hack-and-slash-fixes-for-libc.patch"
"0402-fix-compilation-with-gcc.patch"
"0501-lldb-mingw-fixes.patch"
"0501-minor-fixes-to-get-lldb-building.patch"
"0502-hack-to-use-64-bit-time-for-mingw.patch"
"0601-libunwind-add-support-for-mingw-w64.patch")
"0601-libunwind-add-support-for-mingw-w64.patch"
"0701-fix-visibility-for-libc-abi-on-win32.patch")
# Some patch notes :)
#0001-0099 -> llvm
#0101-0199 -> clang
#0201-0299 -> rt
#0301-0399 -> lld
#0401-0499 -> c++
#0401-0499 -> libc++
#0501-0599 -> lldb
#0601-0699 -> libunwind
sha256sums=('1fd90354b9cf19232e8f168faf2220e79be555df3aa743242700879e8fd329ee'
#0701-0799 -> libc++abi
sha256sums=('8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be'
'SKIP'
'e6c4cebb96dee827fa0470af313dff265af391cb6da8d429842ef208c8f25e63'
'cea5f88ebddb30e296ca89130c83b9d46c2d833685e2912303c828054c4dc98a'
'SKIP'
'd30967b1a5fa51a2503474aacc913e69fd05ae862d37bf310088955bdb13ec99'
'd3f25b23bef24c305137e6b44f7e81c51bbec764c119e01512a9bd2330be3115'
'SKIP'
'2fbc9d6aa709b584a8e3bb0b6517679cd022d92e4105fcddac94241b09aa48a0'
'31544baafbee0d6c652637f6dfa19ca91afe5ca577e07752f4b2c23656bc6304'
'SKIP'
'25e615e428f60e651ed09ffd79e563864e3f4bc69a9e93ee41505c419d1a7461'
'4f4d33c4ad69bf9e360eebe6b29b7b19486948b1a41decf89d4adec12473cf96'
'SKIP'
'920d8be32e6f5574a3fb293f93a31225eeba15086820fcb942155bf50dc029e2'
'dca9cb619662ad2d3a0d685c4366078345247218c3702dd35bcaaa23f63481d8'
'SKIP'
'29a5b65bdeff7767782d4427c7c64d54c3a8684bc6b217b74a70e575e4813635'
'41b7d37eb128fd362ab3431be5244cf50325bb3bb153895735c5bacede647c99'
'SKIP'
'48e128fabb2ddaee64ecb8935f7ac315b6e68106bc48aeaf655d179c65d87f34'
'33e06457b9ce0563c89b11ccc7ccabf9cff71b83571985a5bf8684c9150e7502'
'SKIP'
'7e3311b2a1f80f4d3426e09f9459d079cab4d698258667e50a46dccbaaa460fc'
'2dbd8f05c662c1c9f11270fc9d0c63b419ddc988095e0ad107ed911cf882033d'
'SKIP'
'0b0bc73264d7ab77d384f8a7498729e3c4da8ffee00e1c85ad02a2f85e91f0e6'
'0755efa9f969373d4d543123bbed4b3f9a835f6302875c1379c5745857725973'
'SKIP'
'a69d60c2ae36f253f34ab3cfaaa4ff10522692dd4a1a646f2f8fa8996fbd026b'
'89e86d7f53b97bbaef6ee02aa817e979bc122b4844e237b2f5f2af8c268c44c4'
'3c429a6762c66ffd18b0f378debe0527e15f27e5caa0bb47d2e88f8afe68b093'
'e83fe9effaa3d0ba21d3bb98bfd471dc0acd2dd99c72695fb33685d69f8e2a76'
'0804146b32138d55c611336cc81e1783c29a8fab0fe62f248ba1ad7acc711c4d'
'76bcdcae0ef3a4d3ae7082b7fcd668e9560e63fb82068c3f889f9e89b9becf4a'
'1f750fa6a822876dc05bbd7178cf96e9dcaa61f5538e3e0dc223f30514726e40'
'94ccd90b92a2a570c6ee72ac9c1aa402e179ecebb27821e1998025949e09b12a'
'ed2b45e86da7166aafa3c0b9408db2bac120fdcae9a0fb2ef53ae0f49818ab1c'
'31e0f242f4463cadc1b867a87b38e4c2f689e70fdd6d64a44dcc3784f352b20f'
'ba703d3d0f100d02ba01501319e6ec29565a199176fb20d11f89fa31b479df5f'
'b00b3e2395d9262c999c6865da59837f0712454803e0d4e776181267df89f083'
'0c570da0d1357cfef276da685b67118d48a6a6f5a0fc4e281c2925c10f8be9ca'
'0e45e76ee6d6658de52edb7b508a8bcc9f10ff0b295ff2a4e35577136a40c6a5'
'177f45e72cb361414dc80374be25e7913a6b33724e17434f2c55a66ac9143705'
'b03cfc7ebbbfb847e88ae3569d9dcafb01f179b06f1312de29fbd5b7cf906617'
'c30c5477bcb7052245e4ea24a33b60564efc968df81c515f2a512eaa1d45c1a7'
'13a95a61e9c1c44c18a69947734e07515332a549446394f48b86b52511d221de'
'7abd9894abe9d28da975fadbad27478c308ed1455a5130091ad0ffd0351bfa52'
'72cae8e17236d6ad625641a6661ce179b8446bd5119f32a352e5b3b9c1a3f397'
'19d6b59c47f62abcd7fcc2f510e305a1fcdfb4e2016b71245db8e312c038e8b2'
'3f55d2114805110e370fab6630763c359d83b07c356f61b86afc32feb7cf7514'
'78b6951956360a8e05fdc7020bc7e1996da75b499022f9213465070fc238529c'
'aceffb61d57c7c01bc2d9d5461f961df26cffdffaaabb8dda9f219acfe59c77a'
'bccdb99553424121927b3f82086efb2adeee230f18944504ddd93d2d72371d5c'
'c840f4e2286385c4ab3503c02976fd2459516fdc05e44f702d648afaaaebd97f'
'f06f57af203811f6a4c62ac3f1e4545628db13185f5e7d3225d4b1104ca69be1'
'c57d5f2904158b992378906bcddbae79d0566cdb07cc74fbd9b2d76d52661a12'
'afdd708e2431874da4e03d9f51848840ec30ef64b4d440c8dfd50446b2f5ce1a'
'8ba3968939f9a7c6a51849aaf1ab6126f85aa612349570b3644f855929d496fc'
'1740ffa1d23fdee2b147a46cfed4d186bf7d3dc626bb3a1d3ca925147895a2d4'
'e8c8ebbcc7353548974e640b76bfe13d6b89afc832066e0d7156fe242b561a93'
'066e61c097fcad202b3b4f26dbe667719a9f5ae872837250629d69fe06bd1af1'
'cae561cb643daeb68e9ec2716928ba79b459ec2064829e54ecd1edcc378d293b'
'8a636174bff1a05872777b935e27c15c3b87683b57c4277de0d1e9ecc1ca5548'
'f2931ac1ebcc33faa1fa320ebe76143baf9d7635f4819e0f9e37924e70f30d39'
'9f9a12749869bb6c5817d6d5231417195c2e3bd80c10059b3f3e70b010159c26'
'fb1ef06b26e88d37d52c3e0b3b261089e92bb7c08231ec8fa234465fdbdab308'
'c19a3e49f692eba9143bb67c39a9e6df33fa604d85b0b7834d99cdd58a28d23a'
'29e61097ca4f9b1df304e1e7a8f65e6d8ed452e9eb88d9d8cc6ff78b64d84aa8'
'852d55907b469739fca96b043e41c596824ad9d933268ce65a82100b975e91fb'
'0f2cf89298303911a20e9cee7208ed418d91cf700af611a142dc735c708e1435'
'ffbce44f0787dd3defa708f9637353856d70d4b0b888121dd600c6b269b167e1'
'd9b46363c0db63316bdaa29580c446bfe5bc7b43eb8d00f894b72415066da53e'
'461c75905768ce9ed14db48e6c959695f8a61c58c60486c2671b6d4d10923bad'
'0371289d17563a2f29dd7041349e7fe24ed5f217c548c8bff93b47c5b5df2d20'
'4be9205a90b3ed2d23b8e84cac36697c5a85026b6ab3193061fbb0b3915d76c9'
'0a5529a5e9871ec5252c3853f1fdda69253c1a7505837e9c45ae14bcb76a8660')
'84e929fd0f59a90f8c46cf831f420a36e5e4dff359f2ae9338c42ea20f1243d7'
'5782b351170ab747c046efb79244a36de2c531014d5b719e7398f1597a10b948'
'fbb5f936a0c23529a7ec43d458ea22c033a6c84c2017178ad3645b03d8584bcf'
'1ebe995823d427177bf79c4c73e205f708c58e25616b4183d5981a1b4c8130e0'
'eecb723ed6fa59d9debd84a11bcede607020beadfdd0988778392dd7a1820963')
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D' # Hans Wennborg, Google.
'11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard
noextract=(cfe-${pkgver}.src.tar.xz
@@ -170,52 +156,48 @@ prepare() {
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-COFF-Fix-short-import-lib-import-name-type-bitshift.patch"
patch -p1 -i "${srcdir}/0003-mingw-w64-use-MSVC-style-ByteAlignment.patch"
patch -p1 -i "${srcdir}/0004-killthedoctor-mingw.patch"
patch -p1 -i "${srcdir}/0005-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
patch -p1 -i "${srcdir}/0006-use-DESTDIR-on-windows.patch"
patch -p1 -i "${srcdir}/0007-fix-llvm-shlib-cmake-build.patch"
patch -p1 -i "${srcdir}/0008-not-install-msvc-files.patch"
patch -p1 -i "${srcdir}/0009-fix-llvm-config-shared-lib-version-on-win32.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"
cd "${srcdir}/cfe-${pkgver}.src"
patch -p1 -i "${srcdir}/0101-Revert-Revert-r253898-and-r253899-this-breaks-mingw-.patch"
#patch -p1 -i "${srcdir}/0012-mingw-w64-setup-new-defaults-for-target.patch"
patch -p1 -i "${srcdir}/0103-mingw-w64-enable-support-for-__declspec-selectany.patch"
patch -p1 -i "${srcdir}/0104-mingw-w64-support-static-builds-of-libc.patch"
patch -p1 -i "${srcdir}/0105-mingw-enable-static-libclang.patch"
patch -p1 -i "${srcdir}/0106-generate-libclang-instead-of-liblibclang.patch"
patch -p1 -i "${srcdir}/0107-dont-create-cl-mingw.patch"
patch -p1 -i "${srcdir}/0108-dont-use-gcc-headers.patch"
patch -p1 -i "${srcdir}/0109-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
patch -p1 -R -i "${srcdir}/0110-enable-support-for-float128.patch"
patch -p1 -i "${srcdir}/0111-fix-clang-with-libstdc.patch"
patch -p1 -i "${srcdir}/0112-objc-eh-personality.patch"
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"
cd "${srcdir}/compiler-rt-${pkgver}.src"
patch -p1 -i "${srcdir}/0201-mingw-w64-__udivdi3-mangle-hack.patch"
patch -p1 -i "${srcdir}/0202-mingw-fixes-for-compiler-rt.patch"
patch -p1 -i "${srcdir}/0202-compiler-rt-fix-mingw-build.patch"
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"
patch -p1 -i "${srcdir}/0303-Fix-LLVM_LINK_LLVM_DYLIB-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"
patch -p1 -i "${srcdir}/0402-fix-compilation-with-gcc.patch"
cd "${srcdir}/lldb-${pkgver}.src"
patch -p1 -i "${srcdir}/0501-lldb-mingw-fixes.patch"
# this hack allows to build 32 bit lldb but probably breaks XP support
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"
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"
# At the present, clang must reside inside the LLVM source code tree to build
# See http://llvm.org/bugs/show_bug.cgi?id=4840
@@ -284,7 +266,7 @@ build() {
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DCMAKE_CXX_FLAGS="-D_GNU_SOURCE" \
-DLIBCLANG_BUILD_STATIC=ON \
-DLIBCXX_ENABLE_SHARED=OFF \
@@ -314,12 +296,11 @@ build() {
package_llvm() {
pkgdesc="Low Level Virtual Machine (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs") # "compiler-rt"
#install=llvm-${CARCH}.install
cd "${srcdir}"/llvm-${pkgver}.src
make -C ../build-${CARCH} DESTDIR="${pkgdir}" install
# TODO: why CMake haven't included it?
cp ../build-${CARCH}/lib/libLLVM.dll.a "${pkgdir}/${MINGW_PREFIX}/lib/"
@@ -398,7 +379,8 @@ package_lld() {
package_clang() {
pkgdesc="C language family frontend for LLVM (mingw-w64)"
url="http://clang.llvm.org/"
depends=("${MINGW_PACKAGE_PREFIX}-llvm=${pkgver}-${pkgrel}")
depends=("${MINGW_PACKAGE_PREFIX}-llvm=${pkgver}-${pkgrel}"
"${MINGW_PACKAGE_PREFIX}-gcc")
cd "${srcdir}/llvm-${pkgver}.src"
make -C ../build-${CARCH}/tools/clang DESTDIR="${pkgdir}" install

View File

@@ -1,10 +0,0 @@
post_install() {
cd mingw32
local _prefix=$(pwd -W)
cd -
sed -e "s|/mingw32|${_prefix}|g" -i mingw32/share/llvm/cmake/LLVMConfig.cmake
}
post_upgrade() {
post_install
}

View File

@@ -1,10 +0,0 @@
post_install() {
cd mingw64
local _prefix=$(pwd -W)
cd -
sed -e "s|/mingw64|${_prefix}|g" -i mingw64/share/llvm/cmake/LLVMConfig.cmake
}
post_upgrade() {
post_install
}