[fpc-devel] [Core] Haiku merges: Revision 42117

Pierre Muller pierre at freepascal.org
Mon May 27 10:54:47 CEST 2019


  The merge of the two commits generate 3 conflicts, but those are easily solved.
See attached patch.

  Olivier, did you test the fixes_3_2 branch?
Do you think it is reasonable to enable x86_64-haiku target in that branch?

  charlie, you wrote those patches, thus
it is probably best if you or Olivier decide:
Should I merge them?

Pierre


Le 26/05/2019 à 15:17, Pierre Muller a écrit :
>   Hi al,
> 
> almost every haiku RTL changes have been merged,
> but there are also two compiler changes:
> 
> [muller at gcc121 pas]$ svn log -v -c 40753 trunk/fpcsrc/
> ------------------------------------------------------------------------
> r40753 | karoly | 2019-01-04 02:16:24 +0000 (Fri, 04 Jan 2019) | 1 line
> Changed paths:
>    M /trunk/compiler/options.pas
>    M /trunk/compiler/systems/i_haiku.pas
>    M /trunk/compiler/systems/t_haiku.pas
>    M /trunk/compiler/systems.inc
>    M /trunk/compiler/utils/ppuutils/ppudump.pp
>    M /trunk/compiler/x86/agx86att.pas
>    M /trunk/compiler/x86_64/cpuelf.pas
>    M /trunk/compiler/x86_64/cputarg.pas
>    M /trunk/packages/fpmkunit/src/fpmkunit.pp
>    M /trunk/utils/fpcm/fpcmmain.pp
> 
> haiku-x86_64: add target to the compiler and ppudump, enable it in fpmake and fpcmake
> ------------------------------------------------------------------------
> [muller at gcc121 pas]$ svn log -v -c 40756 trunk/fpcsrc/
> ------------------------------------------------------------------------
> r40756 | karoly | 2019-01-04 03:00:03 +0000 (Fri, 04 Jan 2019) | 1 line
> Changed paths:
>    M /trunk/compiler/systems/t_haiku.pas
>    M /trunk/compiler/systems.pas
> 
> haiku: linker support code for internal sysinit and make the x86_64 port use it
> ------------------------------------------------------------------------
> 
> 
> Shoudln't these two be also merged to fixes?
> 
> 
> Pierre
> 
> 
> 
> <https://svn.freepascal.org/cgi-bin/viewvc.cgi?root=fpc&view=rev&rev=42117>
> 
> _______________________________________________
> core site list
> core at freepascal.org
> https://idefix.freepascal.org/cgi-bin/mailman/listinfo/core
> 
-------------- next part --------------
Index: .
===================================================================
--- .	(revision 42129)
+++ .	(working copy)

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40753,40756
Index: compiler/options.pas
===================================================================
--- compiler/options.pas	(revision 42129)
+++ compiler/options.pas	(working copy)
@@ -138,7 +138,7 @@
                         + [system_i386_wdosx];
 
   suppported_targets_x_smallr = systems_linux + systems_solaris + systems_android
-                             + [system_i386_haiku]
+                             + [system_i386_haiku,system_x86_64_haiku]
                              + [system_i386_beos]
                              + [system_m68k_amiga];
 
Index: compiler/systems/i_haiku.pas
===================================================================
--- compiler/systems/i_haiku.pas	(revision 42129)
+++ compiler/systems/i_haiku.pas	(working copy)
@@ -105,6 +105,76 @@
             llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32';
           );
 
+    const
+       system_x86_64_haiku_info : tsysteminfo =
+          (
+            system       : system_x86_64_Haiku;
+            name         : 'Haiku for x86_64';
+            shortname    : 'Haiku';
+            flags        : [tf_under_development,tf_needs_symbol_size,tf_files_case_sensitive,
+                            tf_pic_default,tf_library_needs_pic,tf_smartlink_sections,
+                            tf_has_winlike_resources];
+            cpu          : cpu_x86_64;
+            unit_env     : 'HAIKUUNITS';
+            extradefines : 'BEOS;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_x86_64_elf64;
+            assemextern  : as_gas;
+            link         : ld_none;
+            linkextern   : ld_haiku;
+            ar           : ar_gnu_ar;
+            res          : res_elf;
+            dbg          : dbg_stabs;
+            script       : script_unix;
+            endian       : endian_little;
+            { FIXME: stuff below is copied from Linux/x64 now, could be incorrect for Haiku (KB) }
+            alignment    :
+              (
+                procalign       : 16;
+                loopalign       : 8;
+                jumpalign       : 16;
+                jumpalignskipmax    : 10;
+                coalescealign   : 0;
+                coalescealignskipmax: 0;
+                constalignmin   : 0;
+                constalignmax   : 16;
+                varalignmin     : 0;
+                varalignmax     : 16;
+                localalignmin   : 4;
+                localalignmax   : 16;
+                recordalignmin  : 0;
+                recordalignmax  : 16;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 16;
+            stacksize    : 16 * 1024 * 1024;
+            stackalign   : 16;
+            abi : abi_default;
+            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-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128';
+          );
+
   implementation
 
 initialization
@@ -113,4 +183,9 @@
     set_source_info(system_i386_haiku_info);
   {$endif haiku}
 {$endif cpui386}
+{$ifdef cpux86_64}
+  {$ifdef haiku}
+    set_source_info(system_x86_64_haiku_info);
+  {$endif haiku}
+{$endif cpux86_64}
 end.
Index: compiler/systems/t_haiku.pas
===================================================================
--- compiler/systems/t_haiku.pas	(revision 42129)
+++ compiler/systems/t_haiku.pas	(working copy)
@@ -49,6 +49,7 @@
     public
       constructor Create;override;
       procedure SetDefaultInfo;override;
+      procedure InitSysInitUnitName;override;
       function  MakeExecutable:boolean;override;
       function  MakeSharedLibrary:boolean;override;
     end;
@@ -224,6 +225,14 @@
 end;
 
 
+procedure TLinkerHaiku.InitSysInitUnitName;
+const
+  SysInitUnitNames: array[boolean] of string[15] = ( 'si_c', 'si_dllc' );
+begin
+  sysinitunit:=SysInitUnitNames[current_module.islibrary];
+end;
+
+
 function TLinkerHaiku.WriteResponseFile(isdll:boolean;makelib:boolean) : Boolean;
 Var
   linkres  : TLinkRes;
@@ -238,8 +247,6 @@
 { set special options for some targets }
   linklibc:=(SharedLibFiles.Find('root')<>nil);
 
-  prtobj:='prt0';
-  cprtobj:='cprt0';
   if (cs_profile in current_settings.moduleswitches) or
      (not SharedLibFiles.Empty) then
    begin
@@ -247,20 +254,27 @@
      linklibc:=true;
    end;
 
-  if (not linklibc) and makelib then
-   begin
-     linklibc:=true;
-     cprtobj:='dllprt.o';
-   end
-  else if makelib then
-   begin
-     // Making a dll with libc linking. Should be always the case under Haiku.
-     cprtobj:='dllcprt0';
-   end;
-   
+  prtobj:='';
+  cprtobj:='';
+  if not (target_info.system in systems_internal_sysinit) then
+    begin
+      prtobj:='prt0';
+      cprtobj:='cprt0';
 
+      if (not linklibc) and makelib then
+        begin
+          linklibc:=true;
+          cprtobj:='dllprt.o';
+        end
+      else if makelib then
+        begin
+          // Making a dll with libc linking. Should be always the case under Haiku.
+          cprtobj:='dllcprt0';
+        end;
+    end;
+
   if linklibc then
-   prtobj:=cprtobj;
+    prtobj:=cprtobj;
 
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,false);
@@ -271,7 +285,11 @@
    LinkRes.Add('ld -o $1 -e 0 $2 $3 $4 $5 $6 $7 $8 $9\');
   }
   LinkRes.Add('-m');
+{$ifdef i386}
   LinkRes.Add('elf_i386_haiku');
+{$else i386}
+  LinkRes.Add('elf_x86_64_haiku');
+{$endif i386}
   LinkRes.Add('-shared');
   LinkRes.Add('-Bsymbolic');
 
@@ -519,4 +537,9 @@
   RegisterExport(system_i386_haiku,texportlibhaiku);
   RegisterTarget(system_i386_haiku_info);
 {$endif i386}
+{$ifdef x86_64}
+  RegisterImport(system_x86_64_haiku,timportlibhaiku);
+  RegisterExport(system_x86_64_haiku,texportlibhaiku);
+  RegisterTarget(system_x86_64_haiku_info);
+{$endif x86_64}
 end.
Index: compiler/systems.inc
===================================================================
--- compiler/systems.inc	(revision 42129)
+++ compiler/systems.inc	(working copy)
@@ -185,7 +185,8 @@
              system_riscv64_embedded,   { 98 }
              system_riscv32_embedded,   { 99 }
              system_aarch64_android,    { 100 }
-             system_x86_64_android      { 101 }
+             system_x86_64_android,     { 101 }
+             system_x86_64_haiku        { 102 }
        );
 
      type
Index: compiler/utils/ppuutils/ppudump.pp
===================================================================
--- compiler/utils/ppuutils/ppudump.pp	(revision 42129)
+++ compiler/utils/ppuutils/ppudump.pp	(working copy)
@@ -187,7 +187,8 @@
   { 98 }  'Embedded-RiscV32',
   { 99 }  'Embedded-RiscV64',
   { 100 } 'Android-AArch64',
-  { 101 } 'Android-x86-64'
+  { 101 } 'Android-x86-64',
+  { 102 } 'Haiku-x86-64'
   );
 
 const
Index: compiler/x86/agx86att.pas
===================================================================
--- compiler/x86/agx86att.pas	(revision 42129)
+++ compiler/x86/agx86att.pas	(working copy)
@@ -383,7 +383,7 @@
                                  system_x86_64_win64,system_x86_64_embedded,
                                  system_x86_64_openbsd,system_x86_64_netbsd,
                                  system_x86_64_dragonfly,system_x86_64_aros,
-                                 system_x86_64_android];
+                                 system_x86_64_android,system_x86_64_haiku];
             flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
             labelprefix : '.L';
             comment : '# ';
Index: compiler/x86_64/cpuelf.pas
===================================================================
--- compiler/x86_64/cpuelf.pas	(revision 42129)
+++ compiler/x86_64/cpuelf.pas	(working copy)
@@ -677,7 +677,8 @@
         supported_targets : [system_x86_64_linux,system_x86_64_freebsd,
                              system_x86_64_openbsd,system_x86_64_netbsd,
                              system_x86_64_dragonfly,system_x86_64_solaris,
-                             system_x86_64_aros,system_x86_64_android];
+                             system_x86_64_aros,system_x86_64_android,
+                             system_x86_64_haiku];
         flags : [af_outputbinary,af_smartlink_sections,af_supports_dwarf];
         labelprefix : '.L';
         comment : '';
Index: compiler/x86_64/cputarg.pas
===================================================================
--- compiler/x86_64/cputarg.pas	(revision 42129)
+++ compiler/x86_64/cputarg.pas	(working copy)
@@ -54,6 +54,9 @@
     {$ifndef NOTARGETAROS}
       ,t_aros
     {$endif}
+    {$ifndef NOTARGETHAIKU}
+      ,t_haiku
+    {$endif}
     {$ifndef NOTARGETEMBEDDED}
       ,t_embed
     {$endif}
Index: packages/fpmkunit/src/fpmkunit.pp
===================================================================
--- packages/fpmkunit/src/fpmkunit.pp	(revision 42129)
+++ packages/fpmkunit/src/fpmkunit.pp	(working copy)
@@ -215,7 +215,7 @@
     { nds    }  ( false, false, false, false, false, false, true,  false, false, false, false, false, false, false, false, false),
     { embedded }( false, true,  true,  true,  true,  true,  true,  true,  true,  true , false, true , false, true , false, false),
     { symbian } ( false, true,  false, false, false, false, true,  false, false, false, false, false, false, false, false, false),
-    { haiku }   ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false, false, false),
+    { haiku }   ( false, true,  false, false, false, true,  false, false, false, false, false, false, false, false, false, false),
     { iphonesim}( false, true,  false, false, false, true,  false, false, false, false, false, false, false, false, false, false),
     { aix    }  ( false, false, false, true,  false, false, false, true,  false, false, false, false, false, false, false, false),
     { java }    ( false, false, false, false, false, false, false, false, false, false, false, false, true , false, false, false),
Index: utils/fpcm/fpcmmain.pp
===================================================================
--- utils/fpcm/fpcmmain.pp	(revision 42129)
+++ utils/fpcm/fpcmmain.pp	(working copy)
@@ -116,7 +116,7 @@
         { os2 }     ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false),
         { freebsd } ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, false, false, false),
         { beos }    ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false),
-        { haiku }   ( true,  false, false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false),
+        { haiku }   ( true,  false, false, false, true,  false, false, false, false, false, false, false, false, false,   false, false, false, false, false),
         { netbsd }  ( true,  true,  true,  true,  true,  true,  false, false, false, false, false, false, false, false,   false, false, false, false, false),
         { amiga }   ( false, true,  true,  false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false),
         { atari }   ( false, true,  false, false, false, false, false, false, false, false, false, false, false, false,   false, false, false, false, false),


More information about the fpc-devel mailing list