Add support for the androideabi environment to our triple support, and

for the arm-linux-androideabi triple in particular.

Also use this to do a better job of selecting soft FP settings.

Patch by Evgeniy Stepanov.

llvm-svn: 147872
This commit is contained in:
Chandler Carruth 2012-01-10 19:47:42 +00:00
parent 9a7510af46
commit c89aa9d964
3 changed files with 15 additions and 2 deletions

View File

@ -2374,7 +2374,7 @@ public:
bool isEABI() const {
StringRef Env = getContext().getTargetInfo().getTriple().getEnvironmentName();
return (Env == "gnueabi" || Env == "eabi");
return (Env == "gnueabi" || Env == "eabi" || Env == "androideabi");
}
private:

View File

@ -1164,7 +1164,10 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(const Driver &D)
SmallVectorImpl<StringRef> &Triples) {
if (HostArch == llvm::Triple::arm || HostArch == llvm::Triple::thumb) {
static const char *const ARMLibDirs[] = { "/lib" };
static const char *const ARMTriples[] = { "arm-linux-gnueabi" };
static const char *const ARMTriples[] = {
"arm-linux-gnueabi",
"arm-linux-androideabi"
};
LibDirs.append(ARMLibDirs, ARMLibDirs + llvm::array_lengthof(ARMLibDirs));
Triples.append(ARMTriples, ARMTriples + llvm::array_lengthof(ARMTriples));
} else if (HostArch == llvm::Triple::x86_64) {

View File

@ -517,6 +517,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
} else {
// Select the default based on the platform.
switch(Triple.getEnvironment()) {
case llvm::Triple::ANDROIDEABI:
case llvm::Triple::GNUEABI:
ABIName = "aapcs-linux";
break;
@ -589,6 +590,15 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
// EABI is always AAPCS, and if it was not marked 'hard', it's softfp
FloatABI = "softfp";
break;
case llvm::Triple::ANDROIDEABI: {
StringRef ArchName =
getLLVMArchSuffixForARM(getARMTargetCPU(Args, Triple));
if (ArchName.startswith("v7"))
FloatABI = "softfp";
else
FloatABI = "soft";
break;
}
default:
// Assume "soft", but warn the user we are guessing.
FloatABI = "soft";