From a1194cb636ca058cc3d11f17200fd757302aca67 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 23 Mar 2018 11:27:04 -0700 Subject: Use ABI_STRING. Bug: N/A Test: builds Change-Id: I5a9d2a6604887f1f0e9583086e012a086042b7df --- cmds/app_process/app_main.cpp | 18 ++---------------- core/jni/AndroidRuntime.cpp | 21 +++------------------ 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp index 1671337511b7..12083b6fe20b 100644 --- a/cmds/app_process/app_main.cpp +++ b/cmds/app_process/app_main.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -137,27 +138,12 @@ static size_t computeArgBlockSize(int argc, char* const argv[]) { } static void maybeCreateDalvikCache() { -#if defined(__aarch64__) - static const char kInstructionSet[] = "arm64"; -#elif defined(__x86_64__) - static const char kInstructionSet[] = "x86_64"; -#elif defined(__arm__) - static const char kInstructionSet[] = "arm"; -#elif defined(__i386__) - static const char kInstructionSet[] = "x86"; -#elif defined (__mips__) && !defined(__LP64__) - static const char kInstructionSet[] = "mips"; -#elif defined (__mips__) && defined(__LP64__) - static const char kInstructionSet[] = "mips64"; -#else -#error "Unknown instruction set" -#endif const char* androidRoot = getenv("ANDROID_DATA"); LOG_ALWAYS_FATAL_IF(androidRoot == NULL, "ANDROID_DATA environment variable unset"); char dalvikCacheDir[PATH_MAX]; const int numChars = snprintf(dalvikCacheDir, PATH_MAX, - "%s/dalvik-cache/%s", androidRoot, kInstructionSet); + "%s/dalvik-cache/" ABI_STRING, androidRoot); LOG_ALWAYS_FATAL_IF((numChars >= PATH_MAX || numChars < 0), "Error constructing dalvik cache : %s", strerror(errno)); diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 3784d4daa2e9..6c46cfc751b0 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -20,6 +20,7 @@ #include +#include #include #include #include @@ -860,34 +861,18 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote) // The runtime will compile a boot image, when necessary, not using installd. Thus, we need to // pass the instruction-set-features/variant as an image-compiler-option. - // TODO: Find a better way for the instruction-set. -#if defined(__arm__) - constexpr const char* instruction_set = "arm"; -#elif defined(__aarch64__) - constexpr const char* instruction_set = "arm64"; -#elif defined(__mips__) && !defined(__LP64__) - constexpr const char* instruction_set = "mips"; -#elif defined(__mips__) && defined(__LP64__) - constexpr const char* instruction_set = "mips64"; -#elif defined(__i386__) - constexpr const char* instruction_set = "x86"; -#elif defined(__x86_64__) - constexpr const char* instruction_set = "x86_64"; -#else - constexpr const char* instruction_set = "unknown"; -#endif // Note: it is OK to reuse the buffer, as the values are exactly the same between // * compiler-option, used for runtime compilation (DexClassLoader) // * image-compiler-option, used for boot-image compilation on device // Copy the variant. - sprintf(dex2oat_isa_variant_key, "dalvik.vm.isa.%s.variant", instruction_set); + sprintf(dex2oat_isa_variant_key, "dalvik.vm.isa.%s.variant", ABI_STRING); parseCompilerOption(dex2oat_isa_variant_key, dex2oat_isa_variant, "--instruction-set-variant=", "-Ximage-compiler-option"); parseCompilerOption(dex2oat_isa_variant_key, dex2oat_isa_variant, "--instruction-set-variant=", "-Xcompiler-option"); // Copy the features. - sprintf(dex2oat_isa_features_key, "dalvik.vm.isa.%s.features", instruction_set); + sprintf(dex2oat_isa_features_key, "dalvik.vm.isa.%s.features", ABI_STRING); parseCompilerOption(dex2oat_isa_features_key, dex2oat_isa_features, "--instruction-set-features=", "-Ximage-compiler-option"); parseCompilerOption(dex2oat_isa_features_key, dex2oat_isa_features, -- cgit v1.2.3-59-g8ed1b