Use ABI_STRING.

Bug: N/A
Test: builds
Change-Id: I5a9d2a6604887f1f0e9583086e012a086042b7df
This commit is contained in:
Elliott Hughes
2018-03-23 11:27:04 -07:00
parent 6941fcd88c
commit a1194cb636
2 changed files with 5 additions and 34 deletions

View File

@@ -13,6 +13,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <android-base/macros.h>
#include <binder/IPCThreadState.h>
#include <hwbinder/IPCThreadState.h>
#include <utils/Log.h>
@@ -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));

View File

@@ -20,6 +20,7 @@
#include <android_runtime/AndroidRuntime.h>
#include <android-base/macros.h>
#include <android-base/properties.h>
#include <binder/IBinder.h>
#include <binder/IPCThreadState.h>
@@ -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,