[WIP] clang: update to 3.9.0 (#1768)
* clang: update to 3.9.0 * clang: remove arm binutils * clang: actually remove arm binutils patch * clang: update 0002-COFF-Fix-short-import-lib-import-name-type-bitshift.patch * clang WIP: more fixes to lldb * clang WIP: remove hack used for testing * clang WIP: update checksums
This commit is contained in:
1424
mingw-w64-clang/0001-genlib-named-as-llvm-dlltool.patch
Normal file
1424
mingw-w64-clang/0001-genlib-named-as-llvm-dlltool.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
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
|
||||
@@ -1,22 +0,0 @@
|
||||
--- a/cmake/modules/AddLLVM.cmake 2015-12-25 11:45:24.447038200 +0300
|
||||
+++ b/cmake/modules/AddLLVM.cmake 2015-12-25 12:14:26.848945700 +0300
|
||||
@@ -399,10 +399,15 @@
|
||||
llvm_update_compile_flags(${name})
|
||||
add_link_opts( ${name} )
|
||||
if(ARG_OUTPUT_NAME)
|
||||
- set_target_properties(${name}
|
||||
- PROPERTIES
|
||||
- OUTPUT_NAME ${ARG_OUTPUT_NAME}
|
||||
- )
|
||||
+ if(MINGW)
|
||||
+ string(REGEX REPLACE "^lib([A-Za-z]+)" "\\1" LIB_OUTPUT_NAME ${ARG_OUTPUT_NAME})
|
||||
+ set_target_properties(${name} PROPERTIES OUTPUT_NAME ${LIB_OUTPUT_NAME} RUNTIME_OUTPUT_NAME ${ARG_OUTPUT_NAME} ARCHIVE_OUTPUT_NAME ${LIB_OUTPUT_NAME})
|
||||
+ else()
|
||||
+ set_target_properties(${name}
|
||||
+ PROPERTIES
|
||||
+ OUTPUT_NAME ${ARG_OUTPUT_NAME}
|
||||
+ )
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
if(ARG_MODULE)
|
||||
@@ -0,0 +1,33 @@
|
||||
From c659c69306254b8068af5582803f79508e79ba63 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
|
||||
|
||||
We can do alignment without -aligncomm derectives in PE COFF
|
||||
Until we support GNU style in lld we should use this
|
||||
|
||||
diff --git a/lib/MC/WinCOFFStreamer.cpp b/lib/MC/WinCOFFStreamer.cpp
|
||||
index 5c6407e..f86cbc5 100644
|
||||
--- a/lib/MC/WinCOFFStreamer.cpp
|
||||
+++ b/lib/MC/WinCOFFStreamer.cpp
|
||||
@@ -208,7 +208,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
|
||||
auto *Symbol = cast<MCSymbolCOFF>(S);
|
||||
|
||||
const Triple &T = getContext().getObjectFileInfo()->getTargetTriple();
|
||||
- if (T.isKnownWindowsMSVCEnvironment()) {
|
||||
+ if (T.getEnvironment() != Triple::Cygnus) {
|
||||
if (ByteAlignment > 32)
|
||||
report_fatal_error("alignment is limited to 32-bytes");
|
||||
|
||||
@@ -220,7 +220,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
|
||||
Symbol->setExternal(true);
|
||||
Symbol->setCommon(Size, ByteAlignment);
|
||||
|
||||
- if (!T.isKnownWindowsMSVCEnvironment() && ByteAlignment > 1) {
|
||||
+ if (T.getEnvironment() == Triple::Cygnus && ByteAlignment > 1) {
|
||||
SmallString<128> Directive;
|
||||
raw_svector_ostream OS(Directive);
|
||||
const MCObjectFileInfo *MFI = getContext().getObjectFileInfo();
|
||||
--
|
||||
2.8.3
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
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
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--- cfe-3.7.0.src/tools/libclang/CMakeLists.txt 2015-09-02 12:21:21.242154800 +0300
|
||||
+++ cfe-3.7.0.src/tools/libclang/CMakeLists.txt.orig 2015-09-02 12:20:53.198959400 +0300
|
||||
@@ -51,10 +51,12 @@
|
||||
list(APPEND LIBS clangARCMigrate)
|
||||
endif ()
|
||||
|
||||
+if (NOT MINGW)
|
||||
find_library(DL_LIBRARY_PATH dl)
|
||||
if (DL_LIBRARY_PATH)
|
||||
list(APPEND LIBS dl)
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
option(LIBCLANG_BUILD_STATIC
|
||||
"Build libclang as a static library (in addition to a shared one)" OFF)
|
||||
@@ -0,0 +1,25 @@
|
||||
From 05d6add74e34a5ff2aeadec722df981be2760e52 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)
|
||||
|
||||
|
||||
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
|
||||
index 7da1efe..2d4be9e 100644
|
||||
--- a/include/clang/Basic/Attr.td
|
||||
+++ b/include/clang/Basic/Attr.td
|
||||
@@ -2097,9 +2097,8 @@ def DLLImport : InheritableAttr, TargetSpecificAttr<TargetWindows> {
|
||||
let Documentation = [DLLImportDocs];
|
||||
}
|
||||
|
||||
-def SelectAny : InheritableAttr {
|
||||
- let Spellings = [Declspec<"selectany">];
|
||||
- let LangOpts = [MicrosoftExt];
|
||||
+def SelectAny : InheritableAttr, TargetSpecificAttr<TargetWindows> {
|
||||
+ let Spellings = [Declspec<"selectany">, GCC<"selectany">];
|
||||
let Documentation = [Undocumented];
|
||||
}
|
||||
|
||||
--
|
||||
2.8.3
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
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
|
||||
@@ -77,7 +77,7 @@
|
||||
set(ENABLE_STATIC STATIC)
|
||||
endif()
|
||||
|
||||
-if(WIN32)
|
||||
+if(MSVC)
|
||||
set(output_name "libclang")
|
||||
else()
|
||||
set(output_name "clang")
|
||||
@@ -0,0 +1,11 @@
|
||||
--- cfe-3.9.0.src.orig/lib/Headers/limits.h 2014-02-20 00:38:18.000000000 +0100
|
||||
+++ cfe-3.9.0.src/lib/Headers/limits.h 2016-09-27 15:18:14.024045800 +0200
|
||||
@@ -28,7 +28,7 @@
|
||||
/* The system's limits.h may, in turn, try to #include_next GCC's limits.h.
|
||||
Avert this #include_next madness. */
|
||||
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
|
||||
-#define _GCC_LIMITS_H_
|
||||
+#define _LIMITS_H___
|
||||
#endif
|
||||
|
||||
/* System headers include a number of constants from POSIX in <limits.h>.
|
||||
@@ -1,10 +0,0 @@
|
||||
--- compiler-rt-3.8.0.src/lib/profile/WindowsMMap.h.orig 2015-12-25 10:56:22.521432100 +0300
|
||||
+++ compiler-rt-3.8.0.src/lib/profile/WindowsMMap.h 2015-12-25 12:18:32.484593900 +0300
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
+#include <windows.h>
|
||||
#include <BaseTsd.h>
|
||||
#include <io.h>
|
||||
#include <sys/types.h>
|
||||
27
mingw-w64-clang/0022-mingw-w64-__udivdi3-mangle-hack.patch
Normal file
27
mingw-w64-clang/0022-mingw-w64-__udivdi3-mangle-hack.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
From 67f899a1294d8ad56ea60b02a6ed5b111e2c2d24 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Tue, 16 Aug 2016 16:00:52 -0700
|
||||
Subject: [PATCH 2/2] mingw-w64: __udivdi3 mangle hack
|
||||
|
||||
|
||||
diff --git a/lib/builtins/udivdi3.c b/lib/builtins/udivdi3.c
|
||||
index dc68e15..4c616fd 100644
|
||||
--- a/lib/builtins/udivdi3.c
|
||||
+++ b/lib/builtins/udivdi3.c
|
||||
@@ -17,7 +17,12 @@
|
||||
/* Returns: a / b */
|
||||
|
||||
COMPILER_RT_ABI du_int
|
||||
-__udivdi3(du_int a, du_int b)
|
||||
+#if defined (__MINGW32__) && !defined(_WIN64)
|
||||
+___udivdi3
|
||||
+#else
|
||||
+__udivdi3
|
||||
+#endif
|
||||
+(du_int a, du_int b)
|
||||
{
|
||||
return __udivmoddi4(a, b, 0);
|
||||
}
|
||||
--
|
||||
2.8.3
|
||||
|
||||
41
mingw-w64-clang/0023-mingw-fixes-for-compiler-rt.patch
Normal file
41
mingw-w64-clang/0023-mingw-fixes-for-compiler-rt.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
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)
|
||||
230
mingw-w64-clang/0031-COFF-gnu-driver-support.patch
Normal file
230
mingw-w64-clang/0031-COFF-gnu-driver-support.patch
Normal file
@@ -0,0 +1,230 @@
|
||||
From 5bd9ff32fea92a763d99186619946764793bec87 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Sat, 6 Aug 2016 02:33:13 -0700
|
||||
Subject: [PATCH] COFF: gnu driver support
|
||||
|
||||
Notes:
|
||||
-aligncomm is not needed anymore
|
||||
we should patch mingw-w64 to use _ImageBase
|
||||
A new seperate driver should be made.
|
||||
Now that this works we should be able to revisit
|
||||
this with Rui
|
||||
|
||||
diff --git a/COFF/Driver.cpp b/COFF/Driver.cpp
|
||||
index ffd6936..c927355 100644
|
||||
--- a/COFF/Driver.cpp
|
||||
+++ b/COFF/Driver.cpp
|
||||
@@ -130,6 +130,7 @@ void LinkerDriver::parseDirectives(StringRef S) {
|
||||
case OPT_fastfail:
|
||||
case OPT_guardsym:
|
||||
case OPT_throwingnew:
|
||||
+ case OPT_aligncomm:
|
||||
break;
|
||||
default:
|
||||
fatal(Arg->getSpelling() + " is not allowed in .drectve");
|
||||
@@ -158,6 +159,31 @@ StringRef LinkerDriver::doFindFile(StringRef Filename) {
|
||||
return Filename;
|
||||
}
|
||||
|
||||
+// Searches a given library from input search paths, which are filled
|
||||
+// from -L command line switches. Returns a path to an existent library file.
|
||||
+StringRef LinkerDriver::searchLibrary(StringRef Filename) {
|
||||
+
|
||||
+ std::vector<std::string> Names;
|
||||
+ if (Filename[0] == ':') {
|
||||
+ Names.push_back(Filename.drop_front());
|
||||
+ } else {
|
||||
+ //TODO: Link with static only
|
||||
+ //if (!Config->Static)
|
||||
+ Names.push_back(("lib" + Filename + ".dll.a").str());
|
||||
+ Names.push_back(("lib" + Filename + ".a").str());
|
||||
+ }
|
||||
+
|
||||
+ for (const std::string &Name : Names) {
|
||||
+ for (StringRef Dir : SearchPaths) {
|
||||
+ SmallString<128> Path = Dir;
|
||||
+ llvm::sys::path::append(Path, Name.c_str());
|
||||
+ if (llvm::sys::fs::exists(Path.str()))
|
||||
+ return Alloc.save(Path.str());
|
||||
+ }
|
||||
+ }
|
||||
+ fatal("Unable to find library -l" + Filename);
|
||||
+}
|
||||
+
|
||||
// Resolves a file path. This never returns the same path
|
||||
// (in that case, it returns None).
|
||||
Optional<StringRef> LinkerDriver::findFile(StringRef Filename) {
|
||||
@@ -526,6 +552,9 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
||||
// for /defaultlib option.
|
||||
std::vector<StringRef> Paths;
|
||||
std::vector<MemoryBufferRef> MBs;
|
||||
+ for (auto *Arg : Args.filtered(OPT_l))
|
||||
+ if (Optional<StringRef> Path = searchLibrary(Arg->getValue()))
|
||||
+ Paths.push_back(*Path);
|
||||
for (auto *Arg : Args.filtered(OPT_INPUT))
|
||||
if (Optional<StringRef> Path = findFile(Arg->getValue()))
|
||||
Paths.push_back(*Path);
|
||||
@@ -655,6 +684,8 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
||||
Config->ImageBase = getDefaultImageBase();
|
||||
|
||||
Symtab.addRelative(mangle("__ImageBase"), 0);
|
||||
+ // no mangle because mingw has defines to stop it for i686
|
||||
+ Symtab.addRelative("__image_base__", 0);
|
||||
if (Config->Machine == I386) {
|
||||
Config->SEHTable = Symtab.addRelative("___safe_se_handler_table", 0);
|
||||
Config->SEHCount = Symtab.addAbsolute("___safe_se_handler_count", 0);
|
||||
diff --git a/COFF/Driver.h b/COFF/Driver.h
|
||||
index 0afde18..530baff 100644
|
||||
--- a/COFF/Driver.h
|
||||
+++ b/COFF/Driver.h
|
||||
@@ -87,6 +87,9 @@ private:
|
||||
StringRef doFindFile(StringRef Filename);
|
||||
StringRef doFindLib(StringRef Filename);
|
||||
|
||||
+ // Searches for a gnu library
|
||||
+ StringRef searchLibrary(StringRef Path);
|
||||
+
|
||||
// Parses LIB environment which contains a list of search paths.
|
||||
void addLibSearchPaths();
|
||||
|
||||
diff --git a/COFF/DriverUtils.cpp b/COFF/DriverUtils.cpp
|
||||
index 5d7dc2b..571761c 100644
|
||||
--- a/COFF/DriverUtils.cpp
|
||||
+++ b/COFF/DriverUtils.cpp
|
||||
@@ -86,6 +86,19 @@ MachineTypes getMachineType(StringRef S) {
|
||||
fatal("unknown /machine argument: " + S);
|
||||
}
|
||||
|
||||
+StringRef GNUMachineToStr(MachineTypes MT) {
|
||||
+ switch (MT) {
|
||||
+ case ARMNT:
|
||||
+ return "arm";
|
||||
+ case AMD64:
|
||||
+ return "x86_64";
|
||||
+ case I386:
|
||||
+ return "x86";
|
||||
+ default:
|
||||
+ llvm_unreachable("unknown machine type");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
StringRef machineToStr(MachineTypes MT) {
|
||||
switch (MT) {
|
||||
case ARMNT:
|
||||
@@ -591,7 +604,7 @@ static const llvm::opt::OptTable::Info infoTable[] = {
|
||||
|
||||
class COFFOptTable : public llvm::opt::OptTable {
|
||||
public:
|
||||
- COFFOptTable() : OptTable(infoTable, true) {}
|
||||
+ COFFOptTable() : OptTable(infoTable) {}
|
||||
};
|
||||
|
||||
// Parses a given list of options.
|
||||
diff --git a/COFF/Options.td b/COFF/Options.td
|
||||
index 3866993..a097325 100644
|
||||
--- a/COFF/Options.td
|
||||
+++ b/COFF/Options.td
|
||||
@@ -94,7 +94,41 @@ def help_q : Flag<["/?", "-?"], "">, Alias<help>;
|
||||
def nosymtab : F<"nosymtab">;
|
||||
|
||||
// Flags for debugging
|
||||
-def lldmap : Joined<["/", "-"], "lldmap:">;
|
||||
+def lldmap : Joined<["/", "-"], "debugmap:">;
|
||||
+
|
||||
+def output : Separate<["-"], "o">, Alias<out>;
|
||||
+def L : Joined<["-"], "L">, Alias<libpath>;
|
||||
+def e : Separate<["-"], "e">, Alias<entry>;
|
||||
+def subs : Separate<["--"], "subsystem">, Alias<subsystem>;
|
||||
+
|
||||
+def outlib : Separate<["--"], "out-implib">, Alias<implib>;
|
||||
+
|
||||
+def l : JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">;
|
||||
+
|
||||
+def enable_auto_image_base: Flag<["--"], "enable-auto-image-base">;
|
||||
+
|
||||
+def unexported_symbols_list : Separate<["-"], "unexported_symbols_list">;
|
||||
+def reexported_symbols_list : Separate<["-"], "reexported_symbols_list">;
|
||||
+def force_symbols_not_weak_list : Separate<["-"], "force_symbols_not_weak_list">;
|
||||
+def force_symbols_weak_list : Separate<["-"], "force_symbols_weak_list">;
|
||||
+
|
||||
+def major_image_version : Separate<["--"], "major-image-version">;
|
||||
+def minor_image_version : Separate<["--"], "minor-image-version">;
|
||||
+
|
||||
+
|
||||
+def shared: Flag<["--"], "shared">, Alias<dll>;
|
||||
+
|
||||
+// Used to silence some gnu warnings
|
||||
+def aligncomm : P<"aligncomm", "Comm Alignment">;
|
||||
+def Bdynamic: Flag<["-"], "Bdynamic">;
|
||||
+
|
||||
+// Used to override gnu pe targets
|
||||
+def m : Separate<["-"], "m">, MetaVarName<"<emulation>">,
|
||||
+ HelpText<"Select target emulation">;
|
||||
+
|
||||
+// Select an optional flavor
|
||||
+def flavor: Separate<["-"], "flavor">,
|
||||
+ HelpText<"Flavor for linking, options are gnu/darwin/link">;
|
||||
|
||||
//==============================================================================
|
||||
// The flags below do nothing. They are defined only for link.exe compatibility.
|
||||
diff --git a/COFF/SymbolTable.cpp b/COFF/SymbolTable.cpp
|
||||
index df9da4c..1f5552d 100644
|
||||
--- a/COFF/SymbolTable.cpp
|
||||
+++ b/COFF/SymbolTable.cpp
|
||||
@@ -210,9 +210,10 @@ void SymbolTable::addSymbol(SymbolBody *New) {
|
||||
// compare() returns -1, 0, or 1 if the lhs symbol is less preferable,
|
||||
// equivalent (conflicting), or more preferable, respectively.
|
||||
int Comp = Existing->compare(New);
|
||||
- if (Comp == 0)
|
||||
- fatal("duplicate symbol: " + Existing->getDebugName() + " and " +
|
||||
- New->getDebugName());
|
||||
+ // disable for now because of _free_locale in libc++ with mingw
|
||||
+ //if (Comp == 0)
|
||||
+ // fatal("duplicate symbol: " + Existing->getDebugName() + " and " +
|
||||
+ // New->getDebugName());
|
||||
if (Comp < 0)
|
||||
Sym->Body = New;
|
||||
}
|
||||
diff --git a/tools/lld/lld.cpp b/tools/lld/lld.cpp
|
||||
index 8805e02..d6baefd 100644
|
||||
--- a/tools/lld/lld.cpp
|
||||
+++ b/tools/lld/lld.cpp
|
||||
@@ -51,6 +51,24 @@ static Flavor getFlavor(StringRef S) {
|
||||
.Default(Invalid);
|
||||
}
|
||||
|
||||
+static bool isPETarget(const std::vector<const char *> &V) {
|
||||
+ for (auto It = V.begin(); It != V.end(); It++) {
|
||||
+ if (*It == StringRef("-m")) {
|
||||
+ It++;
|
||||
+ if (It == V.end())
|
||||
+ return false;
|
||||
+ if (*It == StringRef("i386pe"))
|
||||
+ return true;
|
||||
+ if (*It == StringRef("i386pep"))
|
||||
+ return true;
|
||||
+ if (*It == StringRef("thumb2pe"))
|
||||
+ return true;
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static Flavor parseProgname(StringRef Progname) {
|
||||
#if __APPLE__
|
||||
// Use Darwin driver for "ld" on Darwin.
|
||||
@@ -101,6 +119,10 @@ int main(int Argc, const char **Argv) {
|
||||
llvm_shutdown_obj Shutdown;
|
||||
|
||||
std::vector<const char *> Args(Argv, Argv + Argc);
|
||||
+
|
||||
+ if (isPETarget(Args))
|
||||
+ return !coff::link(Args);
|
||||
+
|
||||
switch (parseFlavor(Args)) {
|
||||
case Gnu:
|
||||
return !elf::link(Args);
|
||||
--
|
||||
2.8.3
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From 53625b291503734db14e4a6146ceb06f288fd987 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Sun, 5 Jul 2015 00:54:34 +0100
|
||||
Subject: [PATCH] libcxx: add support for mingw-w64
|
||||
|
||||
|
||||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||||
index d3d5f38..4820f2c 100644
|
||||
--- a/lib/CMakeLists.txt
|
||||
+++ b/lib/CMakeLists.txt
|
||||
@@ -2,7 +2,7 @@ set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTOR
|
||||
|
||||
# Get sources
|
||||
file(GLOB LIBCXX_SOURCES ../src/*.cpp)
|
||||
-if(WIN32)
|
||||
+if(MSVC)
|
||||
file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp)
|
||||
list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
|
||||
diff --git a/src/random.cpp b/src/random.cpp
|
||||
index 4ab424e..d3062f5 100644
|
||||
--- a/src/random.cpp
|
||||
+++ b/src/random.cpp
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
-#if defined(_LIBCPP_USING_WIN32_RANDOM)
|
||||
+#if defined(_LIBCPP_USING_WIN32_RANDOM) || defined(__MINGW32__)
|
||||
// Must be defined before including stdlib.h to enable rand_s().
|
||||
#define _CRT_RAND_S
|
||||
#endif // defined(_LIBCPP_USING_WIN32_RANDOM)
|
||||
--
|
||||
2.4.5
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
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++
|
||||
|
||||
CMAKE_HOST_WIN32 change can be upstreamed in a different patch
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
diff --git a/include/__config b/include/__config
|
||||
index 353ca10..b58c350 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 @@
|
||||
// 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(_MSC_VER)
|
||||
# define _LIBCPP_USING_WIN32_RANDOM
|
||||
#else
|
||||
# define _LIBCPP_USING_DEV_RANDOM
|
||||
@@ -831,7 +833,8 @@ 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"
|
||||
diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h
|
||||
index 7f3710e..d167309 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 );
|
||||
|
||||
+#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);
|
||||
+}
|
||||
+
|
||||
+#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 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*/ )
|
||||
diff --git a/include/support/win32/support.h b/include/support/win32/support.h
|
||||
index 5765bab..4955b3a 100644
|
||||
--- a/include/support/win32/support.h
|
||||
+++ b/include/support/win32/support.h
|
||||
@@ -37,12 +37,13 @@ extern "C" {
|
||||
|
||||
int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
|
||||
int asprintf(char **sptr, const char *__restrict fmt, ...);
|
||||
+}
|
||||
+#endif // __MINGW32__
|
||||
+
|
||||
size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
|
||||
size_t nmc, size_t len, mbstate_t *__restrict ps);
|
||||
size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
|
||||
size_t nwc, size_t len, mbstate_t *__restrict ps);
|
||||
-}
|
||||
-#endif // __MINGW32__
|
||||
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#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
|
||||
--- 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)
|
||||
+ add_link_flags_if_supported(-nodefaultlibs)
|
||||
+else()
|
||||
+ add_library_flags(-lc++abi)
|
||||
+endif()
|
||||
|
||||
if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
|
||||
LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"))
|
||||
diff --git a/src/locale.cpp b/src/locale.cpp
|
||||
index da2fd11..03696a7 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>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
diff --git a/src/support/win32/locale_win32.cpp b/src/support/win32/locale_win32.cpp
|
||||
index 5a43743..b220afe 100644
|
||||
--- a/src/support/win32/locale_win32.cpp
|
||||
+++ b/src/support/win32/locale_win32.cpp
|
||||
@@ -8,6 +8,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
+#ifdef __MINGW32__
|
||||
+#define _GNU_SOURCE
|
||||
+#include <support/win32/support.h>
|
||||
+#endif
|
||||
+
|
||||
#include <locale>
|
||||
#include <cstdarg> // va_start, va_end
|
||||
|
||||
diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp
|
||||
index e989681..0d60ef4 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 @@
|
||||
|
||||
// Some of these functions aren't standard or if they conform, the name does not.
|
||||
|
||||
+#ifndef __MINGW32__
|
||||
int asprintf(char **sptr, const char *__restrict format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -51,6 +56,7 @@ int vasprintf( char **sptr, const char *__restrict format, va_list ap )
|
||||
*sptr = p;
|
||||
return count;
|
||||
}
|
||||
+#endif
|
||||
|
||||
// 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
|
||||
--- 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
|
||||
string do_strerror_r(int ev) {
|
||||
--
|
||||
2.8.3
|
||||
|
||||
29
mingw-w64-clang/0042-fix-compilation-with-gcc.patch
Normal file
29
mingw-w64-clang/0042-fix-compilation-with-gcc.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
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__)
|
||||
+# 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
|
||||
112
mingw-w64-clang/0051-lldb-mingw-fixes.patch
Normal file
112
mingw-w64-clang/0051-lldb-mingw-fixes.patch
Normal file
@@ -0,0 +1,112 @@
|
||||
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-09-25 15:29:06.566435600 +0200
|
||||
@@ -249,7 +249,11 @@
|
||||
|
||||
# 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 )
|
||||
+ else()
|
||||
+ add_definitions( -D_UNICODE -DUNICODE )
|
||||
+ endif()
|
||||
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-09-25 21:48:24.777553100 +0200
|
||||
@@ -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);
|
||||
|
||||
@@ -93,7 +95,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/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-09-25 21:23:42.383498500 +0200
|
||||
@@ -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-09-25 21:43:38.881978300 +0200
|
||||
@@ -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-09-25 21:47:43.401828300 +0200
|
||||
@@ -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/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-09-25 22:23:38.450694800 +0200
|
||||
@@ -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-09-25 22:29:40.256771400 +0200
|
||||
@@ -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;
|
||||
}
|
||||
-
|
||||
62
mingw-w64-clang/0052-lldb-more-mingw-fixes.patch
Normal file
62
mingw-w64-clang/0052-lldb-more-mingw-fixes.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
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-10-08 10:52:57.689832300 +0200
|
||||
@@ -21,7 +21,7 @@
|
||||
lldbPluginDynamicLoaderPosixDYLD
|
||||
lldbPluginDynamicLoaderHexagonDYLD
|
||||
lldbPluginDynamicLoaderWindowsDYLD
|
||||
-
|
||||
+
|
||||
lldbPluginCPlusPlusLanguage
|
||||
lldbPluginGoLanguage
|
||||
lldbPluginJavaLanguage
|
||||
@@ -92,6 +92,7 @@
|
||||
lldbPluginProcessWindowsCommon
|
||||
Ws2_32
|
||||
Rpcrt4
|
||||
+ dbghelp
|
||||
)
|
||||
endif ()
|
||||
|
||||
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-10-08 11:05:16.092749700 +0200
|
||||
@@ -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)
|
||||
Plik lldb-3.9.0.src.orig/test/testcases jest zwykły pusty plik, podczas gdy plik lldb-3.9.0.src/test/testcases jest katalog
|
||||
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-10-08 11:28:13.197215200 +0200
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
# Maintainer: Martell Malone <martellmalone@gmail.com>
|
||||
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
||||
# Contributor: Ray Donnelly <mingw.android@gmail.com>
|
||||
# Contributor: Mateusz Mikuła <mati865@gmail.com>
|
||||
|
||||
# choose the compiler that will be used
|
||||
# clang compilation currently unspported due to mingw-w64 headers bugs
|
||||
_compiler=gcc # clang, gcc
|
||||
|
||||
_realname=clang
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
@@ -11,9 +16,9 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
"${MINGW_PACKAGE_PREFIX}-libc++abi"
|
||||
"${MINGW_PACKAGE_PREFIX}-libc++"
|
||||
"${MINGW_PACKAGE_PREFIX}-lld"
|
||||
"${MINGW_PACKAGE_PREFIX}-libunwind"
|
||||
#"${MINGW_PACKAGE_PREFIX}-libunwind"
|
||||
"${MINGW_PACKAGE_PREFIX}-llvm"
|
||||
#"${MINGW_PACKAGE_PREFIX}-lldb"
|
||||
"${MINGW_PACKAGE_PREFIX}-lldb"
|
||||
)
|
||||
pkgver=3.9.0
|
||||
pkgrel=1
|
||||
@@ -22,7 +27,10 @@ arch=('any')
|
||||
url="http://llvm.org"
|
||||
license=("custom:University of Illinois/NCSA Open Source License")
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
|
||||
"${MINGW_PACKAGE_PREFIX}-gcc"
|
||||
$([[ "$_compiler" == "gcc" ]] && echo \
|
||||
"${MINGW_PACKAGE_PREFIX}-gcc")
|
||||
$([[ "$_compiler" == "clang" ]] && echo \
|
||||
"${MINGW_PACKAGE_PREFIX}-clang")
|
||||
"${MINGW_PACKAGE_PREFIX}-libffi"
|
||||
"${MINGW_PACKAGE_PREFIX}-pkg-config"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-sphinx"
|
||||
@@ -41,16 +49,28 @@ source=(http://llvm.org/releases/${pkgver}/llvm-${pkgver}.src.tar.xz{,.sig}
|
||||
http://llvm.org/releases/${pkgver}/lld-${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-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
|
||||
"0002-use-DESTDIR-on-windows.patch"
|
||||
"0003-generate-proper-library-names-mingw.patch"
|
||||
"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"
|
||||
"0012-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
"0013-mingw-w64-dont-have-dl-library.patch"
|
||||
"0014-dont-create-cl-mingw.patch"
|
||||
"0018-mingw-enable-static-libclang.patch"
|
||||
"0021-missing-include.patch"
|
||||
"0041-libcxx-add-support-for-mingw-w64.patch"
|
||||
"0005-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
|
||||
"0006-use-DESTDIR-on-windows.patch"
|
||||
"0011-Revert-Revert-r253898-and-r253899-this-breaks-mingw-.patch"
|
||||
"0012-mingw-w64-setup-new-defaults-for-target.patch"
|
||||
"0013-mingw-w64-enable-support-for-__declspec-selectany.patch"
|
||||
"0014-mingw-w64-support-static-builds-of-libc.patch"
|
||||
"0015-mingw-enable-static-libclang.patch"
|
||||
"0016-generate-libclang-instead-of-liblibclang.patch"
|
||||
"0017-dont-create-cl-mingw.patch"
|
||||
"0018-experimental-workaround-for-limits-bug.patch"
|
||||
"0019-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
"0022-mingw-w64-__udivdi3-mangle-hack.patch"
|
||||
"0023-mingw-fixes-for-compiler-rt.patch"
|
||||
"0031-COFF-gnu-driver-support.patch"
|
||||
"0041-mingw-w64-hack-and-slash-fixes-for-libc.patch"
|
||||
"0042-fix-compilation-with-gcc.patch"
|
||||
"0051-lldb-mingw-fixes.patch"
|
||||
"0052-lldb-more-mingw-fixes.patch"
|
||||
"0061-libunwind-add-support-for-mingw-w64.patch")
|
||||
# Some patch notes :)
|
||||
#0001-0009 -> llvm
|
||||
@@ -80,23 +100,34 @@ sha256sums=('66c73179da42cee1386371641241f79ded250e117a79f571bbd69e56daa48948'
|
||||
'SKIP'
|
||||
'66675ddec5ba0d36689757da6008cb2596ee1a9067f4f598d89ce5a3b43f4c2b'
|
||||
'SKIP'
|
||||
'a69d60c2ae36f253f34ab3cfaaa4ff10522692dd4a1a646f2f8fa8996fbd026b'
|
||||
'89e86d7f53b97bbaef6ee02aa817e979bc122b4844e237b2f5f2af8c268c44c4'
|
||||
'3c429a6762c66ffd18b0f378debe0527e15f27e5caa0bb47d2e88f8afe68b093'
|
||||
'e83fe9effaa3d0ba21d3bb98bfd471dc0acd2dd99c72695fb33685d69f8e2a76'
|
||||
'0804146b32138d55c611336cc81e1783c29a8fab0fe62f248ba1ad7acc711c4d'
|
||||
'76bcdcae0ef3a4d3ae7082b7fcd668e9560e63fb82068c3f889f9e89b9becf4a'
|
||||
'6a95ed671876a6de04799d15bf7485d628016bb4a95a6764217ad452d8eed0d8'
|
||||
'e83fe9effaa3d0ba21d3bb98bfd471dc0acd2dd99c72695fb33685d69f8e2a76'
|
||||
'13a95a61e9c1c44c18a69947734e07515332a549446394f48b86b52511d221de'
|
||||
'8f35b80eca6c18df020b176eee4eb95901c31e3e640848a6d606983aca15a3af'
|
||||
'b03cfc7ebbbfb847e88ae3569d9dcafb01f179b06f1312de29fbd5b7cf906617'
|
||||
'31e0f242f4463cadc1b867a87b38e4c2f689e70fdd6d64a44dcc3784f352b20f'
|
||||
'ba703d3d0f100d02ba01501319e6ec29565a199176fb20d11f89fa31b479df5f'
|
||||
'b00b3e2395d9262c999c6865da59837f0712454803e0d4e776181267df89f083'
|
||||
'0c570da0d1357cfef276da685b67118d48a6a6f5a0fc4e281c2925c10f8be9ca'
|
||||
'0e45e76ee6d6658de52edb7b508a8bcc9f10ff0b295ff2a4e35577136a40c6a5'
|
||||
'a0933775b979b4879e220358b1076d8eeb9170403d0d190b1340d179fcd3cd1e'
|
||||
'5b8edbbb638c906216e20229529e8348abc50d5886d20e07af08543e1e574e94'
|
||||
'ddc914887e512e0767b1465f17c80378cf38a041795538b37a40ac57889164fb'
|
||||
'b03cfc7ebbbfb847e88ae3569d9dcafb01f179b06f1312de29fbd5b7cf906617'
|
||||
'd6c483a99973ae674e85f8d816cb34e1538ee4d9cc64bfe63735322d86503f7c'
|
||||
'13a95a61e9c1c44c18a69947734e07515332a549446394f48b86b52511d221de'
|
||||
'fb1ef06b26e88d37d52c3e0b3b261089e92bb7c08231ec8fa234465fdbdab308'
|
||||
'c19a3e49f692eba9143bb67c39a9e6df33fa604d85b0b7834d99cdd58a28d23a'
|
||||
'852d55907b469739fca96b043e41c596824ad9d933268ce65a82100b975e91fb'
|
||||
'd9b46363c0db63316bdaa29580c446bfe5bc7b43eb8d00f894b72415066da53e'
|
||||
'61059619286b1d1761c80788778999c215aca2e7098c491b14557fb24d2874a2'
|
||||
'6bbf6b6fe11c6708d92d452ceaacebf6cc67675bbf4ece3063779d4f4927db61'
|
||||
'b9d21856176a9933354ef21caca59d0ea8a5b98fcf09494233d275cebc864a40'
|
||||
'0a5529a5e9871ec5252c3853f1fdda69253c1a7505837e9c45ae14bcb76a8660')
|
||||
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg, Google.
|
||||
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg, Google.
|
||||
noextract=(cfe-${pkgver}.src.tar.xz
|
||||
libcxx-${pkgver}.src.tar.xz
|
||||
lldb-${pkgver}.src.tar.xz
|
||||
test-suite-${pkgver}.src.tar.xz
|
||||
)
|
||||
test-suite-${pkgver}.src.tar.xz)
|
||||
|
||||
prepare() {
|
||||
plain "Extracting clang-${pkgver}.src.tar.xz due to symlink(s) without pre-existing target(s)"
|
||||
@@ -112,27 +143,41 @@ prepare() {
|
||||
[[ -d ${srcdir}/lldb-${pkgver} ]] || tar -xJvf ${srcdir}/lldb-${pkgver}.src.tar.xz -C ${srcdir} || true
|
||||
|
||||
cd "${srcdir}/llvm-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0001-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
|
||||
patch -p1 -i "${srcdir}/0002-use-DESTDIR-on-windows.patch"
|
||||
patch -p1 -i "${srcdir}/0003-generate-proper-library-names-mingw.patch"
|
||||
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"
|
||||
|
||||
cd "${srcdir}/cfe-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0012-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
patch -p1 -i "${srcdir}/0013-mingw-w64-dont-have-dl-library.patch"
|
||||
patch -p1 -i "${srcdir}/0014-dont-create-cl-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0018-mingw-enable-static-libclang.patch"
|
||||
patch -p1 -i "${srcdir}/0011-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}/0013-mingw-w64-enable-support-for-__declspec-selectany.patch"
|
||||
patch -p1 -i "${srcdir}/0014-mingw-w64-support-static-builds-of-libc.patch"
|
||||
patch -p1 -i "${srcdir}/0015-mingw-enable-static-libclang.patch"
|
||||
patch -p1 -i "${srcdir}/0016-generate-libclang-instead-of-liblibclang.patch"
|
||||
patch -p1 -i "${srcdir}/0017-dont-create-cl-mingw.patch"
|
||||
patch -p1 -i "${srcdir}/0018-experimental-workaround-for-limits-bug.patch"
|
||||
patch -p1 -i "${srcdir}/0019-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
|
||||
|
||||
cd "${srcdir}/compiler-rt-${pkgver}.src"
|
||||
patch -p1 -i ${srcdir}/0021-missing-include.patch
|
||||
# patch -p1 -i "${srcdir}/0022-mingw-w64-__udivdi3-mangle-hack.patch"
|
||||
patch -p1 -i "${srcdir}/0023-mingw-fixes-for-compiler-rt.patch"
|
||||
|
||||
cd "${srcdir}/lld-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0031-COFF-gnu-driver-support.patch"
|
||||
|
||||
cd "${srcdir}/libcxx-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0041-libcxx-add-support-for-mingw-w64.patch"
|
||||
patch -p1 -i "${srcdir}/0041-mingw-w64-hack-and-slash-fixes-for-libc.patch"
|
||||
patch -p1 -i "${srcdir}/0042-fix-compilation-with-gcc.patch"
|
||||
|
||||
cd "${srcdir}/lldb-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0051-lldb-mingw-fixes.patch"
|
||||
patch -p1 -i "${srcdir}/0052-lldb-more-mingw-fixes.patch"
|
||||
|
||||
cd "${srcdir}/libunwind-${pkgver}.src"
|
||||
patch -p1 -i "${srcdir}/0061-libunwind-add-support-for-mingw-w64.patch"
|
||||
#patch -p1 -i "${srcdir}/0061-libunwind-add-support-for-mingw-w64.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
|
||||
@@ -146,7 +191,7 @@ prepare() {
|
||||
mv "${srcdir}/compiler-rt-${pkgver}.src" projects/compiler-rt | true
|
||||
mv "${srcdir}/libcxxabi-${pkgver}.src" projects/libcxxabi | true
|
||||
mv "${srcdir}/libcxx-${pkgver}.src" projects/libcxx | true
|
||||
mv "${srcdir}/libunwind-${pkgver}.src" projects/libunwind | true
|
||||
#mv "${srcdir}/libunwind-${pkgver}.src" projects/libunwind | true
|
||||
#mv "${srcdir}/testsuite-${pkgver}.src" projects/test-suite | true
|
||||
}
|
||||
|
||||
@@ -172,14 +217,25 @@ build() {
|
||||
# "Ninja" cant install each component seperately
|
||||
# https://github.com/martine/ninja/issues/932
|
||||
|
||||
if [ "${_compiler}" == "gcc" ]; then
|
||||
export CC='gcc'
|
||||
export CXX='g++'
|
||||
elif [ "${_compiler}" == "clang" ]; then
|
||||
#export CC='clang -stdlib=libc++'
|
||||
#export CXX='clang++ -stdlib=libc++'
|
||||
export CC='clang'
|
||||
export CXX='clang++'
|
||||
else
|
||||
msg "undefined compiler"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PATH=${MINGW_PREFIX}/bin:/usr/bin \
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
${MINGW_PREFIX}/bin/cmake.exe \
|
||||
-G"MSYS Makefiles" \
|
||||
-DCMAKE_SYSTEM_IGNORE_PATH=/usr/lib \
|
||||
-DCMAKE_MAKE_PROGRAM="/usr/bin/make.exe" \
|
||||
-DCMAKE_C_COMPILER="${MINGW_PREFIX}/bin/gcc.exe" \
|
||||
-DCMAKE_CXX_COMPILER="${MINGW_PREFIX}/bin/g++.exe" \
|
||||
-DFFI_INCLUDE_DIR="${FFI_INCLUDE_DIR}" \
|
||||
-DCMAKE_C_FLAGS="${CFLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CXXFLAGS} ${CPPFLAGS}" \
|
||||
@@ -190,11 +246,12 @@ build() {
|
||||
-DPYTHON_EXECUTABLE=${MINGW_PREFIX}/bin/python2.exe \
|
||||
-DLLVM_ENABLE_FFI=ON \
|
||||
-DLLVM_ENABLE_SPHINX=ON \
|
||||
-DCMAKE_CXX_FLAGS="-D_GNU_SOURCE -D_LIBCPP_HAS_NO_CONSTEXPR" \
|
||||
-DCMAKE_CXX_FLAGS="-D_GNU_SOURCE" \
|
||||
-DLIBCLANG_BUILD_STATIC=ON \
|
||||
-DLIBCXX_ENABLE_SHARED=OFF \
|
||||
-DLIBCXXABI_ENABLE_SHARED=OFF \
|
||||
-DLIBUNWIND_ENABLE_SHARED=OFF \
|
||||
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
|
||||
"${extra_config[@]}" \
|
||||
../llvm-${pkgver}.src
|
||||
|
||||
@@ -247,7 +304,7 @@ package_compiler-rt() {
|
||||
package_libcxxabi() {
|
||||
pkgdesc="C++ Standard Library Support (mingw-w64)"
|
||||
url="http://libcxxabi.llvm.org/"
|
||||
depends="${MINGW_PACKAGE_PREFIX}-libunwind"
|
||||
# depends="${MINGW_PACKAGE_PREFIX}-libunwind"
|
||||
|
||||
cd "${srcdir}/llvm-${pkgver}.src"
|
||||
make -C ../build-${CARCH}/projects/libcxxabi -j1 DESTDIR="${pkgdir}" install
|
||||
@@ -264,7 +321,7 @@ package_libcxx() {
|
||||
package_libunwind() {
|
||||
pkgdesc='A new implementation of a stack unwinder for C++ exceptions (mingw-w64)'
|
||||
url='http://llvm.org'
|
||||
|
||||
|
||||
cd "${srcdir}/llvm-${pkgver}.src"
|
||||
make -C ../build-${CARCH}/projects/libunwind -j1 DESTDIR="${pkgdir}" install
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user