ソースを参照

* freebsd support merged

peter 25 年 前
コミット
4003cdb728
7 ファイル変更128 行追加23 行削除
  1. 11 5
      compiler/cgai386.pas
  2. 9 1
      compiler/export.pas
  3. 10 2
      compiler/import.pas
  4. 11 1
      compiler/link.pas
  5. 14 1
      compiler/options.pas
  6. 6 2
      compiler/ra386.pas
  7. 67 11
      compiler/systems.pas

+ 11 - 5
compiler/cgai386.pas

@@ -2742,6 +2742,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
       if (po_assembler in aktprocsym^.definition^.procoptions) then
        exit;
       case target_info.target of
+         target_i386_freebsd,
          target_i386_linux:
            begin
               getaddrlabel(pl);
@@ -3388,7 +3389,8 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                       if (cs_littlesize in aktglobalswitches) and (stackframe<=65535) then
                           begin
                               if (cs_check_stack in aktlocalswitches) and
-                                 not(target_info.target in [target_i386_linux,target_i386_win32]) then
+                                 not(target_info.target in [target_386_freebsd,
+                                                target_i386_linux,target_i386_win32]) then
                                 begin
                                   emitinsertcall('FPC_STACKCHECK');
                                   exprasmlist^.insert(new(paicpu,op_const(A_PUSH,S_L,stackframe)));
@@ -3397,11 +3399,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                                 genprofilecode;
 
                             { %edi is already saved when pocdecl is used
-                              if (target_info.target=target_linux) and
+                              if ((target_info.target=target_linux) or (target_info.target=target_freebsd)) and
                                ((aktprocsym^.definition^.options and poexports)<>0) then
                                   exprasmlist^.insert(new(Paicpu,op_reg(A_PUSH,S_L,R_EDI))); }
                               { ATTENTION:
-                                never use ENTER in linux !!!
+                                never use ENTER in linux !!! (or freebsd MvdV)
                                 the stack page fault does not support it PM }
                               exprasmlist^.insert(new(paicpu,op_const_const(A_ENTER,S_NO,stackframe,0)))
                           end
@@ -3451,7 +3453,8 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                             else
                               exprasmlist^.insert(new(paicpu,op_const_reg(A_SUB,S_L,stackframe,R_ESP)));
                             if (cs_check_stack in aktlocalswitches) and
-                              not(target_info.target in [target_i386_linux,target_i386_win32]) then
+                              not(target_info.target in [target_i386_freebsd,
+                                         target_i386_linux,target_i386_win32]) then
                               begin
                                  emitinsertcall('FPC_STACKCHECK');
                                  exprasmlist^.insert(new(paicpu,op_const(A_PUSH,S_L,stackframe)));
@@ -4072,7 +4075,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.13  2000-08-27 16:11:49  peter
+  Revision 1.14  2000-09-16 12:22:52  peter
+    * freebsd support merged
+
+  Revision 1.13  2000/08/27 16:11:49  peter
     * moved some util functions from globals,cobjects to cutils
     * splitted files into finput,fmodule
 

+ 9 - 1
compiler/export.pas

@@ -74,6 +74,9 @@ uses
   {$ifndef NOTARGETLINUX}
     ,t_linux
   {$endif}
+  {$ifndef NOTARGETFREEBSD}
+    ,t_freebsd
+  {$endif}
   {$ifndef NOTARGETOS2}
     ,t_os2
   {$endif}
@@ -189,6 +192,8 @@ begin
 {$ifdef i386}
     target_i386_Linux :
       exportlib:=new(pexportliblinux,Init);
+    target_i386_freebsd:
+      exportlib:=new(pexportlibfreebsd,Init);
     target_i386_Win32 :
       exportlib:=new(pexportlibwin32,Init);
     target_i386_Netware :
@@ -219,7 +224,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.4  2000-09-11 17:00:22  florian
+  Revision 1.5  2000-09-16 12:22:52  peter
+    * freebsd support merged
+
+  Revision 1.4  2000/09/11 17:00:22  florian
     + first implementation of Netware Module support, thanks to
       Armin Diehl ([email protected]) for providing the patches
 

+ 10 - 2
compiler/import.pas

@@ -75,6 +75,9 @@ uses
   {$ifndef NOTARGETLINUX}
     ,t_linux
   {$endif}
+  {$ifndef NOTARGETFREEBSD}
+   ,t_freebsd
+  {$endif}
   {$ifndef NOTARGETOS2}
     ,t_os2
   {$endif}
@@ -227,7 +230,9 @@ begin
 {$ifdef i386}
     target_i386_Linux :
       importlib:=new(pimportliblinux,Init);
-    target_i386_Win32 :
+    target_i386_freebsd:
+      importlib:=new(pimportlibfreebsd,Init);
+         target_i386_Win32 :
       importlib:=new(pimportlibwin32,Init);
     target_i386_OS2 :
       importlib:=new(pimportlibos2,Init);
@@ -255,7 +260,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.4  2000-09-11 17:00:23  florian
+  Revision 1.5  2000-09-16 12:22:52  peter
+    * freebsd support merged
+
+  Revision 1.4  2000/09/11 17:00:23  florian
     + first implementation of Netware Module support, thanks to
       Armin Diehl ([email protected]) for providing the patches
 

+ 11 - 1
compiler/link.pas

@@ -87,6 +87,9 @@ uses
   {$ifndef NOTARGETLINUX}
     ,t_linux
   {$endif}
+  {$ifndef NOTARGETFREEBSD}
+    ,t_FreeBSD
+  {$endif}
   {$ifndef NOTARGETOS2}
     ,t_os2
   {$endif}
@@ -473,6 +476,10 @@ begin
     target_i386_linux :
       linker:=new(plinkerlinux,Init);
   {$endif}
+  {$ifndef NOTARGETFreeBSD}
+    target_i386_FreeBSD :
+      linker:=new(plinkerFreeBSD,Init);
+  {$endif}
   {$ifndef NOTARGETWIN32}
     target_i386_Win32 :
       linker:=new(plinkerwin32,Init);
@@ -532,7 +539,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.6  2000-09-11 17:00:23  florian
+  Revision 1.7  2000-09-16 12:22:52  peter
+    * freebsd support merged
+
+  Revision 1.6  2000/09/11 17:00:23  florian
     + first implementation of Netware Module support, thanks to
       Armin Diehl ([email protected]) for providing the patches
 

+ 14 - 1
compiler/options.pas

@@ -1212,6 +1212,16 @@ begin
   def_symbol('WITHNEWCG');
 {$endif}
 
+
+{ Hack: Linux define is also needed for freebsd (MvdV) }
+if target_info.target=target_i386_freebsd then
+  begin
+   def_symbol('LINUX');
+   def_symbol('BSD');
+   def_symbol('FREEBSD');
+  end;
+
+
 { Temporary defines, until things settle down }
   def_symbol('HASWIDECHAR');
 
@@ -1481,7 +1491,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.6  2000-08-27 16:11:51  peter
+  Revision 1.7  2000-09-16 12:22:52  peter
+    * freebsd support merged
+
+  Revision 1.6  2000/08/27 16:11:51  peter
     * moved some util functions from globals,cobjects to cutils
     * splitted files into finput,fmodule
 

+ 6 - 2
compiler/ra386.pas

@@ -417,7 +417,8 @@ begin
      So I think its at least a good idea to add a warning
      if someone uses this in assembler code
      FPC itself does not use it at all PM }
-   if (opcode=A_ENTER) and (target_info.target=target_i386_linux) then
+   if (opcode=A_ENTER) and ((target_info.target=target_i386_linux) or
+        (target_info.target=target_i386_FreeBSD)) then
      begin
        message(asmr_w_enter_not_supported_by_linux);
      end;
@@ -452,7 +453,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.3  2000-09-03 11:44:00  peter
+  Revision 1.4  2000-09-16 12:22:52  peter
+    * freebsd support merged
+
+  Revision 1.3  2000/09/03 11:44:00  peter
     * error for not specified operand size, which is now required for
       newer binutils (merged)
     * previous commit fix for tcflw (merged)

+ 67 - 11
compiler/systems.pas

@@ -56,10 +56,10 @@ unit systems;
        asmmodecnt=i386asmmodecnt+m68kasmmodecnt+Alphaasmmodecnt+powerpcasmmodecnt+1;
 
      type
-       ttarget = (target_none
-            ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
-            target_i386_OS2,target_i386_Win32,
-            target_i386_Netware,  // AD
+       ttarget = (target_none,
+            target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
+            target_i386_OS2,target_i386_Win32,target_i386_freebsd,
+            target_i386_Netware,
             target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
             target_m68k_linux,target_m68k_PalmOS,target_alpha_linux,
             target_powerpc_linux,target_powerpc_macos
@@ -73,7 +73,7 @@ unit systems;
        { alias for supported_target field in tasminfo }
        target_any = target_none;
 
-       {$ifdef i386} i386targetcnt=6; {$else} i386targetcnt=0; {$endif}
+       {$ifdef i386} i386targetcnt=7; {$else} i386targetcnt=0; {$endif}
        {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif}
        {$ifdef alpha} alphatargetcnt=1; {$else} alphatargetcnt=0; {$endif}
        {$ifdef powerpc} powerpctargetcnt=2; {$else} powerpctargetcnt=0; {$endif}
@@ -127,13 +127,12 @@ unit systems;
      type
        tos = ( os_none,
             os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2,
-            os_i386_Win32,
-            os_i386_Netware,  // AD
+            os_i386_Win32,os_i386_freeBSD,os_i386_Netware,
             os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux,
             os_m68k_PalmOS,os_alpha_linux,os_powerpc_linux,os_powerpc_macos
        );
      const
-       i386oscnt=6;
+       i386oscnt=7;
        m68koscnt=5;
        alphaoscnt=1;
        powerpcoscnt=2;
@@ -321,6 +320,28 @@ implementation
             use_bound_instruction : false;
             use_function_relative_addresses : true
           ),
+          (
+            id     : os_i386_FreeBSD;
+            name         : 'FreeBSD/ELF for i386';
+            shortname    : 'freebsd';
+            sharedlibext : '.so';
+            staticlibext : '.a';
+            sourceext    : '.pp';
+            pasext       : '.pas';
+            exeext       : '';
+            defext       : '.def';
+            scriptext    : '.sh';
+            libprefix    : 'lib';
+            Cprefix      : '';
+            newline      : #10;
+            endian       : endian_little;
+            stackalignment : 4;
+            maxCrecordalignment : 4;
+            size_of_pointer : 4;
+            size_of_longint : 4;
+            use_bound_instruction : false;
+            use_function_relative_addresses : true
+          ),
           (
             id     : os_i386_os2;
             name         : 'OS/2 via EMX';
@@ -1081,6 +1102,30 @@ implementation
             maxheapsize : 32768*1024;
             stacksize   : 8192
           ),
+          (
+            target      : target_i386_FreeBSD;
+            flags       : [];
+            cpu         : i386;
+            short_name  : 'FREEBSD';
+            unit_env    : 'BSDUNITS';
+            system_unit : 'sysbsd';
+            smartext    : '.sl';
+            unitext     : '.ppu';
+            unitlibext  : '.ppl';
+            asmext      : '.s';
+            objext      : '.o';
+            resext      : '.res';
+            resobjext   : '.or';
+            exeext      : '';
+            os          : os_i386_Freebsd;
+            assem       : as_i386_as;
+            assemsrc    : as_i386_as;
+            ar          : ar_i386_ar;
+            res         : res_none;
+            heapsize    : 256*1024;
+            maxheapsize : 32768*1024;
+            stacksize   : 8192
+          ),
           (
             target      : target_i386_OS2;
             flags       : [tf_need_export];
@@ -1623,7 +1668,11 @@ begin
 {OS/2 via EMX can be run under DOS as well}
       {$else}
         {$ifdef LINUX}
-          set_source_os(os_i386_LINUX);
+           {$Ifdef BSD}
+            set_source_os(os_i386_FreeBSD);
+          {$else}
+            set_source_os(os_i386_LINUX);
+           {$endif}
         {$else}
           {$ifdef WIN32}
             set_source_os(os_i386_WIN32);
@@ -1644,7 +1693,7 @@ begin
         set_source_os(os_m68k_MAC);
       {$else}
         {$ifdef LINUX}
-          set_source_os(os_m68k_linux);
+           set_source_os(os_m68k_linux);
         {$endif linux}
       {$endif macos}
     {$endif atari}
@@ -1663,7 +1712,11 @@ begin
         default_os(target_i386_OS2);
       {$else}
         {$ifdef LINUX}
+         {$ifdef BSD}
+          default_os(target_i386_FreeBSD);
+         {$else}
           default_os(target_i386_LINUX);
+         {$endif}
         {$else}
            {$ifdef WIN32}
              default_os(target_i386_WIN32);
@@ -1708,7 +1761,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.6  2000-09-11 17:00:23  florian
+  Revision 1.7  2000-09-16 12:22:52  peter
+    * freebsd support merged
+
+  Revision 1.6  2000/09/11 17:00:23  florian
     + first implementation of Netware Module support, thanks to
       Armin Diehl ([email protected]) for providing the patches