Browse Source

+ Added compiler support for mipsel-android target.

git-svn-id: trunk@26686 -
yury 11 years ago
parent
commit
56b3287e29

+ 1 - 1
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

+ 1 - 1
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;
 

+ 1 - 1
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: '# ';

+ 1 - 1
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.

+ 3 - 0
compiler/mips/cputarg.pas

@@ -46,6 +46,9 @@ implementation
     {$ifndef NOTARGETLINUX}
       ,t_linux
     {$endif}
+    {$ifndef NOTARGETANDROID}
+      ,t_android
+    {$endif}
 
 {**************************************
              Assemblers

+ 17 - 0
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]);
 

+ 2 - 1
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

+ 6 - 2
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}

+ 68 - 0
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.

+ 6 - 0
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.

+ 2 - 1
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