Skip to content

Commit

Permalink
android: make ARMv7a default for android-arm (again)
Browse files Browse the repository at this point in the history
  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 <arch>-<vendor>-<os>
       but it also varies a wildly and meaning can change
       between versions of tools.
  • Loading branch information
jayrm committed Jan 7, 2024
1 parent b792536 commit dc21829
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion changelog.txt
Expand Up @@ -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)
Expand Down
9 changes: 2 additions & 7 deletions src/compiler/fb.bas
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
26 changes: 14 additions & 12 deletions src/compiler/fbc.bas
Expand Up @@ -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
Expand Down Expand Up @@ -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 ) _
}
Expand All @@ -1725,10 +1720,17 @@ dim shared as FBOSARCHINFO fbosarchmap(0 to ...) => _
''
'' The normal (non-standalone) build also accepts GNU triplets:
'' (the rough format is <arch>-<vendor>-<os> 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.
Expand Down

0 comments on commit dc21829

Please sign in to comment.