forked from OSchip/llvm-project
Build and use libcompiler_rt whenever possible.
Patch by Jean-Daniel Dupas! llvm-svn: 133624
This commit is contained in:
parent
ec793dde8e
commit
c235d0c635
|
@ -365,6 +365,21 @@ void DarwinClang::AddLinkARCArgs(const ArgList &Args,
|
||||||
CmdArgs.push_back(Args.MakeArgString(s));
|
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,
|
void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
||||||
ArgStringList &CmdArgs) const {
|
ArgStringList &CmdArgs) const {
|
||||||
// Darwin doesn't support real static executables, don't link any runtime
|
// 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");
|
CmdArgs.push_back("-lSystem");
|
||||||
|
|
||||||
// Select the dynamic runtime library and the target specific static library.
|
// Select the dynamic runtime library and the target specific static library.
|
||||||
const char *DarwinStaticLib = 0;
|
|
||||||
if (isTargetIPhoneOS()) {
|
if (isTargetIPhoneOS()) {
|
||||||
// If we are compiling as iOS / simulator, don't attempt to link libgcc_s.1,
|
// If we are compiling as iOS / simulator, don't attempt to link libgcc_s.1,
|
||||||
// it never went into the SDK.
|
// it never went into the SDK.
|
||||||
|
@ -394,7 +408,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
||||||
CmdArgs.push_back("-lgcc_s.1");
|
CmdArgs.push_back("-lgcc_s.1");
|
||||||
|
|
||||||
// We currently always need a static runtime library for iOS.
|
// We currently always need a static runtime library for iOS.
|
||||||
DarwinStaticLib = "libclang_rt.ios.a";
|
AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.ios.a");
|
||||||
} else {
|
} else {
|
||||||
// The dynamic runtime library was merged with libSystem for 10.6 and
|
// The dynamic runtime library was merged with libSystem for 10.6 and
|
||||||
// beyond; only 10.4 and 10.5 need an additional runtime library.
|
// 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
|
// libSystem. Therefore, we still must provide a runtime library just for
|
||||||
// the tiny tiny handful of projects that *might* use that symbol.
|
// the tiny tiny handful of projects that *might* use that symbol.
|
||||||
if (isMacosxVersionLT(10, 5)) {
|
if (isMacosxVersionLT(10, 5)) {
|
||||||
DarwinStaticLib = "libclang_rt.10.4.a";
|
AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.10.4.a");
|
||||||
} else {
|
} else {
|
||||||
if (getTriple().getArch() == llvm::Triple::x86)
|
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() {
|
static inline llvm::StringRef SimulatorVersionDefineName() {
|
||||||
|
|
|
@ -175,7 +175,7 @@ public:
|
||||||
/// runtime library.
|
/// runtime library.
|
||||||
virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
|
virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
|
||||||
ArgStringList &CmdArgs) const = 0;
|
ArgStringList &CmdArgs) const = 0;
|
||||||
|
|
||||||
/// }
|
/// }
|
||||||
/// @name ToolChain Implementation
|
/// @name ToolChain Implementation
|
||||||
/// {
|
/// {
|
||||||
|
@ -266,7 +266,9 @@ public:
|
||||||
|
|
||||||
virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
|
virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
|
||||||
ArgStringList &CmdArgs) const;
|
ArgStringList &CmdArgs) const;
|
||||||
|
void AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
|
||||||
|
const char *DarwinStaticLib) const;
|
||||||
|
|
||||||
virtual void AddCXXStdlibLibArgs(const ArgList &Args,
|
virtual void AddCXXStdlibLibArgs(const ArgList &Args,
|
||||||
ArgStringList &CmdArgs) const;
|
ArgStringList &CmdArgs) const;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ ifeq ($(shell test -d $(COMPILERRT_SRC_ROOT) && echo OK),OK)
|
||||||
RuntimeDirs :=
|
RuntimeDirs :=
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
RuntimeDirs += 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
|
# On Darwin, fake Clang into using the iOS assembler (since compiler-rt wants to
|
||||||
# build ARM bits).
|
# build ARM bits).
|
||||||
|
|
Loading…
Reference in New Issue