diff --git a/mingw-w64-cling-git/0001-Add-SEH-exceptions-to-the-clang-frontend.patch b/mingw-w64-cling-git/0001-Add-SEH-exceptions-to-the-clang-frontend.patch new file mode 100644 index 0000000000..96fcaf1cc8 --- /dev/null +++ b/mingw-w64-cling-git/0001-Add-SEH-exceptions-to-the-clang-frontend.patch @@ -0,0 +1,173 @@ +From 2228f948e75cef500c91902b47c2ac1fec10d4e5 Mon Sep 17 00:00:00 2001 +From: martell +Date: Mon, 8 Dec 2014 04:55:04 +0000 +Subject: [PATCH] Add SEH exceptions to the clang frontend + +--- + include/clang/Basic/LangOptions.def | 1 + + include/clang/Driver/CC1Options.td | 2 ++ + include/clang/Driver/ToolChain.h | 3 +++ + lib/CodeGen/CGException.cpp | 10 ++++++++++ + lib/Driver/ToolChains.h | 5 +++++ + lib/Driver/Tools.cpp | 2 ++ + lib/Frontend/CompilerInvocation.cpp | 1 + + lib/Frontend/InitPreprocessor.cpp | 2 ++ + 8 files changed, 26 insertions(+) + +diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def +index a297a4c..44656e7 100644 +--- a/include/clang/Basic/LangOptions.def ++++ b/include/clang/Basic/LangOptions.def +@@ -82,6 +82,7 @@ LANGOPT(Exceptions , 1, 0, "exception handling") + LANGOPT(ObjCExceptions , 1, 0, "Objective-C exceptions") + LANGOPT(CXXExceptions , 1, 0, "C++ exceptions") + LANGOPT(SjLjExceptions , 1, 0, "setjmp-longjump exception handling") ++LANGOPT(SEHExceptions , 1, 0, "SEH exception handling") + LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation") + LANGOPT(RTTI , 1, 1, "run-time type information") + LANGOPT(RTTIData , 1, 1, "emit run-time type information data") +diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td +index c3685e0..dbb1a72 100644 +--- a/include/clang/Driver/CC1Options.td ++++ b/include/clang/Driver/CC1Options.td +@@ -428,6 +428,8 @@ def fblocks_runtime_optional : Flag<["-"], "fblocks-runtime-optional">, + HelpText<"Weakly link in the blocks runtime">; + def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, + HelpText<"Use SjLj style exceptions">; ++def fseh_exceptions : Flag<["-"], "fseh-exceptions">, ++ HelpText<"Use SEH style exceptions">; + def split_dwarf_file : Separate<["-"], "split-dwarf-file">, + HelpText<"File name to use for split dwarf debug info output">; + def fno_wchar : Flag<["-"], "fno-wchar">, +diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h +index 6f5677c..52c98c6 100644 +--- a/include/clang/Driver/ToolChain.h ++++ b/include/clang/Driver/ToolChain.h +@@ -248,6 +248,9 @@ public: + /// UseSjLjExceptions - Does this tool chain use SjLj exceptions. + virtual bool UseSjLjExceptions() const { return false; } + ++ /// UseSEHExceptions - Does this tool chain use SEH exceptions. ++ virtual bool UseSEHExceptions() const { return false; } ++ + /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking + /// command line arguments into account. + virtual std::string +diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp +index 1bbda5c..0f14d77 100644 +--- a/lib/CodeGen/CGException.cpp ++++ b/lib/CodeGen/CGException.cpp +@@ -137,18 +137,22 @@ namespace { + static const EHPersonality &get(const LangOptions &Lang); + static const EHPersonality GNU_C; + static const EHPersonality GNU_C_SJLJ; ++ static const EHPersonality GNU_C_SEH; + static const EHPersonality GNU_ObjC; + static const EHPersonality GNUstep_ObjC; + static const EHPersonality GNU_ObjCXX; + static const EHPersonality NeXT_ObjC; + static const EHPersonality GNU_CPlusPlus; + static const EHPersonality GNU_CPlusPlus_SJLJ; ++ static const EHPersonality GNU_CPlusPlus_SEH; + }; + } + + const EHPersonality EHPersonality::GNU_C = { "__gcc_personality_v0", nullptr }; + const EHPersonality + EHPersonality::GNU_C_SJLJ = { "__gcc_personality_sj0", nullptr }; ++const EHPersonality ++EHPersonality::GNU_C_SEH = { "__gcc_personality_seh0", nullptr }; + const EHPersonality + EHPersonality::NeXT_ObjC = { "__objc_personality_v0", nullptr }; + const EHPersonality +@@ -156,6 +160,8 @@ EHPersonality::GNU_CPlusPlus = { "__gxx_personality_v0", nullptr }; + const EHPersonality + EHPersonality::GNU_CPlusPlus_SJLJ = { "__gxx_personality_sj0", nullptr }; + const EHPersonality ++EHPersonality::GNU_CPlusPlus_SEH = { "__gxx_personality_seh0", nullptr }; ++const EHPersonality + EHPersonality::GNU_ObjC = {"__gnu_objc_personality_v0", "objc_exception_throw"}; + const EHPersonality + EHPersonality::GNU_ObjCXX = { "__gnustep_objcxx_personality_v0", nullptr }; +@@ -165,6 +171,8 @@ EHPersonality::GNUstep_ObjC = { "__gnustep_objc_personality_v0", nullptr }; + static const EHPersonality &getCPersonality(const LangOptions &L) { + if (L.SjLjExceptions) + return EHPersonality::GNU_C_SJLJ; ++ if (L.SEHExceptions) ++ return EHPersonality::GNU_C_SEH; + return EHPersonality::GNU_C; + } + +@@ -189,6 +197,8 @@ static const EHPersonality &getObjCPersonality(const LangOptions &L) { + static const EHPersonality &getCXXPersonality(const LangOptions &L) { + if (L.SjLjExceptions) + return EHPersonality::GNU_CPlusPlus_SJLJ; ++ else if (L.SEHExceptions) ++ return EHPersonality::GNU_CPlusPlus_SEH; + else + return EHPersonality::GNU_CPlusPlus; + } +diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h +index 556e884..65c93dd 100644 +--- a/lib/Driver/ToolChains.h ++++ b/lib/Driver/ToolChains.h +@@ -302,6 +302,10 @@ public: + return false; + } + ++ bool UseSEHExceptions() const override { ++ return false; ++ } ++ + /// } + }; + +@@ -738,6 +742,7 @@ public: + bool isPICDefault() const override; + bool isPIEDefault() const override; + bool isPICDefaultForced() const override; ++ bool UseSEHExceptions() const override; + + void + AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, +diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp +index bcc8056..4202fd9 100644 +--- a/lib/Driver/Tools.cpp ++++ b/lib/Driver/Tools.cpp +@@ -4088,6 +4088,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, + + if (getToolChain().UseSjLjExceptions()) + CmdArgs.push_back("-fsjlj-exceptions"); ++ else if (getToolChain().UseSEHExceptions()) ++ CmdArgs.push_back("-fseh-exceptions"); + + // C++ "sane" operator new. + if (!Args.hasFlag(options::OPT_fassume_sane_operator_new, +diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp +index 0c6d77d..c3e8777 100644 +--- a/lib/Frontend/CompilerInvocation.cpp ++++ b/lib/Frontend/CompilerInvocation.cpp +@@ -1427,6 +1427,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, + Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions); + Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions); + Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions); ++ Opts.SEHExceptions = Args.hasArg(OPT_fseh_exceptions); + Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp); + + Opts.RTTI = !Args.hasArg(OPT_fno_rtti); +diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp +index 7a9d09a..7754f0f 100644 +--- a/lib/Frontend/InitPreprocessor.cpp ++++ b/lib/Frontend/InitPreprocessor.cpp +@@ -557,6 +557,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI, + Builder.defineMacro("__GXX_RTTI"); + if (LangOpts.SjLjExceptions) + Builder.defineMacro("__USING_SJLJ_EXCEPTIONS__"); ++ if (LangOpts.SEHExceptions) ++ Builder.defineMacro("__SEH__"); + + if (LangOpts.Deprecated) + Builder.defineMacro("__DEPRECATED"); +-- +2.2.0 + diff --git a/mingw-w64-cling-git/0001-change-all-WIN32-defines-to-_WIN32-as-it-is-a-compil.patch b/mingw-w64-cling-git/0001-change-all-WIN32-defines-to-_WIN32-as-it-is-a-compil.patch new file mode 100644 index 0000000000..8bfc7b44d9 --- /dev/null +++ b/mingw-w64-cling-git/0001-change-all-WIN32-defines-to-_WIN32-as-it-is-a-compil.patch @@ -0,0 +1,179 @@ +From 7e4be1203cfa358b41ef1aca1f5f2ab9592bb511 Mon Sep 17 00:00:00 2001 +From: martell +Date: Thu, 4 Dec 2014 16:01:38 +0000 +Subject: [PATCH] change all WIN32 defines to _WIN32 as it is a compiler define + +--- + lib/Interpreter/DynamicLibraryManager.cpp | 2 +- + lib/UserInterface/textinput/SignalHandler.cpp | 2 +- + lib/UserInterface/textinput/StreamReader.cpp | 4 ++-- + lib/UserInterface/textinput/StreamReaderUnix.cpp | 4 ++-- + lib/UserInterface/textinput/StreamReaderWin.cpp | 4 ++-- + lib/UserInterface/textinput/TerminalConfigUnix.cpp | 4 ++-- + lib/UserInterface/textinput/TerminalDisplay.cpp | 4 ++-- + lib/UserInterface/textinput/TerminalDisplayUnix.cpp | 4 ++-- + lib/UserInterface/textinput/TerminalDisplayWin.cpp | 4 ++-- + 9 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/lib/Interpreter/DynamicLibraryManager.cpp b/lib/Interpreter/DynamicLibraryManager.cpp +index c841538..ac2a1e2 100644 +--- a/lib/Interpreter/DynamicLibraryManager.cpp ++++ b/lib/Interpreter/DynamicLibraryManager.cpp +@@ -22,7 +22,7 @@ + #include + #include + +-#ifdef WIN32 ++#ifdef _WIN32 + #include + #include + #else +diff --git a/lib/UserInterface/textinput/SignalHandler.cpp b/lib/UserInterface/textinput/SignalHandler.cpp +index 9c02dee..6a3cd5b 100644 +--- a/lib/UserInterface/textinput/SignalHandler.cpp ++++ b/lib/UserInterface/textinput/SignalHandler.cpp +@@ -26,7 +26,7 @@ namespace textinput { + + void + SignalHandler::EmitCtrlZ() { +-#ifndef WIN32 ++#ifndef _WIN32 + raise(SIGTSTP); + #endif + } +diff --git a/lib/UserInterface/textinput/StreamReader.cpp b/lib/UserInterface/textinput/StreamReader.cpp +index e8e65b6..9ddfa0f 100644 +--- a/lib/UserInterface/textinput/StreamReader.cpp ++++ b/lib/UserInterface/textinput/StreamReader.cpp +@@ -14,7 +14,7 @@ + + #include "textinput/StreamReader.h" + +-#ifdef WIN32 ++#ifdef _WIN32 + # include "textinput/StreamReaderWin.h" + #else + # include "textinput/StreamReaderUnix.h" +@@ -25,7 +25,7 @@ namespace textinput { + + StreamReader* + StreamReader::Create() { +-#ifdef WIN32 ++#ifdef _WIN32 + return new StreamReaderWin(); + #else + return new StreamReaderUnix(); +diff --git a/lib/UserInterface/textinput/StreamReaderUnix.cpp b/lib/UserInterface/textinput/StreamReaderUnix.cpp +index 74e66c6..72e9367 100644 +--- a/lib/UserInterface/textinput/StreamReaderUnix.cpp ++++ b/lib/UserInterface/textinput/StreamReaderUnix.cpp +@@ -13,7 +13,7 @@ + // Axel Naumann , 2011-05-12 + //===----------------------------------------------------------------------===// + +-#ifndef WIN32 ++#ifndef _WIN32 + + #include "textinput/StreamReaderUnix.h" + +@@ -274,4 +274,4 @@ namespace textinput { + } + } + +-#endif // ifndef WIN32 ++#endif // ifndef _WIN32 +diff --git a/lib/UserInterface/textinput/StreamReaderWin.cpp b/lib/UserInterface/textinput/StreamReaderWin.cpp +index 1615e46..bf59ebc 100644 +--- a/lib/UserInterface/textinput/StreamReaderWin.cpp ++++ b/lib/UserInterface/textinput/StreamReaderWin.cpp +@@ -12,7 +12,7 @@ + // Axel Naumann , 2011-05-12 + //===----------------------------------------------------------------------===// + +-#ifdef WIN32 ++#ifdef _WIN32 + + #include "textinput/StreamReaderWin.h" + +@@ -211,4 +211,4 @@ namespace textinput { + } + } + } +-#endif // WIN32 ++#endif // _WIN32 +diff --git a/lib/UserInterface/textinput/TerminalConfigUnix.cpp b/lib/UserInterface/textinput/TerminalConfigUnix.cpp +index 113e7c9..6f00c5e 100644 +--- a/lib/UserInterface/textinput/TerminalConfigUnix.cpp ++++ b/lib/UserInterface/textinput/TerminalConfigUnix.cpp +@@ -1,4 +1,4 @@ +-#ifndef WIN32 ++#ifndef _WIN32 + + //===--- TerminalConfigUnix.cpp - termios storage -------------*- C++ -*-===// + // +@@ -143,4 +143,4 @@ bool TerminalConfigUnix::IsInteractive() const { + + + +-#endif // ndef WIN32 ++#endif // ifndef _WIN32 +diff --git a/lib/UserInterface/textinput/TerminalDisplay.cpp b/lib/UserInterface/textinput/TerminalDisplay.cpp +index a54529c..f2c2416 100644 +--- a/lib/UserInterface/textinput/TerminalDisplay.cpp ++++ b/lib/UserInterface/textinput/TerminalDisplay.cpp +@@ -14,7 +14,7 @@ + + #include "textinput/TerminalDisplay.h" + +-#ifdef WIN32 ++#ifdef _WIN32 + #include "textinput/TerminalDisplayWin.h" + #else + #include "textinput/TerminalDisplayUnix.h" +@@ -30,7 +30,7 @@ namespace textinput { + + TerminalDisplay* + TerminalDisplay::Create() { +-#ifdef WIN32 ++#ifdef _WIN32 + return new TerminalDisplayWin(); + #else + return new TerminalDisplayUnix(); +diff --git a/lib/UserInterface/textinput/TerminalDisplayUnix.cpp b/lib/UserInterface/textinput/TerminalDisplayUnix.cpp +index 17aef56..2b45168 100644 +--- a/lib/UserInterface/textinput/TerminalDisplayUnix.cpp ++++ b/lib/UserInterface/textinput/TerminalDisplayUnix.cpp +@@ -1,4 +1,4 @@ +-#ifndef WIN32 ++#ifndef _WIN32 + + //===--- TerminalDisplayUnix.cpp - Output To UNIX Terminal ------*- C++ -*-===// + // +@@ -326,4 +326,4 @@ namespace textinput { + + } + +-#endif // #ifndef WIN32 ++#endif // #ifndef _WIN32 +diff --git a/lib/UserInterface/textinput/TerminalDisplayWin.cpp b/lib/UserInterface/textinput/TerminalDisplayWin.cpp +index 8b9dd80..dd9cd6f 100644 +--- a/lib/UserInterface/textinput/TerminalDisplayWin.cpp ++++ b/lib/UserInterface/textinput/TerminalDisplayWin.cpp +@@ -13,7 +13,7 @@ + // Axel Naumann , 2011-05-12 + //===----------------------------------------------------------------------===// + +-#ifdef WIN32 ++#ifdef _WIN32 + #include "textinput/TerminalDisplayWin.h" + + #include "textinput/Color.h" +@@ -214,4 +214,4 @@ namespace textinput { + + } + +-#endif // WIN32 ++#endif // ifdef _WIN32 +-- +2.2.0 + diff --git a/mingw-w64-cling-git/PKGBUILD b/mingw-w64-cling-git/PKGBUILD index 4e7e96c3ed..7587fa54a1 100644 --- a/mingw-w64-cling-git/PKGBUILD +++ b/mingw-w64-cling-git/PKGBUILD @@ -3,7 +3,7 @@ _realname=cling pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-cern-git" "${MINGW_PACKAGE_PREFIX}-clang-cern-git" "${MINGW_PACKAGE_PREFIX}-clang-analyzer-cern-git" "${MINGW_PACKAGE_PREFIX}-llvm-cern-git") -pkgver=51262.b335d96 +pkgver=2423.232f361 pkgrel=1 pkgdesc="LC language family frontend for LLVM (mingw-w64)" arch=('any') @@ -15,15 +15,13 @@ options=('staticlibs' 'strip') source=("llvm"::"git+http://root.cern.ch/git/llvm.git#branch=cling-patches" "clang"::"git+http://root.cern.ch/git/clang.git#branch=cling-patches" "cling"::"git+http://root.cern.ch/git/cling.git" - cling-mingw64-fix.patch - clang-win64-seh.patch - llvm-win64-exceptions.patch + 0001-change-all-WIN32-defines-to-_WIN32-as-it-is-a-compil.patch + 0001-Add-SEH-exceptions-to-the-clang-frontend.patch ) md5sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' - 'SKIP' 'SKIP') pkgver() { @@ -33,14 +31,12 @@ pkgver() { } prepare() { - cd ${srcdir}/llvm - patch -p1 -i ${srcdir}/llvm-win64-exceptions.patch - - cd ${srcdir}/clang - patch -p1 -i ${srcdir}/clang-win64-seh.patch + + #cd ${srcdir}/clang + #patch -p1 -i ${srcdir}/0001-Add-SEH-exceptions-to-the-clang-frontend.patch cd ${srcdir}/cling - patch -p1 -i ${srcdir}/cling-mingw64-fix.patch + patch -p1 -i ${srcdir}/0001-change-all-WIN32-defines-to-_WIN32-as-it-is-a-compil.patch cd ${srcdir} mv ${srcdir}/clang ${srcdir}/llvm/tools/clang @@ -81,7 +77,7 @@ build() { #--with-default-sysroot #--with-binutils-include #--with-bug-report-url - make + make -j1 } check() {