LIBRARY_PATH environment variable should only be supported on a native compiler.

llvm-svn: 197490
This commit is contained in:
Richard Barton 2013-12-17 11:11:25 +00:00
parent 7237879926
commit 5828d7b936
4 changed files with 21 additions and 1 deletions

View File

@ -113,6 +113,9 @@ public:
StringRef getPlatform() const { return Triple.getVendorName(); }
StringRef getOS() const { return Triple.getOSName(); }
/// \brief Returns true if the toolchain is targeting a non-native architecture.
bool isCrossCompiling() const;
/// \brief Provide the default architecture name (as expected by -arch) for
/// this toolchain. Note t
std::string getDefaultUniversalArchName() const;

View File

@ -154,6 +154,20 @@ bool ToolChain::HasNativeLLVMSupport() const {
return false;
}
bool ToolChain::isCrossCompiling() const {
llvm::Triple HostTriple(LLVM_HOST_TRIPLE);
switch (HostTriple.getArch()) {
// The A32/T32/T16 instruction sets are not seperate architectures in
// this context.
case llvm::Triple::arm:
case llvm::Triple::thumb:
return getArch() != llvm::Triple::arm &&
getArch() != llvm::Triple::thumb;
default:
return HostTriple.getArch() != getArch();
}
}
ObjCRuntime ToolChain::getDefaultObjCRuntime(bool isNonFragile) const {
return ObjCRuntime(isNonFragile ? ObjCRuntime::GNUstep : ObjCRuntime::GCC,
VersionTuple());

View File

@ -190,7 +190,9 @@ static void AddLinkerInputs(const ToolChain &TC,
}
// LIBRARY_PATH - included following the user specified library paths.
addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH");
// and only supported on native toolchains.
if (!TC.isCrossCompiling())
addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH");
}
/// \brief Determine whether Objective-C automated reference counting is

View File

@ -4,3 +4,4 @@
// GCC driver is used as linker on cygming. It should be aware of LIBRARY_PATH.
// XFAIL: win32
// REQUIRES: clang-driver
// REQUIRES: native