diff --git a/compiler/aggas.pas b/compiler/aggas.pas index dc58c5025b..be8350ab38 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -227,7 +227,7 @@ implementation ); { Generic unaligned pseudo-instructions, seems ELF specific } - use_ua_elf_systems = [system_mipsel_linux,system_mipseb_linux]; + use_ua_elf_systems = [system_mipsel_linux,system_mipseb_linux,system_mipsel_android]; ait_ua_elf_const2str : array[aitconst_16bit_unaligned..aitconst_64bit_unaligned] of string[20]=( #9'.2byte'#9,#9'.4byte'#9,#9'.8byte'#9 diff --git a/compiler/hlcgobj.pas b/compiler/hlcgobj.pas index 84047c4523..80214cdc3f 100644 --- a/compiler/hlcgobj.pas +++ b/compiler/hlcgobj.pas @@ -3859,7 +3859,7 @@ implementation function use_ent : boolean; begin - use_ent := (target_info.system in [system_mipsel_linux,system_mipseb_linux]) + use_ent := (target_info.system in [system_mipsel_linux,system_mipseb_linux,system_mipsel_android]) or (target_info.cpu=cpu_alpha); end; diff --git a/compiler/mips/cpugas.pas b/compiler/mips/cpugas.pas index 9f5aab8ff6..dfd9a825a9 100644 --- a/compiler/mips/cpugas.pas +++ b/compiler/mips/cpugas.pas @@ -380,7 +380,7 @@ unit cpugas; idtxt: 'AS'; asmbin: 'as'; asmcmd: '$ABI $ARCH $NOWARN -EL $PIC -o $OBJ $EXTRAOPT $ASM'; - supported_targets: [system_mipsel_linux]; + supported_targets: [system_mipsel_linux,system_mipsel_android]; flags: [ af_needar, af_smartlink_sections]; labelprefix: '.L'; comment: '# '; diff --git a/compiler/mips/cpuinfo.pas b/compiler/mips/cpuinfo.pas index c8e3aadd06..9af14932bc 100644 --- a/compiler/mips/cpuinfo.pas +++ b/compiler/mips/cpuinfo.pas @@ -1,7 +1,7 @@ { Copyright (c) 1998-2002 by the Free Pascal development team - Basic Processor information for the ARM + Basic Processor information for the MIPS See the file COPYING.FPC, included in this distribution, for details about the copyright. diff --git a/compiler/mips/cputarg.pas b/compiler/mips/cputarg.pas index a7743f040b..2bcb336e9f 100644 --- a/compiler/mips/cputarg.pas +++ b/compiler/mips/cputarg.pas @@ -46,6 +46,9 @@ implementation {$ifndef NOTARGETLINUX} ,t_linux {$endif} + {$ifndef NOTARGETANDROID} + ,t_android + {$endif} {************************************** Assemblers diff --git a/compiler/options.pas b/compiler/options.pas index ac6bd3db3f..4272d8f5b5 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -3082,6 +3082,8 @@ begin utilsprefix:='arm-linux-androideabi-'; system_i386_android: utilsprefix:='i686-linux-android-'; + system_mipsel_android: + utilsprefix:='mipsel-linux-android-'; end; { Set up default value for the heap } @@ -3410,6 +3412,21 @@ if (target_info.abi = abi_eabihf) then end; {$endif jvm} +{$ifdef mipsel} + case target_info.system of + system_mipsel_android: + begin + { set default cpu type to MIPS32 rev. 1 and hard float for MIPS-Android unless specified otherwise } + if not option.CPUSetExplicitly then + init_settings.cputype:=cpu_mips32; + if not option.OptCPUSetExplicitly then + init_settings.optimizecputype:=cpu_mips32; + if not option.FPUSetExplicitly then + init_settings.fputype:=fpu_mips2; + end; + end; +{$endif mipsel} + { now we can define cpu and fpu type } def_system_macro('CPU'+Cputypestr[init_settings.cputype]); diff --git a/compiler/systems.inc b/compiler/systems.inc index 10bbebab09..af258c0a83 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -159,7 +159,8 @@ system_jvm_android32, { 76 } system_arm_android, { 77 } system_i386_android, { 78 } - system_i8086_msdos { 79 } + system_i8086_msdos, { 79 } + system_mipsel_android { 80 } ); type diff --git a/compiler/systems.pas b/compiler/systems.pas index f3287d3951..a0f7bcb4b7 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -213,7 +213,7 @@ interface system_any = system_none; systems_wince = [system_arm_wince,system_i386_wince]; - systems_android = [system_arm_android, system_i386_android]; + systems_android = [system_arm_android, system_i386_android, system_mipsel_android]; systems_linux = [system_i386_linux,system_x86_64_linux,system_powerpc_linux,system_powerpc64_linux, system_arm_linux,system_sparc_linux,system_alpha_linux,system_m68k_linux, system_x86_6432_linux,system_mipseb_linux,system_mipsel_linux]; @@ -890,7 +890,11 @@ begin {$ifdef mips} {$ifdef mipsel} - default_target(system_mipsel_linux); + {$ifdef cpumipsel} + default_target(source_info.system); + {$else cpumipsel} + default_target(system_mipsel_linux); + {$endif cpumipsel} {$else mipsel} default_target(system_mipseb_linux); {$endif mipsel} diff --git a/compiler/systems/i_android.pas b/compiler/systems/i_android.pas index ce13495d19..162387de04 100644 --- a/compiler/systems/i_android.pas +++ b/compiler/systems/i_android.pas @@ -158,6 +158,69 @@ unit i_android; abi : abi_default ); + system_mipsel_android_info : tsysteminfo = + ( + system : system_mipsel_android; + name : 'Android for MIPSEL'; + shortname : 'Android'; + flags : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive, + tf_requires_proper_alignment,tf_pic_default, + tf_smartlink_sections,tf_smartlink_library,tf_has_winlike_resources]; + cpu : cpu_mipsel; + unit_env : 'ANDROIDUNITS'; + extradefines : 'UNIX;HASUNIX'; + exeext : ''; + defext : '.def'; + scriptext : '.sh'; + smartext : '.sl'; + unitext : '.ppu'; + unitlibext : '.ppl'; + asmext : '.s'; + objext : '.o'; + resext : '.res'; + resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; + staticlibprefix : 'libp'; + sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; + importlibprefix : 'libimp'; + importlibext : '.a'; + Cprefix : ''; + newline : #10; + dirsep : '/'; + assem : as_gas; + assemextern : as_gas; + link : ld_none; + linkextern : ld_android; + ar : ar_gnu_ar; + res : res_elf; + dbg : dbg_stabs; + script : script_unix; + endian : endian_little; + alignment : + ( + procalign : 4; + loopalign : 4; + jumpalign : 0; + constalignmin : 0; + constalignmax : 8; + varalignmin : 0; + varalignmax : 8; + localalignmin : 4; + localalignmax : 8; + recordalignmin : 0; + recordalignmax : 8; + maxCrecordalign : 8 + ); + first_parm_offset : 0; + stacksize : 32*1024*1024; + stackalign : 8; + abi : abi_default + ); implementation @@ -172,4 +235,9 @@ initialization set_source_info(system_arm_android_info); {$endif android} {$endif CPUARM} +{$ifdef CPUMIPSEL} + {$ifdef android} + set_source_info(system_mipsel_android_info); + {$endif android} +{$endif CPUMIPSEL} end. diff --git a/compiler/systems/t_android.pas b/compiler/systems/t_android.pas index ae8b193270..0646802de6 100644 --- a/compiler/systems/t_android.pas +++ b/compiler/systems/t_android.pas @@ -121,6 +121,7 @@ procedure TLinkerAndroid.SetDefaultInfo; const {$ifdef arm} platform_select='';{$endif} {unknown :( } {$ifdef i386} platform_select='';{$endif} {unknown :( } +{$ifdef mipsel} platform_select='';{$endif} {unknown :( } var s: string; @@ -435,5 +436,10 @@ initialization RegisterExport(system_i386_android,texportlibandroid); RegisterTarget(system_i386_android_info); {$endif I386} +{$ifdef MIPSEL} + RegisterImport(system_mipsel_android,timportlibandroid); + RegisterExport(system_mipsel_android,texportlibandroid); + RegisterTarget(system_mipsel_android_info); +{$endif MIPSEL} RegisterRes(res_elf_info,TWinLikeResourceFile); end. diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp index 0f79963d4f..a78f3638f9 100644 --- a/compiler/utils/ppuutils/ppudump.pp +++ b/compiler/utils/ppuutils/ppudump.pp @@ -161,7 +161,8 @@ const { 76 } 'Android-JVM', { 77 } 'Android-arm', { 78 } 'Android-i386', - { 79 } 'MSDOS-i8086' + { 79 } 'MSDOS-i8086', + { 79 } 'Android-MIPSel' ); const