diff options
-rw-r--r-- | lib/Driver/ToolChains.cpp | 37 | ||||
-rw-r--r-- | lib/Driver/ToolChains.h | 6 | ||||
-rw-r--r-- | runtime/compiler-rt/Makefile | 2 |
3 files changed, 24 insertions, 21 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() { diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index 7325874473..9ed0dc2ef8 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -175,7 +175,7 @@ public: /// runtime library. virtual void AddLinkRuntimeLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const = 0; - + /// } /// @name ToolChain Implementation /// { @@ -266,7 +266,9 @@ public: virtual void AddLinkRuntimeLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const; - + void AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs, + const char *DarwinStaticLib) const; + virtual void AddCXXStdlibLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const; diff --git a/runtime/compiler-rt/Makefile b/runtime/compiler-rt/Makefile index dcdd4f5ec0..0d770db17c 100644 --- a/runtime/compiler-rt/Makefile +++ b/runtime/compiler-rt/Makefile @@ -42,7 +42,7 @@ ifeq ($(shell test -d $(COMPILERRT_SRC_ROOT) && echo OK),OK) RuntimeDirs := ifeq ($(OS),Darwin) RuntimeDirs += darwin -RuntimeLibrary.darwin.Configs = eprintf 10.4 ios cc_kext +RuntimeLibrary.darwin.Configs = eprintf 10.4 osx ios cc_kext # On Darwin, fake Clang into using the iOS assembler (since compiler-rt wants to # build ARM bits). |