From 6fb80ee39c2cba7dc37ed753b30ff3bea11919a8 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Tue, 11 Aug 2015 14:11:11 +0200 Subject: [PATCH] clang++: revert to --rtlib=libgcc We previously patched clang to default to --rtlib=compiler-rt, but this caused problems; revert to upstream default. Change cfe-008-remove-lgcc-when-using-compiler-rt to only remove -lgcc_s (which is superseded by compiler-rt), but keep -lgcc_eh which is required for unwinding; else -lgcc_s is searched for -static builds, causing failure. This should fix build of C++ programs using exceptions on both glibc and musl, and also should fix using --rtlib=compiler-rt on these platforms. Closes #2042. --- .../cfe-002-default-runtime-compiler-rt.patch | 27 ------------------- ...8-remove-lgcc-when-using-compiler-rt.patch | 26 +++++------------- srcpkgs/llvm/template | 2 +- 3 files changed, 8 insertions(+), 47 deletions(-) delete mode 100644 srcpkgs/llvm/files/patches/cfe/cfe-002-default-runtime-compiler-rt.patch diff --git a/srcpkgs/llvm/files/patches/cfe/cfe-002-default-runtime-compiler-rt.patch b/srcpkgs/llvm/files/patches/cfe/cfe-002-default-runtime-compiler-rt.patch deleted file mode 100644 index d97ab81602..0000000000 --- a/srcpkgs/llvm/files/patches/cfe/cfe-002-default-runtime-compiler-rt.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git lib/Driver/ToolChains.cpp lib/Driver/ToolChains.cpp -index f789fd5..07fc182 100644 ---- lib/Driver/ToolChains.cpp -+++ lib/Driver/ToolChains.cpp -@@ -3385,6 +3385,10 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, - } - } - -+ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const { -+ return ToolChain::RLT_CompilerRT; -+} -+ - bool Linux::isPIEDefault() const { - return getSanitizerArgs().requiresPIE(); - } -diff --git lib/Driver/ToolChains.h lib/Driver/ToolChains.h -index 47fb10d..88aee51 100644 ---- lib/Driver/ToolChains.h -+++ lib/Driver/ToolChains.h -@@ -640,6 +640,7 @@ public: - void - AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; -+ RuntimeLibType GetDefaultRuntimeLibType() const override; - bool isPIEDefault() const override; - - std::string Linker; diff --git a/srcpkgs/llvm/files/patches/cfe/cfe-008-remove-lgcc-when-using-compiler-rt.patch b/srcpkgs/llvm/files/patches/cfe/cfe-008-remove-lgcc-when-using-compiler-rt.patch index 3061386079..86b82592f0 100644 --- a/srcpkgs/llvm/files/patches/cfe/cfe-008-remove-lgcc-when-using-compiler-rt.patch +++ b/srcpkgs/llvm/files/patches/cfe/cfe-008-remove-lgcc-when-using-compiler-rt.patch @@ -1,23 +1,11 @@ -diff --git lib/Driver/Tools.cpp lib/Driver/Tools.cpp -index 5a5cba7..701ac12 100644 ---- lib/Driver/Tools.cpp -+++ lib/Driver/Tools.cpp -@@ -2157,12 +2157,12 @@ static void addClangRT(const ToolChain &TC, const ArgList &Args, - ArgStringList &CmdArgs) { +--- lib/Driver/Tools.cpp 2015-08-11 13:59:22.324639527 +0200 ++++ lib/Driver/Tools.cpp 2015-08-11 13:59:34.058576064 +0200 +@@ -2158,8 +2158,6 @@ CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, "builtins"))); -- if (!TC.getTriple().isOSWindows()) { + if (!TC.getTriple().isOSWindows()) { - // FIXME: why do we link against gcc when we are using compiler-rt? - CmdArgs.push_back("-lgcc_s"); -- if (TC.getDriver().CCCIsCXX()) -- CmdArgs.push_back("-lgcc_eh"); -- } -+ // if (!TC.getTriple().isOSWindows()) { -+ // // FIXME: why do we link against gcc when we are using compiler-rt? -+ // CmdArgs.push_back("-lgcc_s"); -+ // if (TC.getDriver().CCCIsCXX()) -+ // CmdArgs.push_back("-lgcc_eh"); -+ // } - } - - static void addProfileRT(const ToolChain &TC, const ArgList &Args, + if (TC.getDriver().CCCIsCXX()) + CmdArgs.push_back("-lgcc_eh"); + } diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template index 67bfcf5195..9105ded477 100644 --- a/srcpkgs/llvm/template +++ b/srcpkgs/llvm/template @@ -1,7 +1,7 @@ # Template file for 'llvm' pkgname=llvm version=3.6.2 -revision=1 +revision=2 wrksrc="llvm-${version}.src" lib32disabled=yes configure_args="--disable-expensive-checks --disable-debug-runtime