Browse Source

+ source_os is now set correctly for cross-processor compilers
(tos contains all target_infos and
we use CPU86 and CPU68 conditionnals to
get the source operating system
this only works if you do not undefine
the source target !!)
* several cg68k memory leaks fixed
+ started to change the code so that it should be possible to have
a complete compiler (both for m68k and i386 !!)

pierre 27 years ago
parent
commit
ff45eacd79
10 changed files with 324 additions and 127 deletions
  1. 25 8
      compiler/assemble.pas
  2. 14 1
      compiler/cg68kadd.pas
  3. 14 1
      compiler/cg68kcal.pas
  4. 14 1
      compiler/cg68kld.pas
  5. 14 3
      compiler/cga68k.pas
  6. 13 2
      compiler/link.pas
  7. 1 0
      compiler/msgidx.inc
  8. 60 58
      compiler/msgtxt.inc
  9. 20 2
      compiler/switches.pas
  10. 149 51
      compiler/systems.pas

+ 25 - 8
compiler/assemble.pas

@@ -116,8 +116,14 @@ uses
 Function DoPipe:boolean;
 begin
   DoPipe:=(cs_asm_pipe in aktglobalswitches) and
-          not(cs_asm_leave in aktglobalswitches) and
-          (aktoutputformat=as_o);
+          not(cs_asm_leave in aktglobalswitches)
+{$ifdef i386}
+          and (aktoutputformat=as_o)
+{$else}
+{$ifdef m68k}
+          and (aktoutputformat=as_m68k_o)
+{$endif m68k}
+{$endif i386}
 end;
 
 
@@ -423,16 +429,16 @@ begin
 {$endif}
 {$ifdef m68k}
   {$ifndef NoAg68kGas}
-     as_o,
-   as_gas : a:=new(pm68kgasasmlist,Init);
+     as_m68k_o,
+   as_m68k_gas : a:=new(pm68kgasasmlist,Init);
   {$endif NoAg86KGas}
   {$ifndef NoAg68kMot}
-   as_mot : a:=new(pm68kmotasmlist,Init);
+   as_m68k_mot : a:=new(pm68kmotasmlist,Init);
   {$endif NoAg86kMot}
   {$ifndef NoAg68kMit}
-   as_mit : a:=new(pm68kmitasmlist,Init);
+   as_m68k_mit : a:=new(pm68kmitasmlist,Init);
   {$endif NoAg86KMot}
-   as_mpw : a:=new(pm68kmpwasmlist,Init);
+   as_m68k_mpw : a:=new(pm68kmpwasmlist,Init);
 {$endif}
   else
    Message(assem_f_assembler_output_not_supported);
@@ -458,7 +464,18 @@ end;
 end.
 {
   $Log$
-  Revision 1.24  1998-10-08 23:28:50  peter
+  Revision 1.25  1998-10-13 08:19:24  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.24  1998/10/08 23:28:50  peter
     * -vu shows unit info, -vt shows tried/used files
 
   Revision 1.23  1998/10/07 04:27:37  carl

+ 14 - 1
compiler/cg68kadd.pas

@@ -762,6 +762,7 @@ implementation
                                end
                              else
                                begin
+                                  hregister:=getregister32;
                                   emit_reg_reg(A_MOVE,opsize,p^.left^.location.register,
                                     hregister);
                                end
@@ -777,6 +778,7 @@ implementation
                                end
                              else
                                begin
+                                  hregister:=getregister32;
                                   { first give free, then demand new register }
                                  exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
                                    newreference(p^.left^.location.reference),hregister)));
@@ -1268,7 +1270,18 @@ implementation
 end.
 {
   $Log$
-  Revision 1.8  1998-10-09 11:47:47  pierre
+  Revision 1.9  1998-10-13 08:19:25  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.8  1998/10/09 11:47:47  pierre
     * still more memory leaks fixes !!
 
   Revision 1.7  1998/10/08 17:17:15  pierre

+ 14 - 1
compiler/cg68kcal.pas

@@ -377,6 +377,8 @@ implementation
                                 end;
                 end;
            end;
+         freelabel(truelabel);
+         freelabel(falselabel);
          truelabel:=otlabel;
          falselabel:=oflabel;
          { push from right to left }
@@ -1045,7 +1047,18 @@ implementation
 end.
 {
   $Log$
-  Revision 1.6  1998-09-20 12:26:38  peter
+  Revision 1.7  1998-10-13 08:19:27  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.6  1998/09/20 12:26:38  peter
     * merged fixes
 
   Revision 1.5  1998/09/17 09:42:22  peter

+ 14 - 1
compiler/cg68kld.pas

@@ -425,6 +425,8 @@ implementation
 
                            end;
          end;
+         freelabel(truelabel);
+         freelabel(falselabel);
          truelabel:=otlabel;
          falselabel:=oflabel;
       end;
@@ -507,7 +509,18 @@ implementation
 end.
 {
   $Log$
-  Revision 1.3  1998-10-06 20:48:59  peter
+  Revision 1.4  1998-10-13 08:19:28  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.3  1998/10/06 20:48:59  peter
     * m68k compiler compiles again
 
   Revision 1.2  1998/09/17 09:42:27  peter

+ 14 - 3
compiler/cga68k.pas

@@ -536,7 +536,7 @@ begin
         begin
             {Init the stack checking.}
             if (cs_check_stack in aktlocalswitches) and
-             (target_info.target=target_linux) then
+             (target_info.target=target_linux_m68k) then
                 begin
                     procinfo.aktentrycode^.insert(new(pai68k,
                      op_csymbol(A_JSR,S_NO,newcsymbol('FPC_INIT_STACK_CHECK',0))));
@@ -614,7 +614,7 @@ begin
                     if cs_littlesize in aktglobalswitches  then
                         begin
                             if (cs_check_stack in aktlocalswitches) and
-                               (target_info.target<>target_linux) then
+                               (target_info.target<>target_linux_m68k) then
                                 begin
                                   { If only not in main program, do we setup stack checking }
                                   if (aktprocsym^.definition^.options and poproginit=0) then
@@ -1345,7 +1345,18 @@ end;
 end.
 {
   $Log$
-  Revision 1.19  1998-10-08 13:48:40  peter
+  Revision 1.20  1998-10-13 08:19:29  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.19  1998/10/08 13:48:40  peter
     * fixed memory leaks for do nothing source
     * fixed unit interdependency
 

+ 13 - 2
compiler/link.pas

@@ -297,7 +297,7 @@ begin
 {$endif i386}
 {$ifdef m68k}
   target_Palmos : prtobj:='';
-   target_linux : begin
+   target_linux_m68k : begin
                     if cs_profile in aktmoduleswitches then
                      begin
                        prtobj:='gprt0';
@@ -502,7 +502,18 @@ end;
 end.
 {
   $Log$
-  Revision 1.28  1998-10-08 23:28:56  peter
+  Revision 1.29  1998-10-13 08:19:34  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.28  1998/10/08 23:28:56  peter
     * -vu shows unit info, -vt shows tried/used files
 
   Revision 1.27  1998/10/06 17:16:52  pierre

+ 1 - 0
compiler/msgidx.inc

@@ -392,6 +392,7 @@ type tmsgconst=(
   assem_f_too_many_asm_files,
   assem_f_assembler_output_not_supported,
   assem_e_unsupported_symbol_type,
+  exec_w_source_os_redefined,
   exec_i_assembling_pipe,
   exec_d_cant_create_asmfile,
   exec_w_assembler_not_found,

+ 60 - 58
compiler/msgtxt.inc

@@ -406,79 +406,80 @@ const msgtxt : array[0..00091,1..240] of char=(+
   'F_Too many assembler files'#000+
   'F_Selected assembler output not supported'#000+
   'E_Unsupported symbol type ','for operand'#000+
+  'W_Source operating system redefined'#000+
   'I_Assembling (pipe) $1'#000+
   'E_Can'#039't create assember file $1'#000+
   'W_Assembler $1 not found, switching to external assembling'#000+
   'T_Using assembler: $1'#000+
   'W_Error while assembling exitcode $1'#000+
-  'W_Can'#039't call the assembler, error $1 switching to exter','nal assem'+
+  'W_Can'#039't call the as','sembler, error $1 switching to external assem'+
   'bling'#000+
   'I_Assembling $1'#000+
   'W_Linker $1 not found, switching to external linking'#000+
   'T_Using linker: $1'#000+
   'W_Object $1 not found, Linking may fail !'#000+
   'W_Library $1 not found, Linking may fail !'#000+
-  'W_Error while linking'#000+
-  'W_Can'#039't call the linker, switc','hing to external linking'#000+
+  'W_Error while li','nking'#000+
+  'W_Can'#039't call the linker, switching to external linking'#000+
   'I_Linking $1'#000+
   'W_binder not found, switching to external binding'#000+
   'W_ar not found, switching to external ar'#000+
   'E_Dynamic Libraries not supported'#000+
   'I_Closing script $1'#000+
   'T_Unitsearch: $1'#000+
-  'T_PPU Loading $1'#000+
+  'T_PP','U Loading $1'#000+
   'U_PPU Name: $1'#000+
-  'U_PPU Fl','ags: $1'#000+
+  'U_PPU Flags: $1'#000+
   'U_PPU Crc: $1'#000+
   'U_PPU Time: $1'#000+
   'U_PPU File too short'#000+
   'U_PPU Invalid Header (no PPU at the begin)'#000+
   'U_PPU Invalid Version $1'#000+
   'U_PPU is compiled for an other processor'#000+
-  'U_PPU is compiled for an other target'#000+
+  'U_PPU is compiled for an other target',#000+
   'U_PPU Source: $1'#000+
   'U_Writing $1'#000+
-  'F_Can',#039't Write PPU-File'#000+
+  'F_Can'#039't Write PPU-File'#000+
   'F_reading PPU-File'#000+
   'F_unexpected end of PPU-File'#000+
   'F_Invalid PPU-File entry: $1'#000+
   'F_PPU Dbx count problem'#000+
   'E_Illegal unit name: $1'#000+
   'F_Too much units'#000+
-  'F_Circular unit reference between $1 and $2'#000+
-  'F_Can'#039't compile unit $1, no sources ','available'#000+
+  'F_Circular unit reference between $1 and $2'#000,+
+  'F_Can'#039't compile unit $1, no sources available'#000+
   'W_Compiling the system unit requires the -Us switch'#000+
   'F_There were $1 errors compiling module, stopping'#000+
   'U_Load from $1 ($2) unit $3'#000+
   'U_Recompiling $1, checksum changed for $2'#000+
-  'U_Recompiling unit, static lib is older than ppufile'#000+
-  'U_Rec','ompiling unit, shared lib is older than ppufile'#000+
+  'U_Recompiling unit, st','atic lib is older than ppufile'#000+
+  'U_Recompiling unit, shared lib is older than ppufile'#000+
   'U_Recompiling unit, obj and asm are older than ppufile'#000+
   'U_Recompiling unit, obj is older than asm'#000+
   'U_Parsing interface of $1'#000+
   'U_Parsing implementation of $1'#000+
-  'U_Second load for unit $1'#000+
-  'U_PPU Check ','file $1 time $2'#000+
+  'U_','Second load for unit $1'#000+
+  'U_PPU Check file $1 time $2'#000+
   '$1 [options] <inputfile> [options]'#000+
   'W_Only one source file supported'#000+
   'W_DEF file can be created only for OS/2'#000+
   'E_nested response files are not supported'#000+
-  'F_No source file name in command line'#000+
+  'F_No source file name in command line'#000,+
   'E_Illegal parameter: $1'#000+
-  'H_-? writes ','help pages'#000+
+  'H_-? writes help pages'#000+
   'F_Too many config files nested'#000+
   'F_Unable to open file $1'#000+
   'N_Reading further options from $1'#000+
   'W_Target is already set to: $1'#000+
   'W_Shared libs not supported on DOS platform, reverting to static'#000+
-  'F_too many IF(N)DEFs'#000+
+  'F_too m','any IF(N)DEFs'#000+
   'F_too many ENDIFs'#000+
-  'F_op','en conditional at the end of the file'#000+
+  'F_open conditional at the end of the file'#000+
   'W_Debug information generation is not supported by this executable'#000+
   'H_Try recompiling with -dGDB'#000+
   'Free Pascal Compiler version $FPCVER [$FPCDATE] for $FPCTARGET'#000+
-  'Copyright (c) 1993-98 by Florian Klaempfl'#000+
-  'F','ree Pascal Compiler version $FPCVER'#000+
+  'Copyrig','ht (c) 1993-98 by Florian Klaempfl'#000+
+  'Free Pascal Compiler version $FPCVER'#000+
   #000+
   'Compiler Date  : $FPCDATE'#000+
   'Compiler Target: $FPCTARGET'#000+
@@ -486,23 +487,23 @@ const msgtxt : array[0..00091,1..240] of char=(+
   'This program comes under the GNU General Public Licence'#000+
   'For more information read COPYING.FPC'#000+
   #000+
-  'Report bugs,suggestions etc to:'#000+
-  '                fpc-d','[email protected]'#000+
+  'Report bugs,sugge','stions etc to:'#000+
+  '                [email protected]'#000+
   '**0*_+ switch option on, - off'#000+
   '**1a_the compiler doesn'#039't delete the generated assembler file'#000+
   '**2al_list sourcecode lines in assembler file'#000+
   '*t1b_use EMS'#000+
   '**1B_build all modules'#000+
-  '**1C_code generation options'#000+
-  '3*2CD_cr','eate dynamic library'#000+
+  '*','*1C_code generation options'#000+
+  '3*2CD_create dynamic library'#000+
   '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#000+
   '**2Ci_IO-checking'#000+
   '**2Cn_omit linking stage'#000+
   '**2Co_check overflow of integer operations'#000+
   '**2Cr_range checking'#000+
-  '**2Cs<n>_set stack size to <n>'#000+
+  '**2Cs<n>_set stack size ','to <n>'#000+
   '**2Ct_stack checking'#000+
-  '3*2CS_cr','eate static library'#000+
+  '3*2CS_create static library'#000+
   '3*2Cx_use smartlinking'#000+
   '**1d<x>_defines the symbol <x>'#000+
   '*O1D_generate a DEF file'#000+
@@ -510,110 +511,111 @@ const msgtxt : array[0..00091,1..240] of char=(+
   '*O2Dw_PM application'#000+
   '**1e<x>_set path to executable'#000+
   '**1E_same as -Cn'#000+
-  '**1F_set file names and paths'#000+
-  '**2Fe<x>_r','edirect error output to <x>'#000+
+  '**1F','_set file names and paths'#000+
+  '**2Fe<x>_redirect error output to <x>'#000+
   '**2FE<x>_set exe/unit output path to <x>'#000+
   '*L2Fg<x>_same as -Fl'#000+
   '**2Fi<x>_adds <x> to include path'#000+
   '**2Fl<x>_adds <x> to library path'#000+
   '*L2FL<x>_uses <x> as dynamic linker'#000+
-  '**2Fo<x>_adds <x> to object path'#000+
-  '**2Fr<x>_load',' error message file <x>'#000+
+  '**2Fo<x>_a','dds <x> to object path'#000+
+  '**2Fr<x>_load error message file <x>'#000+
   '**2Fu<x>_adds <x> to unit path'#000+
   '**2FU<x>_set unit output path to <x>, overrides -FE'#000+
   '*g1g_generate debugger information'#000+
   '*g2gg_use gsym'#000+
   '*g2gd_use dbx'#000+
   '**1i_information'#000+
-  '**1I<x>_adds <x> to include path'#000+
-  '**1k<x>_Pass <x> to',' the linker'#000+
+  '**1I<x>_adds <x>',' to include path'#000+
+  '**1k<x>_Pass <x> to the linker'#000+
   '**1l_write logo'#000+
   '**1n_don'#039't read the default config file'#000+
   '**1o<x>_change the name of the executable produced to <x>'#000+
   '**1pg_generate profile code for gprof'#000+
-  '*L1P_use pipes instead of creating temporary assembler files'#000+
-  '**1S_syntax opt','ions'#000+
+  '*L1P_use pipes instead of creating tempo','rary assembler files'#000+
+  '**1S_syntax options'#000+
   '**2S2_switch some Delphi 2 extensions on'#000+
   '**2Sc_supports operators like C (*=,+=,/= and -=)'#000+
   '**2Sd_tries to be Delphi compatible'#000+
   '**2Se_compiler stops after the first error'#000+
   '**2Sg_allow LABEL and GOTO'#000+
-  '**2Si_support C++ stlyed INLINE'#000+
-  '**2Sm_','support macros like C (global)'#000+
+  '**','2Si_support C++ stlyed INLINE'#000+
+  '**2Sm_support macros like C (global)'#000+
   '**2So_tries to be TP/BP 7.0 compatible'#000+
   '**2Sp_tries to be gpc compatible'#000+
   '**2Ss_constructor name must be init (destructor must be done)'#000+
   '**2St_allow static keyword in objects'#000+
-  '**2Sv_allow variable directives (cvar',',external,public,export)'#000+
+  '*','*2Sv_allow variable directives (cvar,external,public,export)'#000+
   '**1s_don'#039't call assembler and linker (only with -a)'#000+
   '**1u<x>_undefines the symbol <x>'#000+
   '**1U_unit options'#000+
   '**2Un_don'#039't check the unit name'#000+
   '**2Up<x>_same as -Fu<x>'#000+
-  '**2Us_compile a system unit'#000+
-  '**1v<x>_Be verbose. <x> is a',' combination of the following letters :'#000+
+  '**2Us_compile a syst','em unit'#000+
+  '**1v<x>_Be verbose. <x> is a combination of the following letters :'#000+
   '**2*_e : Show errors (default)       d : Show debug info'#000+
   '**2*_w : Show warnings               u : Show unit info'#000+
-  '**2*_n : Show notes                  t : Show tried/used files'#000+
-  '**2*_h : Show hints     ','             m : Show defined macros'#000+
+  '**2*_n : Show notes                  t : Show tried','/used files'#000+
+  '**2*_h : Show hints                  m : Show defined macros'#000+
   '**2*_i : Show general info           p : Show compiled procedures'#000+
   '**2*_l : Show linenumbers            c : Show conditionals'#000+
-  '**2*_a : Show everything             0 : Show nothing (except errors)'#000+
-  '**2*_b :',' Show all procedure'#000+
+  '**2*_a : Show everything             0 : S','how nothing (except errors'+
+  ')'#000+
+  '**2*_b : Show all procedure'#000+
   '**2*_    declarations if an error'#000+
   '**2*_    occurs'#000+
   '**1X_executable options'#000+
   '*L2Xc_link with the c library'#000+
   '**2XD_link with dynamic libraries (defines FPC_LINK_DYNAMIC)'#000+
-  '**2Xs_strip all symbols from executable'#000+
-  '**2XS_link with',' static libraries (defines FPC_LINK_STATIC)'#000+
+  '**2Xs_strip all sym','bols from executable'#000+
+  '**2XS_link with static libraries (defines FPC_LINK_STATIC)'#000+
   '**0*_Processor specific options:'#000+
   '3*1A<x>_output format'#000+
   '3*2Ao_coff file using GNU AS'#000+
   '3*2Anasmcoff_coff file using Nasm'#000+
-  '3*2Anasmelf_elf32 (linux) file using Nasm'#000+
+  '3*2Anasmelf_elf32 (linux) file using Nasm'#000,+
   '3*2Anasmobj_obj file using Nasm'#000+
-  '3*2A','masm_obj using Masm (Mircosoft)'#000+
+  '3*2Amasm_obj using Masm (Mircosoft)'#000+
   '3*2Atasm_obj using Tasm (Borland)'#000+
   '3*1R<x>_assembler reading style'#000+
   '3*2Ratt_read AT&T style assembler'#000+
   '3*2Rintel_read Intel style assembler'#000+
-  '3*2Rdirect_copy assembler text directly to assembler file'#000+
-  '3*1O<x>_optim','izations'#000+
+  '3*2Rdirect_copy assembler text dire','ctly to assembler file'#000+
+  '3*1O<x>_optimizations'#000+
   '3*2Og_generate smaller code'#000+
   '3*2OG_generate faster code (default)'#000+
   '3*2Or_keep certain variables in registers (still BUGGY!!!)'#000+
   '3*2Ou_enable uncertain optimizations (see docs)'#000+
-  '3*2O1_level 1 optimizations (quick optimizations)'#000+
-  '3*2O2_lev','el 2 optimizations (-O1 + slower optimizations)'#000+
+  '3*2O1_level 1 optimizat','ions (quick optimizations)'#000+
+  '3*2O2_level 2 optimizations (-O1 + slower optimizations)'#000+
   '3*2O3_level 3 optimizations (same as -O2u)'#000+
   '3*2Op_target processor'#000+
   '3*3Op1_set target processor to 386/486'#000+
-  '3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#000+
-  '3*3Op3_set target processor to P','Pro/PII/c6x86/K6 (tm)'#000+
+  '3*3Op2_set target processor to Pentium/PentiumMMX (','tm)'#000+
+  '3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#000+
   '3*1T<x>_Target operating system'#000+
   '3*2TGO32V1_version 1 of DJ Delorie DOS extender'#000+
   '3*2TGO32V2_version 2 of DJ Delorie DOS extender'#000+
   '3*2TLINUX_Linux'#000+
   '3*2TOS2_OS/2 2.x'#000+
-  '3*2TWin32_Windows 32 Bit'#000+
+  '3*2TWin32_Windows 32 ','Bit'#000+
   '6*1A<x>_output format'#000+
-  '6*2Ao_Unix',' o-file using GNU AS'#000+
+  '6*2Ao_Unix o-file using GNU AS'#000+
   '6*2Agas_GNU Motorola assembler'#000+
   '6*2Amit_MIT Syntax (old GAS)'#000+
   '6*2Amot_Standard Motorola assembler'#000+
   '6*1O_optimizations'#000+
   '6*2Oa_turn on the optimizer'#000+
   '6*2Og_generate smaller code'#000+
-  '6*2OG_generate faster code (default)'#000+
-  '6*2Ox_optim','ize maximum (still BUGGY!!!)'#000+
+  '6*2OG_genera','te faster code (default)'#000+
+  '6*2Ox_optimize maximum (still BUGGY!!!)'#000+
   '6*2O2_set target processor to a MC68020+'#000+
   '6*1R<x>_assembler reading style'#000+
   '6*2RMOT_read motorola style assembler'#000+
   '6*1T<x>_Target operating system'#000+
   '6*2TAMIGA_Commodore Amiga'#000+
-  '6*2TATARI_Atari ST/STe/TT'#000+
-  '6*2TMACOS_Macint','osh m68k'#000+
+  '6*2TAT','ARI_Atari ST/STe/TT'#000+
+  '6*2TMACOS_Macintosh m68k'#000+
   '6*2TLINUX_Linux-68k'#000+
   '**1*_'#000+
   '**1?_shows this help'#000+

+ 20 - 2
compiler/switches.pas

@@ -92,7 +92,14 @@ begin
                    else
                     aktlocalswitches:=aktlocalswitches-[tlocalswitch(setsw)];
                  { Message for linux which has global checking only }
-                   if (switch='S') and (target_info.target=target_linux) then
+                   if (switch='S')
+{$ifdef i386}
+                      and (target_info.target=target_linux)
+{$endif i386}
+{$ifdef m68k}
+                      and (target_info.target=target_linux_m68k)
+{$endif m68k}
+                      then
                     Message(scan_n_stack_check_global_under_linux);
                  end;
       modulesw : begin
@@ -154,7 +161,18 @@ end;
 end.
 {
   $Log$
-  Revision 1.13  1998-09-22 17:13:52  pierre
+  Revision 1.14  1998-10-13 08:19:41  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.13  1998/09/22 17:13:52  pierre
     + browsing updated and developed
       records and objects fields are also stored
 

+ 149 - 51
compiler/systems.pas

@@ -28,14 +28,14 @@ unit systems;
    type
        tendian = (endian_little,en_big_endian);
 
-       ttargetcpu=(i386,m68k,alpha);
+       ttargetcpu=(dummy_cpu,i386,m68k,alpha);
 
-       tprocessors = (
+       tprocessors = (no_processor
        {$ifdef i386}
-            Class386,ClassP5,ClassP6
+            ,Class386,ClassP5,ClassP6
        {$endif}
        {$ifdef m68k}
-            MC68000,MC68100,MC68020
+            ,MC68000,MC68100,MC68020
        {$endif}
        );
 
@@ -43,6 +43,9 @@ unit systems;
        tasmmode= (
        {$ifdef i386}
               I386_ATT,I386_INTEL,I386_DIRECT
+          {$ifdef m68k}
+              ,
+          {$endif m68k}
        {$endif}
        {$ifdef m68k}
               M68K_MOT
@@ -53,9 +56,12 @@ unit systems;
        ttarget = (
        {$ifdef i386}
               target_GO32V1,target_GO32V2,target_LINUX,target_OS2,target_WIN32
+          {$ifdef m68k}
+              ,
+          {$endif m68k}
        {$endif i386}
        {$ifdef m68k}
-              target_Amiga,target_Atari,target_Mac68k,target_Linux,target_PalmOS
+              target_Amiga,target_Atari,target_Mac68k,target_linux_m68k,target_PalmOS
        {$endif}
        );
 
@@ -64,38 +70,43 @@ unit systems;
        {$ifdef i386}
               as_o,as_o_aout,as_asw,as_nasmcoff, as_nasmelf, as_nasmobj,
               as_tasm, as_masm
+          {$ifdef m68k}
+              ,
+          {$endif m68k}
        {$endif}
        {$ifdef m68k}
-              as_o,as_gas,as_mit,as_mot,as_mpw
+              as_m68k_o,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
        {$endif}
        );
 
        tlink = (
        {$ifdef i386}
               link_ld,link_ldgo32v1, link_ldgo32v2, link_ldw, link_ldos2
+          {$ifdef m68k}
+              ,
+          {$endif m68k}
        {$endif i386}
        {$ifdef m68k}
-              link_ld
+              link_m68k_ld
        {$endif}
        );
 
       tar = (
        {$ifdef i386}
               ar_ar,ar_arw
+          {$ifdef m68k}
+              ,
+          {$endif m68k}
        {$endif}
        {$ifdef m68k}
-              ar_ar
+              ar_m68k_ar
        {$endif}
        );
 
 
        tos = (
-       {$ifdef i386}
-              os_GO32V1,os_GO32V2, os_Linux, os_OS2, os_WIN32
-       {$endif i387}
-       {$ifdef m68k}
-              os_Amiga, os_Atari, os_Mac68k, os_Linux, os_PalmOS
-       {$endif}
+              os_GO32V1,os_GO32V2, os_Linux, os_OS2, os_WIN32,
+              os_Amiga, os_Atari, os_Mac68k, os_Linux_m68k, os_PalmOS
        );
 
 
@@ -146,6 +157,7 @@ unit systems;
 
        ttargetinfo = record
           target      : ttarget;
+          cpu         : ttargetcpu;
           short_name  : string[8];
           unit_env    : string[12];
           system_unit : string[8];
@@ -169,15 +181,9 @@ unit systems;
           idtxt : string[8];
        end;
 
-    const
-{$ifdef i386}
-       target_cpu = i386;
-{$endif i386}
-{$ifdef m68k}
-       target_cpu = m68k;
-{$endif m68k}
-
     var
+       target_cpu : ttargetcpu;
+       
        target_info : ttargetinfo;
        target_os   : tosinfo;
        target_asm  : tasminfo;
@@ -191,13 +197,15 @@ unit systems;
 
 implementation
 
+  uses
+    verbose;
+  
     const
 
 {****************************************************************************
                                  OS Info
 ****************************************************************************}
        os_infos : array[tos] of tosinfo = (
-{$ifdef i386}
           (
             name         : 'GO32 V1 DOS extender';
             sharedlibext : '.dll';
@@ -267,9 +275,7 @@ implementation
             newline      : #13#10;
             endian       : endian_little;
             use_function_relative_addresses : true
-          )
-{$endif i386}
-{$ifdef m68k}
+          ),
           (
             name         : 'Commodore Amiga';
             sharedlibext : '.library';
@@ -340,7 +346,6 @@ implementation
             endian       : en_big_endian;
             use_function_relative_addresses : false
           )
-{$endif m68k}
           );
 
 
@@ -422,10 +427,13 @@ implementation
             labelprefix : '.L';
             comment : '; '
           )
+      {$ifdef m68k}
+          ,
+      {$endif m68k}
 {$endif i386}
 {$ifdef m68k}
           (
-            id     : as_o;
+            id     : as_m68k_o;
             idtxt  : 'O';
             asmbin : 'as';
             asmcmd : '-o $OBJ $ASM';
@@ -434,7 +442,7 @@ implementation
             comment : '# '
           )
           ,(
-            id     : as_gas;
+            id     : as_m68k_gas;
             idtxt  : 'GAS';
             asmbin : 'as68k'; { Gas for the Amiga}
             asmcmd : '--register-prefix-optional -o $OBJ $ASM';
@@ -443,7 +451,7 @@ implementation
             comment : '| '
           )
           ,(
-            id     : as_mit;
+            id     : as_m68k_mit;
             idtxt  : 'MIT';
             asmbin : '';
             asmcmd : '-o $OBJ $ASM';
@@ -452,7 +460,7 @@ implementation
             comment : '| '
           )
           ,(
-            id     : as_mot;
+            id     : as_m68k_mot;
             idtxt  : 'MOT';
             asmbin : '';
             asmcmd : '-o $OBJ $ASM';
@@ -461,7 +469,7 @@ implementation
             comment : '| '
           )
           ,(
-            id     : as_mpw;
+            id     : as_m68k_mpw;
             idtxt  : 'MPW';
             asmbin : '';
             asmcmd : '-model far -o $OBJ $ASM';
@@ -547,6 +555,9 @@ implementation
             inputend   : '';
             libprefix  : '-l'
           )
+      {$ifdef m68k}
+          ,
+      {$endif m68k}
 {$endif i386}
 {$ifdef m68k}
           (
@@ -579,6 +590,9 @@ implementation
             arbin : 'arw';
             arcmd : 'rs $LIB $FILES'
           )
+      {$ifdef m68k}
+          ,
+      {$endif m68k}
 {$endif i386}
 {$ifdef m68k}
           (
@@ -595,6 +609,7 @@ implementation
 {$ifdef i386}
           (
             target      : target_GO32V1;
+            cpu         : i386;
             short_name  : 'GO32V1';
             unit_env    : 'GO32V1UNITS';
             system_unit : 'SYSTEM';
@@ -614,6 +629,7 @@ implementation
           ),
           (
             target      : target_GO32V2;
+            cpu         : i386;
             short_name  : 'GO32V2';
             unit_env    : 'GO32V2UNITS';
             system_unit : 'SYSTEM';
@@ -633,6 +649,7 @@ implementation
           ),
           (
             target      : target_LINUX;
+            cpu         : i386;
             short_name  : 'LINUX';
             unit_env    : 'LINUXUNITS';
             system_unit : 'syslinux';
@@ -652,6 +669,7 @@ implementation
           ),
           (
             target      : target_OS2;
+            cpu         : i386;
             short_name  : 'OS2';
             unit_env    : 'OS2UNITS';
             system_unit : 'SYSOS2';
@@ -671,6 +689,7 @@ implementation
           ),
           (
             target      : target_WIN32;
+            cpu         : i386;
             short_name  : 'WIN32';
             unit_env    : 'WIN32UNITS';
             system_unit : 'SYSWIN32';
@@ -688,10 +707,14 @@ implementation
             maxheapsize : 32768*1024;
             stacksize   : 32768
           )
+      {$ifdef m68k}
+          ,
+      {$endif m68k}
 {$endif i386}
 {$ifdef m68k}
           (
             target      : target_Amiga;
+            cpu         : m68k;
             short_name  : 'AMIGA';
             unit_env    : '';
             system_unit : 'sysamiga';
@@ -702,15 +725,16 @@ implementation
             objext      : '.o';
             exeext      : '';
             os          : os_Amiga;
-            link        : link_ld;
-            assem       : as_o;
-            ar          : ar_ar;
+            link        : link_m68k_ld;
+            assem       : as_m68k_o;
+            ar          : ar_m68k_ar;
             heapsize    : 128*1024;
             maxheapsize : 32768*1024;
             stacksize   : 8192
           ),
           (
             target      : target_Atari;
+            cpu         : m68k;
             short_name  : 'ATARI';
             unit_env    : '';
             system_unit : 'SYSATARI';
@@ -721,15 +745,16 @@ implementation
             objext      : '.o';
             exeext      : '.ttp';
             os          : os_Atari;
-            link        : link_ld;
-            assem       : as_o;
-            ar          : ar_ar;
+            link        : link_m68k_ld;
+            assem       : as_m68k_o;
+            ar          : ar_m68k_ar;
             heapsize    : 16*1024;
             maxheapsize : 32768*1024;
             stacksize   : 8192
           ),
           (
             target      : target_Mac68k;
+            cpu         : m68k;
             short_name  : 'MACOS';
             unit_env    : '';
             system_unit : 'sysmac';
@@ -740,15 +765,16 @@ implementation
             objext      : '.o';
             exeext      : '';
             os          : os_Mac68k;
-            link        : link_ld;
-            assem       : as_mpw;
-            ar          : ar_ar;
+            link        : link_m68k_ld;
+            assem       : as_m68k_mpw;
+            ar          : ar_m68k_ar;
             heapsize    : 128*1024;
             maxheapsize : 32768*1024;
             stacksize   : 8192
           ),
           (
-            target      : target_Linux;
+            target      : target_linux_m68k;
+            cpu         : m68k;
             short_name  : 'LINUX';
             unit_env    : 'LINUXUNITS';
             system_unit : 'syslinux';
@@ -758,16 +784,17 @@ implementation
             asmext      : '.s';
             objext      : '.o';
             exeext      : '';
-            os          : os_Linux;
-            link        : link_ld;
-            assem       : as_o;
-            ar          : ar_ar;
+            os          : os_Linux_m68k;
+            link        : link_m68k_ld;
+            assem       : as_m68k_o;
+            ar          : ar_m68k_ar;
             heapsize    : 128*1024;
             maxheapsize : 32768*1024;
             stacksize   : 8192
           ),
           (
             target      : target_PalmOS;
+            cpu         : m68k;
             short_name  : 'PALMOS';
             unit_env    : 'PALMUNITS';
             system_unit : 'syspalm';
@@ -778,9 +805,9 @@ implementation
             objext      : '.o';
             exeext      : '';
             os          : os_PalmOS;
-            link        : link_ld;
-            assem       : as_o;
-            ar          : ar_ar;
+            link        : link_m68k_ld;
+            assem       : as_m68k_o;
+            ar          : ar_m68k_ar;
             heapsize    : 128*1024;
             maxheapsize : 32768*1024;
             stacksize   : 8192
@@ -805,6 +832,9 @@ implementation
             id    : I386_ATT;
             idtxt : 'ATT'
           )
+      {$ifdef m68k}
+          ,
+      {$endif m68k}
 {$endif i386}
 {$ifdef m68k}
           (
@@ -825,6 +855,7 @@ begin
   target_asm:=as_infos[target_info.assem];
   target_link:=link_infos[target_info.link];
   target_ar:=ar_infos[target_info.ar];
+  target_cpu:=target_info.cpu;
 end;
 
 
@@ -881,11 +912,63 @@ end;
 procedure default_os(t:ttarget);
 begin
   set_target(t);
-  source_os:=os_infos[target_info.os];
+  if source_os.name='' then
+    source_os:=os_infos[target_info.os];
+end;
+
+procedure set_source_os(t:tos);
+begin
+  if source_os.name<>'' then
+    Message(exec_w_source_os_redefined);
+  source_os:=os_infos[t];
 end;
 
 
 begin
+
+{ first get source OS }
+  source_os.name:='';
+  { please note then we use cpu86 and cpu68 here on purpose !! }
+{$ifdef cpu86}
+{$ifdef GO32V1}
+  set_source_os(os_GO32V1);
+  {$else}
+  {$ifdef GO32V2}
+  set_source_os(os_GO32V2);
+  {$else}
+    {$ifdef OS2}
+    set_source_os(os_OS2);
+    {$else}
+      {$ifdef LINUX}
+      set_source_os(os_LINUX);
+      {$else}
+        {$ifdef WIN32}
+        set_source_os(os_WIN32);
+        {$endif win32}
+      {$endif linux}
+    {$endif os2}
+  {$endif go32v2}
+{$endif go32v1}
+{$endif cpu86}
+{$ifdef cpu68}
+{$ifdef AMIGA}
+  set_source_os(os_Amiga);
+{$else}
+  {$ifdef ATARI}
+  set_source_os(os_Atari);
+  {$else}
+    {$ifdef MACOS}
+    set_source_os(os_MAC68k);
+    {$else}
+      {$ifdef LINUX}
+      set_source_os(os_linux_m68k);
+      {$endif linux}
+    {$endif macos}
+  {$endif atari}
+{$endif amiga}
+{$endif cpu68}
+  
+{ Now default target !! }
 {$ifdef i386}
   {$ifdef GO32V1}
      default_os(target_GO32V1);
@@ -919,7 +1002,11 @@ begin
       {$ifdef MACOS}
         default_os(target_MAC68k);
       {$else}
+        {$ifdef LINUX}
+          default_os(target_linux_m68k);
+        {$else}
         default_os(target_Amiga);
+        {$endif linux}
       {$endif macos}
     {$endif atari}
   {$endif amiga}
@@ -927,7 +1014,18 @@ begin
 end.
 {
   $Log$
-  Revision 1.38  1998-10-07 04:26:58  carl
+  Revision 1.39  1998-10-13 08:19:42  pierre
+    + source_os is now set correctly for cross-processor compilers
+      (tos contains all target_infos and
+       we use CPU86 and CPU68 conditionnals to
+       get the source operating system
+       this only works if you do not undefine
+       the source target  !!)
+    * several cg68k memory leaks fixed
+    + started to change the code so that it should be possible to have
+      a complete compiler (both for m68k and i386 !!)
+
+  Revision 1.38  1998/10/07 04:26:58  carl
     * bugfixes
     + added mpw support