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.
This commit is contained in:
Christian Neukirchen 2015-08-11 14:11:11 +02:00
parent f2e5650c4c
commit 6fb80ee39c
3 changed files with 8 additions and 47 deletions

View file

@ -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;

View file

@ -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");
}

View file

@ -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