Ver código fonte

atari: add -Wt<x> option to allow specifying the executable format

This is useful to create aoutmint format binaries using vlink,
which have a symbol table that has no limit for the name length.
Thorsten Otto 3 anos atrás
pai
commit
073b48de82

+ 1 - 0
compiler/globals.pas

@@ -418,6 +418,7 @@ interface
 {$if defined(m68k)}
        { Atari Specific }
        ataritos_exe_flags: dword = 7;
+       ataritos_exe_format: string = 'ataritos';
 
        { Sinclair QL specific }
        sinclairql_metadata_format: string[4] = 'QHDR';

+ 3 - 0
compiler/msg/errore.msg

@@ -4372,6 +4372,9 @@ A*2WR_Generate relocation code (Windows)
 8*2Wt<x>_Set the target executable format
 8*3Wtcom_Create a DOS .COM file (requires tiny memory model)
 8*3Wtexe_Create a DOS .EXE file (default)
+6*2Wt<x>_Set the target executable format (Atari)
+6*3Wttos_Create TOS executable file (default)
+6*3Wtmint_Create a MiNT executable file
 P*2WT_Specify MPW tool type application (Classic Mac OS)
 6*2WQ<x>_Set executable metadata format (Sinclair QL)
 6*3WQqhdr_Set metadata to QDOS File Header style (default)

+ 1 - 1
compiler/msgidx.inc

@@ -1148,7 +1148,7 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 89173;
+  MsgTxtSize = 89309;
 
   MsgIdxMax : array[1..20] of longint=(
     28,109,362,131,99,63,148,37,223,69,

+ 27 - 26
compiler/msgtxt.inc

@@ -1,8 +1,8 @@
 const msgtxt_codepage=20127;
 {$ifdef Delphi}
-const msgtxt : array[0..000371] of string[240]=(
+const msgtxt : array[0..000372] of string[240]=(
 {$else Delphi}
-const msgtxt : array[0..000371,1..240] of char=(
+const msgtxt : array[0..000372,1..240] of char=(
 {$endif Delphi}
   '01000_T_Compiler: $1'#000+
   '01001_D_Compiler OS: $1'#000+
@@ -2012,52 +2012,53 @@ const msgtxt : array[0..000371,1..240] of char=(
   '8*2Wt<x>_Set the target executable format'#010+
   '8*3Wtcom_Create a DOS .COM file (requires tiny memory model)'#010+
   '8*3Wtexe_Create a DOS .EXE file (default)'#010+
-  'P*2WT_Specify MPW tool type a','pplication (Classic Mac OS)'#010+
+  '6*2Wt<x>_Set the target execu','table format (Atari)'#010+
+  '6*3Wttos_Create TOS executable file (default)'#010+
+  '6*3Wtmint_Create a MiNT executable file'#010+
+  'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
   '6*2WQ<x>_Set executable metadata format (Sinclair QL)'#010+
-  '6*3WQqhdr_Set metadata to QDOS File Header style (default)'#010+
+  '6*3WQqhdr_Set metadata',' to QDOS File Header style (default)'#010+
   '6*3WQxtcc_Set metadata to XTcc style'#010+
   '**2WX_Enable executable stack (Linux)'#010+
-  '**1X_Executable options:',#010+
+  '**1X_Executable options:'#010+
   '**2X9_Generate linkerscript for GNU Binutils ld older than version 2.1'+
   '9.1 (Linux)'#010+
-  '**2Xa_Generate code which allows to use more than 2 GB static data on '+
-  '64 Bit targets (Linux)'#010+
-  '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBS','D, L'+
-  'inux)'#010+
+  '**2Xa_Generate code w','hich allows to use more than 2 GB static data o'+
+  'n 64 Bit targets (Linux)'#010+
+  '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
+  'ux)'#010+
   '**2Xd_Do not search default library path (sometimes required for cross'+
-  '-compiling when not using -XR)'#010+
+  '-compiling when not usin','g -XR)'#010+
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2Xe_Use external linker'#010+
-  '**2Xf_Substitute pthread library na','me for linking (BSD)'#010+
+  '**2Xf_Substitute pthread library name for linking (BSD)'#010+
   '**2Xg_Create debuginfo in a separate file and add a debuglink section '+
-  'to executable'#010+
+  'to executable',#010+
   '**2Xi_Use internal linker'#010+
   'L*2XlS<x>_LLVM utilties suffix (e.g. -7 in case clang is called clang-'+
   '7)'#010+
-  '**2XLA_Define library substitutions ','for linking'#010+
+  '**2XLA_Define library substitutions for linking'#010+
   '**2XLD_Exclude default order of standard libraries'#010+
   '**2XLO_Define order of library linking'#010+
-  '**2Xm_Generate link map'#010+
+  '**','2Xm_Generate link map'#010+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
-  '**2Xn_Use target system native linker inst','ead of GNU ld (Solaris, AI'+
-  'X)'#010+
+  '**2Xn_Use target system native linker instead of GNU ld (Solaris, AIX)'+
+  #010+
   'F*2Xp<x>_First search for the compiler binary in the directory <x>'#010+
-  '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
+  '**2XP<x>','_Prepend the binutils names with the prefix <x>'#010+
   '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
-  'ile, see the ld manual',' for more information) (BeOS, Linux)'#010+
-  '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
-  ', Linux, Mac OS, Solaris)'#010+
+  'ile, see the ld manual for more information) (BeOS, Linux)'#010+
+  '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, Free','B'+
+  'SD, Linux, Mac OS, Solaris)'#010+
   '**2Xs_Strip all symbols from executable'#010+
-  '**2XS_Try to link units statically (default, defines FPC_LINK_STATI','C'+
-  ')'#010+
+  '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
-  '**2Xu_Generate executable in UF2 format  (embedded targets only)'#010+
+  '**2Xu_Generate executable in UF2 forma','t  (embedded targets only)'#010+
   '**2Xv_Generate table for Virtual Entry calls'#010+
-  '**2XV_Use VLink as external linker       (default on Amiga, Morp','hOS)'+
-  #010+
+  '**2XV_Use VLink as external linker       (default on Amiga, MorphOS)'#010+
   '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1?_Show this help'#010+
-  '**1h_Shows this help without waiting'
+  '**1h_Sh','ows this help without waiting'
 );

+ 13 - 0
compiler/options.pas

@@ -3008,6 +3008,19 @@ begin
                           end
                         else
 {$endif defined(i8086)}
+{$if defined(m68k)}
+                        if (target_info.system in [system_m68k_atari]) then
+                          begin
+                            case Upper(Copy(More,j+1,255)) of
+                              'TOS': ataritos_exe_format := 'ataritos';
+                              'MINT': ataritos_exe_format := 'aoutmint';
+                              else
+                                IllegalPara(opt);
+                            end;
+                            break;
+                          end
+                        else
+{$endif defined(m68k)}
                           IllegalPara(opt);
                       end;
                     'T':

+ 35 - 1
compiler/systems/t_atari.pas

@@ -73,7 +73,7 @@ begin
      end
     else
      begin
-      ExeCmd[1]:='vlink -b ataritos $FLAGS $GCSECTIONS $OPT $STRIP $MAP -o $EXE -T $RES';
+      ExeCmd[1]:='vlink -b '+ataritos_exe_format+' $FLAGS $GCSECTIONS $OPT $STRIP $MAP -o $EXE -T $RES';
      end;
    end;
 end;
@@ -154,6 +154,40 @@ begin
     LinkRes.Add('  }');
     LinkRes.Add('}');
    end;
+  if (UseVLink) and (ataritos_exe_format = 'aoutmint') then
+   begin
+	LinkRes.Add('SECTIONS {');
+	LinkRes.Add('  . = 0xe4;');
+	LinkRes.Add('  .text: {');
+	LinkRes.Add('    *(.i* i* I*)');
+	LinkRes.Add('    *(.t* t* T* .c* c* CODE*)');
+	LinkRes.Add('    *(.f* f* F*)');
+	LinkRes.Add('    _etext = .;');
+	LinkRes.Add('    __etext = .;');
+	LinkRes.Add('    . = ALIGN(4);');
+	LinkRes.Add('  }');
+	LinkRes.Add('  .data: {');
+	LinkRes.Add('    PROVIDE(_LinkerDB = . + 0x8000);');
+	LinkRes.Add('    PROVIDE(_SDA_BASE_ = . + 0x8000);');
+	LinkRes.Add('    VBCC_CONSTRUCTORS');
+	LinkRes.Add('    *(.rodata*)');
+	LinkRes.Add('    *(.d* d* D*)');
+	LinkRes.Add('    *(.sdata*)');
+	LinkRes.Add('    *(__MERGED)');
+	LinkRes.Add('    _edata = .;');
+	LinkRes.Add('    __edata = .;');
+	LinkRes.Add('    . = ALIGN(4);');
+	LinkRes.Add('  }');
+	LinkRes.Add('  .bss: {');
+	LinkRes.Add('    *(.sbss*)');
+	LinkRes.Add('    *(.scommon)');
+	LinkRes.Add('    *(.b* b* B* .u* u* U*)');
+	LinkRes.Add('    *(COMMON)');
+	LinkRes.Add('    _end = ALIGN(4);');
+	LinkRes.Add('    __end = ALIGN(4);');
+	LinkRes.Add('  }');
+	LinkRes.Add('}');;
+   end;
 
   LinkRes.Add('INPUT (');
   { add objectfiles, start with prt0 always }