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 }
       { 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]
       ait_ua_elf_const2str : array[aitconst_16bit_unaligned..aitconst_64bit_unaligned]
         of string[20]=(
         of string[20]=(
           #9'.2byte'#9,#9'.4byte'#9,#9'.8byte'#9
           #9'.2byte'#9,#9'.4byte'#9,#9'.8byte'#9

+ 1 - 1
compiler/hlcgobj.pas

@@ -3859,7 +3859,7 @@ implementation
 
 
   function use_ent : boolean;
   function use_ent : boolean;
     begin
     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);
 	             or (target_info.cpu=cpu_alpha);
     end;
     end;
 
 

+ 1 - 1
compiler/mips/cpugas.pas

@@ -380,7 +380,7 @@ unit cpugas;
         idtxt: 'AS';
         idtxt: 'AS';
         asmbin: 'as';
         asmbin: 'as';
         asmcmd: '$ABI $ARCH $NOWARN -EL $PIC -o $OBJ $EXTRAOPT $ASM';
         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];
         flags: [ af_needar, af_smartlink_sections];
         labelprefix: '.L';
         labelprefix: '.L';
         comment: '# ';
         comment: '# ';

+ 1 - 1
compiler/mips/cpuinfo.pas

@@ -1,7 +1,7 @@
 {
 {
     Copyright (c) 1998-2002 by the Free Pascal development team
     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,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.

+ 3 - 0
compiler/mips/cputarg.pas

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

+ 17 - 0
compiler/options.pas

@@ -3082,6 +3082,8 @@ begin
         utilsprefix:='arm-linux-androideabi-';
         utilsprefix:='arm-linux-androideabi-';
       system_i386_android:
       system_i386_android:
         utilsprefix:='i686-linux-android-';
         utilsprefix:='i686-linux-android-';
+      system_mipsel_android:
+        utilsprefix:='mipsel-linux-android-';
     end;
     end;
 
 
   { Set up default value for the heap }
   { Set up default value for the heap }
@@ -3410,6 +3412,21 @@ if (target_info.abi = abi_eabihf) then
     end;
     end;
 {$endif jvm}
 {$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 }
   { now we can define cpu and fpu type }
   def_system_macro('CPU'+Cputypestr[init_settings.cputype]);
   def_system_macro('CPU'+Cputypestr[init_settings.cputype]);
 
 

+ 2 - 1
compiler/systems.inc

@@ -159,7 +159,8 @@
              system_jvm_android32,      { 76 }
              system_jvm_android32,      { 76 }
              system_arm_android,        { 77 }
              system_arm_android,        { 77 }
              system_i386_android,       { 78 }
              system_i386_android,       { 78 }
-             system_i8086_msdos         { 79 }
+             system_i8086_msdos,        { 79 }
+             system_mipsel_android      { 80 }
        );
        );
 
 
      type
      type

+ 6 - 2
compiler/systems.pas

@@ -213,7 +213,7 @@ interface
        system_any = system_none;
        system_any = system_none;
 
 
        systems_wince = [system_arm_wince,system_i386_wince];
        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,
        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_arm_linux,system_sparc_linux,system_alpha_linux,system_m68k_linux,
                        system_x86_6432_linux,system_mipseb_linux,system_mipsel_linux];
                        system_x86_6432_linux,system_mipseb_linux,system_mipsel_linux];
@@ -890,7 +890,11 @@ begin
 
 
 {$ifdef mips}
 {$ifdef mips}
 {$ifdef mipsel}
 {$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}
 {$else mipsel}
   default_target(system_mipseb_linux);
   default_target(system_mipseb_linux);
 {$endif mipsel}
 {$endif mipsel}

+ 68 - 0
compiler/systems/i_android.pas

@@ -158,6 +158,69 @@ unit i_android;
             abi : abi_default
             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
 implementation
 
 
@@ -172,4 +235,9 @@ initialization
     set_source_info(system_arm_android_info);
     set_source_info(system_arm_android_info);
   {$endif android}
   {$endif android}
 {$endif CPUARM}
 {$endif CPUARM}
+{$ifdef CPUMIPSEL}
+  {$ifdef android}
+    set_source_info(system_mipsel_android_info);
+  {$endif android}
+{$endif CPUMIPSEL}
 end.
 end.

+ 6 - 0
compiler/systems/t_android.pas

@@ -121,6 +121,7 @@ procedure TLinkerAndroid.SetDefaultInfo;
 const
 const
 {$ifdef arm}       platform_select='';{$endif} {unknown :( }
 {$ifdef arm}       platform_select='';{$endif} {unknown :( }
 {$ifdef i386}      platform_select='';{$endif} {unknown :( }
 {$ifdef i386}      platform_select='';{$endif} {unknown :( }
+{$ifdef mipsel}    platform_select='';{$endif} {unknown :( }
 
 
 var
 var
   s: string;
   s: string;
@@ -435,5 +436,10 @@ initialization
   RegisterExport(system_i386_android,texportlibandroid);
   RegisterExport(system_i386_android,texportlibandroid);
   RegisterTarget(system_i386_android_info);
   RegisterTarget(system_i386_android_info);
 {$endif I386}
 {$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);
   RegisterRes(res_elf_info,TWinLikeResourceFile);
 end.
 end.

+ 2 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -161,7 +161,8 @@ const
   { 76 }  'Android-JVM',
   { 76 }  'Android-JVM',
   { 77 }  'Android-arm',
   { 77 }  'Android-arm',
   { 78 }  'Android-i386',
   { 78 }  'Android-i386',
-  { 79 }  'MSDOS-i8086'
+  { 79 }  'MSDOS-i8086',
+  { 79 }  'Android-MIPSel'
   );
   );
 
 
 const
 const