Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -6585,6 +6585,30 @@ }; } // end anonymous namespace. +namespace { +// x86_32 Android target +class AndroidX86_32TargetInfo : public LinuxTargetInfo { +public: + AndroidX86_32TargetInfo(const llvm::Triple &Triple) + : LinuxTargetInfo(Triple) { + SuitableAlign = 32; + LongDoubleWidth = 64; + LongDoubleFormat = &llvm::APFloat::IEEEdouble; + } +}; +} // end anonymous namespace + +namespace { +// x86_64 Android target +class AndroidX86_64TargetInfo : public LinuxTargetInfo { +public: + AndroidX86_64TargetInfo(const llvm::Triple &Triple) + : LinuxTargetInfo(Triple) { + LongDoubleFormat = &llvm::APFloat::IEEEquad; + } +}; +} // end anonymous namespace + //===----------------------------------------------------------------------===// // Driver code @@ -6862,8 +6886,14 @@ return new DarwinI386TargetInfo(Triple); switch (os) { - case llvm::Triple::Linux: - return new LinuxTargetInfo(Triple); + case llvm::Triple::Linux: { + switch (Triple.getEnvironment()) { + default: + return new LinuxTargetInfo(Triple); + case llvm::Triple::Android: + return new AndroidX86_32TargetInfo(Triple); + } + } case llvm::Triple::DragonFly: return new DragonFlyBSDTargetInfo(Triple); case llvm::Triple::NetBSD: @@ -6910,8 +6940,14 @@ switch (os) { case llvm::Triple::CloudABI: return new CloudABITargetInfo(Triple); - case llvm::Triple::Linux: - return new LinuxTargetInfo(Triple); + case llvm::Triple::Linux: { + switch (Triple.getEnvironment()) { + default: + return new LinuxTargetInfo(Triple); + case llvm::Triple::Android: + return new AndroidX86_64TargetInfo(Triple); + } + } case llvm::Triple::DragonFly: return new DragonFlyBSDTargetInfo(Triple); case llvm::Triple::NetBSD: Index: test/Sema/i386-linux-android.c =================================================================== --- /dev/null +++ test/Sema/i386-linux-android.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple i386-linux-android -fsyntax-only -verify %s +// expected-no-diagnostics + +extern int a1_0[sizeof(long double) == 8 ? 1 : -1]; +extern int a1_i[__alignof(long double) == 4 ? 1 : -1]; + Index: test/Sema/x86_64-linux-android.c =================================================================== --- /dev/null +++ test/Sema/x86_64-linux-android.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64-linux-android -emit-pch -o %t %s +// RUN: %clang_cc1 -x ast -ast-print %t | FileCheck %s + +extern int a1_0[sizeof(long double) == 16 ? 1 : -1]; +extern int a1_i[__alignof(long double) == 16 ? 1 : -1]; + +// Verify that long double is 128 bit IEEEquad + +long double foo = 1.0E4000L; +// CHECK: long double foo = 1.00000000000000000000000000000000004E+4000L;