diff --git a/src/compiler/fb.bas b/src/compiler/fb.bas index 16375ea7b..271bb5996 100644 --- a/src/compiler/fb.bas +++ b/src/compiler/fb.bas @@ -985,9 +985,14 @@ function fbIdentifyCpuFamily( byref cpufamilyid as string ) as integer function = -1 end function -function fbCpuTypeFromCpuFamilyId( byref cpufamilyid as string ) as integer +function fbDefaultCpuTypeFromCpuFamilyId( byval os as integer, byref cpufamilyid as string ) as integer var cpufamily = fbIdentifyCpuFamily( cpufamilyid ) if( cpufamily >= 0 ) then + if( (os = FB_COMPTARGET_ANDROID) and _ + (cpufamily = FB_CPUFAMILY_ARM) ) then + '' Special case: our default arm cpu should be armv5te on android + return FB_CPUTYPE_ARMV5TE + end if return cpufamilyinfo(cpufamily).defaultcputype end if function = -1 diff --git a/src/compiler/fb.bi b/src/compiler/fb.bi index 8a7834f5f..fba09b8ae 100644 --- a/src/compiler/fb.bi +++ b/src/compiler/fb.bi @@ -431,6 +431,7 @@ const FB_DEFAULT_CPUTYPE_X86 = FB_CPUTYPE_686 const FB_DEFAULT_CPUTYPE_X86_64 = FB_CPUTYPE_X86_64 '' default ARM CPU +'' A reasonable default for PCs, but on android is overridden to FB_CPUTYPE_ARMV5TE #ifdef BUILD_FB_DEFAULT_CPUTYPE_ARM const FB_DEFAULT_CPUTYPE_ARM = BUILD_FB_DEFAULT_CPUTYPE_ARM #else @@ -550,8 +551,8 @@ declare sub fbOverrideFilename(byval filename as zstring ptr) declare function fbGetTargetId( ) as string declare function fbGetHostId( ) as string declare function fbIdentifyOs( byref osid as string ) as integer -declare function fbIdentifyCpuFamily( byref osid as string ) as integer -declare function fbCpuTypeFromCpuFamilyId( byref cpufamilyid as string ) as integer +declare function fbIdentifyCpuFamily( byref cpufamilyid as string ) as integer +declare function fbDefaultCpuTypeFromCpuFamilyId( byval os as integer, byref cpufamilyid as string ) as integer declare function fbGetGccArch( ) as zstring ptr declare function fbGetFbcArch( ) as zstring ptr declare function fbIs64Bit( ) as integer diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index d97039396..ba4048fd8 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -1580,6 +1580,7 @@ private sub hParseGnuTriplet _ byref os as integer, _ byref cputype as integer _ ) + dim arch as string '' Search for OS, it be anywere in the triplet: '' mingw32 -> mingw @@ -1600,7 +1601,7 @@ private sub hParseGnuTriplet _ '' If the triplet has at least two components (-<...>), '' extract the first (the architecture) and try to identify it. if( separator > 0 ) then - var arch = left( arg, separator - 1 ) + arch = left( arg, separator - 1 ) for i as integer = 0 to ubound( gnuarchmap ) if( arch = *gnuarchmap(i).gnuid ) then cputype = gnuarchmap(i).cputype @@ -1609,6 +1610,10 @@ private sub hParseGnuTriplet _ next end if + '' Special case: our default arm cpu should be armv5te on android + if( (os = FB_COMPTARGET_ANDROID) and (arch = "arm") ) then + cputype = FB_CPUTYPE_ARMV5TE + end if end sub function fbCpuTypeFromGNUArchInfo( byref arch as string ) as integer @@ -1728,7 +1733,7 @@ private sub hParseTargetArg _ var separator = instr( arg, "-" ) if( separator > 0 ) then os = fbIdentifyOs( left( lcasearg, separator - 1 ) ) - cputype = fbCpuTypeFromCpuFamilyId( right( lcasearg, len( lcasearg ) - separator ) ) + cputype = fbDefaultCpuTypeFromCpuFamilyId( os, right( lcasearg, len( lcasearg ) - separator ) ) '' allow normalizing on gnu arch types to determine the standalone targetid #ifdef ENABLE_STANDALONE @@ -1920,6 +1925,7 @@ private sub handleOpt _ fbcAddObj( arg ) case OPT_ARCH + '' Set cputype later, so it overrides -target fbc.cputype_is_native = (arg = "native") fbc.cputype = fbIdentifyFbcArch( arg ) if( fbc.cputype < 0 ) then