Ver Fonte

+ basic xtensa-linux support in the compiler

git-svn-id: trunk@44611 -
florian há 5 anos atrás
pai
commit
e8fabb752a

+ 2 - 1
compiler/systems.inc

@@ -192,7 +192,8 @@
              system_x86_64_android,     { 101 }
              system_x86_64_haiku,       { 102 }
              system_xtensa_embedded,    { 103 }
-             system_xtensa_freertos     { 104 }
+             system_xtensa_freertos,    { 104 }
+             system_xtensa_linux        { 105 }
        );
 
      type

+ 76 - 0
compiler/systems/i_linux.pas

@@ -1243,6 +1243,76 @@ unit i_linux;
             llvmdatalayout : 'E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:64:64-v128:128:128-n32:64';
           );
 
+       system_xtensa_linux_info : tsysteminfo =
+          (
+            system       : system_xtensa_linux;
+            name         : 'Linux for Xtensa';
+            shortname    : 'Linux';
+            flags        : [tf_needs_symbol_size,tf_smartlink_sections,
+                            tf_needs_symbol_type,tf_files_case_sensitive,
+                            tf_requires_proper_alignment,tf_has_winlike_resources,
+                            tf_supports_hidden_symbols];
+            cpu          : cpu_xtensa;
+            unit_env     : 'LINUXUNITS';
+            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';
+//            p_ext_support : false;
+            Cprefix      : '';
+            newline      : #10;
+            dirsep       : '/';
+            assem        : as_gas;
+            assemextern  : as_gas;
+            link         : ld_none;
+            linkextern   : ld_linux;
+            ar           : ar_gnu_ar;
+            res          : res_elf;
+            dbg          : dbg_dwarf2;
+            script       : script_unix;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 4;
+                loopalign       : 4;
+                jumpalign       : 0;
+                jumpalignskipmax    : 0;
+                coalescealign   : 0;
+                coalescealignskipmax: 0;
+                constalignmin   : 0;
+                constalignmax   : 8;
+                varalignmin     : 0;
+                varalignmax     : 8;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 8;
+                maxCrecordalign : 8
+              );
+            first_parm_offset : 0;
+            stacksize    : 32*1024*1024;
+            stackalign   : 16;
+            abi : abi_xtensa_windowed;
+            llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64';
+          );
+
   implementation
 
 initialization
@@ -1319,4 +1389,10 @@ initialization
     set_source_info(system_riscv64_linux_info);
   {$endif linux}
 {$endif CPURISCV64}
+{$ifdef CPUXTENSA}
+  {$ifdef linux}
+    set_source_info(system_xtensa_linux_info);
+  {$endif linux}
+{$endif CPUXTENSA}
 end.
+

+ 12 - 0
compiler/systems/t_linux.pas

@@ -253,10 +253,15 @@ const defdynlinker='/lib/ld-linux-aarch64.so.1';
 {$ifdef riscv32}
   const defdynlinker='/lib32/ld.so.1';
 {$endif riscv32}
+
 {$ifdef riscv64}
   const defdynlinker='/lib/ld-linux-riscv64-lp64d.so.1';
 {$endif riscv64}
 
+{$ifdef xtensa}
+  const defdynlinker='/lib/ld.so.1';
+{$endif xtensa}
+
 
 procedure SetupDynlinker(out DynamicLinker:string;out libctype:TLibcType);
 begin
@@ -363,6 +368,7 @@ const
 {$endif}
 {$ifdef riscv32}   platform_select='-m elf32lriscv';{$endif}
 {$ifdef riscv64}   platform_select='-m elf64lriscv';{$endif}
+{$ifdef xtensa}    platform_select='';{$endif}
 
 var
   platformopt: string;
@@ -2029,5 +2035,11 @@ initialization
   RegisterExport(system_riscv64_linux,texportliblinux);
   RegisterTarget(system_riscv64_linux_info);
 {$endif riscv64}
+{$ifdef xtensa}
+  RegisterImport(system_xtensa_linux,timportliblinux);
+  RegisterExport(system_xtensa_linux,texportliblinux);
+  RegisterTarget(system_xtensa_linux_info);
+{$endif xtensa}
   RegisterRes(res_elf_info,TWinLikeResourceFile);
 end.
+

+ 9 - 1
compiler/xtensa/cputarg.pas

@@ -36,7 +36,15 @@ implementation
 **************************************}
 
     {$ifndef NOTARGETEMBEDDED}
-      ,t_embed,t_freertos
+      ,t_embed
+    {$endif}
+
+    {$ifndef NOTARGETFREERTOS}
+      ,t_freertos
+    {$endif}
+
+    {$ifndef NOTARGETLINUX}
+      ,t_linux
     {$endif}
 
 {**************************************