From dc2182922308c621f80e5f0b9acba179c35c372e Mon Sep 17 00:00:00 2001 From: Jeff Marshall Date: Sat, 6 Jan 2024 20:01:46 -0500 Subject: [PATCH] android: make ARMv7a default for android-arm (again) When targetting android assume cross-compiling and armv7a - armv7a is the default arch for android ndk r11 and later. WIP: the gnu triplets are typically -- but it also varies a wildly and meaning can change between versions of tools. --- changelog.txt | 2 +- src/compiler/fb.bas | 9 ++------- src/compiler/fbc.bas | 26 ++++++++++++++------------ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3f66606ab..363c3103f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -27,7 +27,7 @@ Version 1.20.0 - gfxlib2: added fb.GET_X86_MMX_ENABLED = 18 constant to fbgfx.bi - used with ScreenControl to determine if MMX blitters are selected on x86 32 bit. If returned value is non-zero, then MMX is enabled. If zero, then MMX is disabled. All other platforms return zero. - gfxlib2: added fb.SET_X86_MMX_ENABLED = 118 constant to fbgfx.bi - used with ScreenControl to specific if MMX blitters should be used on x86 32-bit. Pass non-zero value to enable, and zero value to disable. All other platforms ignore this setting - darwin: inc/darwin (WIP) Use linux versions of various crt headers; can include crt.bi now -- Add "-arch armv5te" cpu type option, and several arch aliases: x86 (for 686), armeabi and armv5 (for armv5te), armv7 and armv7a (for armv7-a) +- Add "-arch armv5te" cpu type option, and several arch aliases: x86 (for 686), armeabi and armv5 (for armv5te), armeabi-v7a, armv7 and armv7a (for armv7-a) - Android support. Commandline executables and shared/static libraries only; gfxlib (graphical/audio commands) and also console commands like "color" are not supported, nor does the android libc support locales for string<->wstring conversion. THREADCALL is also not enabled. The default target abi is armeabi; use arch=x86, arch=armv7a, or arch=aarch64 to target a different abi. - "-fpu neon" option for ARM archs (passed through to gcc). - -pic option (position-independent code) is now allowed on x86 (where it forces -gen gcc) and when building executables (in which case it passes -pie option to ld to produce position independent executables) diff --git a/src/compiler/fb.bas b/src/compiler/fb.bas index fee3b13a6..9068a266f 100644 --- a/src/compiler/fb.bas +++ b/src/compiler/fb.bas @@ -988,11 +988,6 @@ end function 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 @@ -1067,9 +1062,9 @@ function fbIdentifyFbcArch( byref fbcarch as string ) as integer function = FB_CPUTYPE_686 case "x86_64", "amd64" function = FB_CPUTYPE_X86_64 - case "armv5", "armv5te" + case "armv5", "armeabi" function = FB_CPUTYPE_ARMV5TE - case "armeabi", "armv7a", "armv7" + case "armeabi-v7a", "armv7a", "armv7" function = FB_CPUTYPE_ARMV7A case else function = -1 diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index 9187486c0..303d6976d 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -1661,11 +1661,6 @@ 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 @@ -1697,15 +1692,15 @@ dim shared as FBOSARCHINFO fbosarchmap(0 to ...) => _ _ '' OS given without arch, using the default arch, except for dos/xbox _ '' which only work with x86, so we can always default to x86 for them. _ '' (these are supported for backwards compatibility with x86-only FB) - _ '' When targetting android assume cross-compiling. armv5te is the most - _ '' portable arch, supported even on x86 devices via emulation. + _ '' When targetting android assume cross-compiling. + _ '' armv7a is the default arch for android ndk r11 and later (@"dos" , FB_COMPTARGET_DOS , FB_DEFAULT_CPUTYPE_X86 ), _ (@"xbox" , FB_COMPTARGET_XBOX , FB_DEFAULT_CPUTYPE_X86 ), _ (@"cygwin" , FB_COMPTARGET_CYGWIN , FB_DEFAULT_CPUTYPE ), _ (@"darwin" , FB_COMPTARGET_DARWIN , FB_DEFAULT_CPUTYPE ), _ (@"freebsd", FB_COMPTARGET_FREEBSD, FB_DEFAULT_CPUTYPE ), _ (@"linux" , FB_COMPTARGET_LINUX , FB_DEFAULT_CPUTYPE ), _ - (@"android", FB_COMPTARGET_ANDROID, FB_CPUTYPE_ARMV5TE ), _ + (@"android", FB_COMPTARGET_ANDROID, FB_CPUTYPE_ARMV7A ), _ (@"netbsd" , FB_COMPTARGET_NETBSD , FB_DEFAULT_CPUTYPE ), _ (@"openbsd", FB_COMPTARGET_OPENBSD, FB_DEFAULT_CPUTYPE ) _ } @@ -1725,10 +1720,17 @@ dim shared as FBOSARCHINFO fbosarchmap(0 to ...) => _ '' '' The normal (non-standalone) build also accepts GNU triplets: '' (the rough format is -- but it can vary a lot) -'' -target i686-pc-linux-gnu -> Linux + i686 -'' -target arm-linux-gnueabihf -> Linux + default ARM arch -'' -target arm-linux-androideabi -> Android + ARMv5te/ARM eabi -'' -target x86_64-w64-mingw32 -> Windows + x86_64 +'' -target i686-pc-linux-gnu -> Linux + i686 +'' -target arm-linux-gnueabihf -> Linux + default ARM arch +'' -target arm-android -> android-arm, armv7-a, 32bit +'' -target android -arch armv5 -> android-arm, armv5te, 32bit +'' -target armv5te-linux-android -> android-arm, armv5te, 32bit +'' -target android -arch armv7 -> android-arm, armv7-a, 32bit +'' -target arm-linux-android -> android-arm, armv7-a, 32bit +'' -target armv7a-linux-android -> android-arm, armv7-a, 32bit +'' -target armv7a-linux-androideabi -> android-arm, armv7-a, 32bit +'' -target i686-linux-android -> android-x86, 686, 32bit +'' -target x86_64-w64-mingw32 -> Windows + x86_64 '' ... '' '' The normal build uses the -target argument as prefix for binutils/gcc tools.