aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-06-22 17:41:40 +0000
committerEric Christopher <echristo@apple.com>2011-06-22 17:41:40 +0000
commit3404fe7105ecc3baa58b7ea725773de4112259d6 (patch)
treecf4dc80716b31a20be31511d263b6f16e31209fb /lib/Driver/ToolChains.cpp
parent34aace89335d175c3a87a47737fc841e9853767d (diff)
Build and use libcompiler_rt whenever possible.
Patch by Jean-Daniel Dupas! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r--lib/Driver/ToolChains.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index e9bea426ae..4cd96beb05 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -365,6 +365,21 @@ void DarwinClang::AddLinkARCArgs(const ArgList &Args,
CmdArgs.push_back(Args.MakeArgString(s));
}
+void DarwinClang::AddLinkRuntimeLib(const ArgList &Args,
+ ArgStringList &CmdArgs,
+ const char *DarwinStaticLib) const {
+ llvm::sys::Path P(getDriver().ResourceDir);
+ P.appendComponent("lib");
+ P.appendComponent("darwin");
+ P.appendComponent(DarwinStaticLib);
+
+ // For now, allow missing resource libraries to support developers who may
+ // not have compiler-rt checked out or integrated into their build.
+ bool Exists;
+ if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
+ CmdArgs.push_back(Args.MakeArgString(P.str()));
+}
+
void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
// Darwin doesn't support real static executables, don't link any runtime
@@ -386,7 +401,6 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
CmdArgs.push_back("-lSystem");
// Select the dynamic runtime library and the target specific static library.
- const char *DarwinStaticLib = 0;
if (isTargetIPhoneOS()) {
// If we are compiling as iOS / simulator, don't attempt to link libgcc_s.1,
// it never went into the SDK.
@@ -394,7 +408,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
CmdArgs.push_back("-lgcc_s.1");
// We currently always need a static runtime library for iOS.
- DarwinStaticLib = "libclang_rt.ios.a";
+ AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.ios.a");
} else {
// The dynamic runtime library was merged with libSystem for 10.6 and
// beyond; only 10.4 and 10.5 need an additional runtime library.
@@ -412,26 +426,13 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
// libSystem. Therefore, we still must provide a runtime library just for
// the tiny tiny handful of projects that *might* use that symbol.
if (isMacosxVersionLT(10, 5)) {
- DarwinStaticLib = "libclang_rt.10.4.a";
+ AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.10.4.a");
} else {
if (getTriple().getArch() == llvm::Triple::x86)
- DarwinStaticLib = "libclang_rt.eprintf.a";
+ AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.eprintf.a");
+ AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.osx.a");
}
}
-
- /// Add the target specific static library, if needed.
- if (DarwinStaticLib) {
- llvm::sys::Path P(getDriver().ResourceDir);
- P.appendComponent("lib");
- P.appendComponent("darwin");
- P.appendComponent(DarwinStaticLib);
-
- // For now, allow missing resource libraries to support developers who may
- // not have compiler-rt checked out or integrated into their build.
- bool Exists;
- if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
- CmdArgs.push_back(Args.MakeArgString(P.str()));
- }
}
static inline llvm::StringRef SimulatorVersionDefineName() {