Merge "[MIPS] Link .dex or .oat code lacking .MIPS.abiflags segment"

This commit is contained in:
Elliott Hughes 2015-08-03 15:17:18 +00:00 committed by Gerrit Code Review
commit 2278d29ada

View file

@ -264,10 +264,18 @@ bool soinfo::mips_check_and_adjust_fp_modes() {
// FP ABI-variant compatibility checks for MIPS o32 ABI // FP ABI-variant compatibility checks for MIPS o32 ABI
if (abiflags == nullptr) { if (abiflags == nullptr) {
// Old compiles lack the new abiflags section. // Old compilers and some translators don't emit the new abiflags section.
// These compilers used -mfp32 -mdouble-float -modd-spreg defaults, const char* filename = get_realpath();
// ie FP32 aka DOUBLE, using odd-numbered single-prec regs size_t len = strlen(filename);
mips_fpabi = MIPS_ABI_FP_DOUBLE; if (len > 4 && (strcmp(filename+len-4, ".dex") == 0 ||
strcmp(filename+len-4, ".oat") == 0 )) {
// Assume dex2oat is compatible with target
mips_fpabi = MIPS_ABI_FP_XX;
} else {
// Old Android compilers used -mfp32 -mdouble-float -modd-spreg defaults,
// ie FP32 aka DOUBLE, using FR=0 mode fpregs & odd single-prec fpregs
mips_fpabi = MIPS_ABI_FP_DOUBLE;
}
} else { } else {
mips_fpabi = abiflags->fp_abi; mips_fpabi = abiflags->fp_abi;
if ( (abiflags->flags1 & MIPS_AFL_FLAGS1_ODDSPREG) if ( (abiflags->flags1 & MIPS_AFL_FLAGS1_ODDSPREG)