فهرست منبع

* Implement -x and -t options for fpc executable

Michael VAN CANNEYT 2 سال پیش
والد
کامیت
317064c473
4فایلهای تغییر یافته به همراه75 افزوده شده و 33 حذف شده
  1. 1 0
      compiler/msg/errore.msg
  2. 1 1
      compiler/msgidx.inc
  3. 21 21
      compiler/msgtxt.inc
  4. 52 11
      compiler/utils/fpc.pp

+ 1 - 0
compiler/msg/errore.msg

@@ -4425,6 +4425,7 @@ P*2WT_Specify MPW tool type application (Classic Mac OS)
 6*3WQqhdr_Set metadata to QDOS File Header style (default)
 6*3WQxtcc_Set metadata to XTcc style
 **2WX_Enable executable stack (Linux)
+**1x<suff>_Set suffix for compiler executable (fpc command only).
 **1X_Executable options:
 **2X9_Generate linkerscript for GNU Binutils ld older than version 2.19.1 (Linux)
 **2Xa_Generate code which allows to use more than 2 GB static data on 64 bit targets (Linux)

+ 1 - 1
compiler/msgidx.inc

@@ -1160,7 +1160,7 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 90867;
+  MsgTxtSize = 90933;
 
   MsgIdxMax : array[1..20] of longint=(
     28,109,366,132,100,63,148,38,223,71,

+ 21 - 21
compiler/msgtxt.inc

@@ -2056,45 +2056,45 @@ const msgtxt : array[0..000378,1..240] of char=(
   '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 optio','ns:'#010+
+  '**1x<suff>_Set suffix',' for compiler executable (fpc command only).'#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, Fre','eBSD, L'+
-  'inux)'#010+
+  '64 bit targets (Li','nux)'#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+
-  '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
+  '**2XD_Try to link units dynamically      (defines FPC_LINK_D','YNAMIC)'#010+
   '**2Xe_Use external linker'#010+
-  '**2Xf_Substitute pthread library',' name 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+
   '**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 substitutio','ns for linking'#010+
+  'L*2XlS<x>_LLVM utilties suffix (e.g. -7 ','in case clang is called clan'+
+  'g-7)'#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<x>_Set the name of the '#039'main'#039' program routine (default i'+
-  's '#039'main'#039')'#010+
-  '**2Xn_Use target system native linker i','nstead of GNU ld (Solaris, AI'+
-  'X)'#010+
+  '**2XM<x>_Set the name of the '#039'main'#039' program r','outine (default'+
+  ' is '#039'main'#039')'#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+
-  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
-  'ile, see the ld man','ual for more information) (BeOS, Linux)'#010+
+  '**2Xr<x>_Set the li','nker'#039's rlink-path to <x> (needed for cross co'+
+  'mpile, 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+
-  '**2Xs_Strip all symbols from executable'#010+
-  '**2XS_Try to link units statically (default, defines FPC_LINK_ST','ATIC'+
-  ')'#010+
+  '**2Xs_Strip all symbols from executabl','e'#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+
-  '**2Xv_Generate table for Virtual Entry calls'#010+
-  '**2XV_Use VLink as external linker       (default on Amiga, A','tari, S'+
-  'inclair QL)'#010+
+  '**2Xv_Generate table for Virtual Entry c','alls'#010+
+  '**2XV_Use VLink as external linker       (default on Amiga, Atari, Sin'+
+  'clair QL)'#010+
   '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1?_Show this help'#010+

+ 52 - 11
compiler/utils/fpc.pp

@@ -67,6 +67,7 @@ program fpc;
     var
       Info : TSearchRec;
     begin
+      Writeln('Testing :',F);
       FileExists:= findfirst(F,fareadonly+faarchive+fahidden,info)=0;
       findclose(Info);
     end;
@@ -112,6 +113,9 @@ program fpc;
 
   var
      s              : ansistring;
+     tmp,
+     archsuffix,
+     exesuffix,
      cpusuffix,
      processorname,
      ppcbin,
@@ -121,6 +125,8 @@ program fpc;
      ppccommandlinelen : longint;
      i : longint;
      errorvalue     : Longint;
+     found : boolean;
+
   begin
      setlength(ppccommandline,paramcount);
      ppccommandlinelen:=0;
@@ -199,8 +205,16 @@ program fpc;
       for i:=1 to paramcount do
        begin
           s:=paramstr(i);
-          if pos('-V',s)=1 then
-              versionstr:=copy(s,3,length(s)-2)
+          if pos('-x',s)=1 then
+            exesuffix:=copy(s,3,length(s)-2)
+          else if pos('-t',s)=1 then
+            begin
+            archsuffix:=copy(s,3,length(s)-2);
+            ppccommandline[ppccommandlinelen]:=s;
+            inc(ppccommandlinelen);
+            end
+          else if pos('-V',s)=1 then
+            versionstr:=copy(s,3,length(s)-2)
           else
             begin
               if pos('-P',s)=1 then
@@ -310,16 +324,43 @@ program fpc;
 
      if versionstr<>'' then
        ppcbin:=ppcbin+'-'+versionstr;
+     // -x was specified.
+     if exesuffix<>'' then
+       ppcbin:=ppcbin+'-'+exesuffix;
+     Writeln('ppcbin: ',ppcbin);
      { find the full path to the specified exe }
-     if not findexe(ppcbin) then
-        begin
-          if cpusuffix<>'' Then
-            begin
-              ppcbin:='ppc'+cpusuffix;
-              if versionstr<>'' then
-                ppcbin:=ppcbin+'-'+versionstr;
-              findexe(ppcbin);
-            end;
+     // If an architecture was defined, check that first.
+     found:=false;
+     if archsuffix<>'' then
+       begin
+         tmp:=ppcbin;
+         ppcbin:=ppcbin+'-'+archsuffix;
+         Found:=findexe(ppcbin);
+         if not found then
+           begin
+             if cpusuffix<>'' Then
+               begin
+               ppcbin:='ppc'+cpusuffix;
+               if versionstr<>'' then
+                 ppcbin:=ppcbin+'-'+versionstr;
+               ppcbin:=ppcbin+'-'+archsuffix;
+               found:=findexe(ppcbin);
+               end;
+           end;
+         if not found then
+           ppcbin:=tmp;
+       end;
+
+     if not found then
+       if not findexe(ppcbin) then
+         begin
+           if cpusuffix<>'' Then
+             begin
+               ppcbin:='ppc'+cpusuffix;
+               if versionstr<>'' then
+                 ppcbin:=ppcbin+'-'+versionstr;
+               findexe(ppcbin);
+             end;
         end;
 
      { call ppcXXX }