2
0
peter 20 жил өмнө
parent
commit
dc363f29bc

+ 10 - 7
compiler/assemble.pas

@@ -196,7 +196,7 @@ Implementation
 {$ifdef m68k}
 {$ifdef m68k}
       cpuinfo,
       cpuinfo,
 {$endif m68k}
 {$endif m68k}
-      cpubase,aasmcpu
+      aasmcpu
       ;
       ;
 
 
     var
     var
@@ -400,7 +400,7 @@ Implementation
 {$ELSE USE_SYSUTILS}
 {$ELSE USE_SYSUTILS}
          begin
          begin
            swapvectors;
            swapvectors;
-           exec(command,para);
+           exec(maybequoted(command),para);
            swapvectors;
            swapvectors;
            if (doserror<>0) then
            if (doserror<>0) then
             begin
             begin
@@ -466,13 +466,13 @@ Implementation
 {$endif}
 {$endif}
         if (cs_link_on_target in aktglobalswitches) then
         if (cs_link_on_target in aktglobalswitches) then
          begin
          begin
-           Replace(s,'$ASM',ScriptFixFileName(AsmFile));
-           Replace(s,'$OBJ',ScriptFixFileName(ObjFile));
+           Replace(s,'$ASM',maybequoted(ScriptFixFileName(AsmFile)));
+           Replace(s,'$OBJ',maybequoted(ScriptFixFileName(ObjFile)));
          end
          end
         else
         else
          begin
          begin
-           Replace(s,'$ASM',AsmFile);
-           Replace(s,'$OBJ',ObjFile);
+           Replace(s,'$ASM',maybequoted(AsmFile));
+           Replace(s,'$OBJ',maybequoted(ObjFile));
          end;
          end;
         if CallAssembler(FindAssembler,s) then
         if CallAssembler(FindAssembler,s) then
          RemoveAsm
          RemoveAsm
@@ -1683,7 +1683,10 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.82  2004-11-09 22:32:59  peter
+  Revision 1.83  2004-12-22 16:32:45  peter
+    * maybequoted() added
+
+  Revision 1.82  2004/11/09 22:32:59  peter
     * small m68k updates to bring it up2date
     * small m68k updates to bring it up2date
     * give better error for external local variable
     * give better error for external local variable
 
 

+ 5 - 2
compiler/link.pas

@@ -564,7 +564,7 @@ begin
 { Call AR }
 { Call AR }
   smartpath:=current_module.outputpath^+FixPath(lower(current_module.modulename^)+target_info.smartext,false);
   smartpath:=current_module.outputpath^+FixPath(lower(current_module.modulename^)+target_info.smartext,false);
   SplitBinCmd(target_ar.arcmd,binstr,cmdstr);
   SplitBinCmd(target_ar.arcmd,binstr,cmdstr);
-  Replace(cmdstr,'$LIB',current_module.staticlibfilename^);
+  Replace(cmdstr,'$LIB',maybequoted(current_module.staticlibfilename^));
   Replace(cmdstr,'$FILES',FixFileName(smartpath+current_module.asmprefix^+'*'+target_info.objext));
   Replace(cmdstr,'$FILES',FixFileName(smartpath+current_module.asmprefix^+'*'+target_info.objext));
   success:=DoExec(FindUtil(binstr),cmdstr,false,true);
   success:=DoExec(FindUtil(binstr),cmdstr,false,true);
 { Clean up }
 { Clean up }
@@ -706,7 +706,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.46  2004-11-03 22:22:51  peter
+  Revision 1.47  2004-12-22 16:32:45  peter
+    * maybequoted() added
+
+  Revision 1.46  2004/11/03 22:22:51  peter
   First check outputunitdir/outputexedir for .o file
   First check outputunitdir/outputexedir for .o file
 
 
   Revision 1.45  2004/10/14 16:25:39  mazen
   Revision 1.45  2004/10/14 16:25:39  mazen

+ 15 - 12
compiler/systems/t_beos.pas

@@ -210,7 +210,7 @@ begin
      ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE `cat $RES`';
      ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE `cat $RES`';
      DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE `cat $RES`';
      DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE `cat $RES`';
      DllCmd[2]:='strip --strip-unneeded $EXE';
      DllCmd[2]:='strip --strip-unneeded $EXE';
-     {
+(*
      ExeCmd[1]:='sh $RES $EXE $OPT $STATIC $STRIP -L.';
      ExeCmd[1]:='sh $RES $EXE $OPT $STATIC $STRIP -L.';
 {     ExeCmd[1]:='sh $RES $EXE $OPT $DYNLINK $STATIC $STRIP -L.';}
 {     ExeCmd[1]:='sh $RES $EXE $OPT $DYNLINK $STATIC $STRIP -L.';}
       DllCmd[1]:='sh $RES $EXE $OPT -L.';
       DllCmd[1]:='sh $RES $EXE $OPT -L.';
@@ -218,7 +218,7 @@ begin
 {     DllCmd[1]:='sh $RES $EXE $OPT -L. -g -nostart -soname=$EXE';
 {     DllCmd[1]:='sh $RES $EXE $OPT -L. -g -nostart -soname=$EXE';
  }    DllCmd[2]:='strip --strip-unneeded $EXE';
  }    DllCmd[2]:='strip --strip-unneeded $EXE';
 {     DynamicLinker:='/lib/ld-beos.so.2';}
 {     DynamicLinker:='/lib/ld-beos.so.2';}
-      }
+*)
    end;
    end;
 end;
 end;
 
 
@@ -269,13 +269,13 @@ begin
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('-L'+HPath.Str);
+     LinkRes.Add(maybequoted('-L'+HPath.Str));
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
   HPath:=TStringListItem(LibrarySearchPath.First);
   HPath:=TStringListItem(LibrarySearchPath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('-L'+HPath.Str);
+     LinkRes.Add(maybequoted('-L'+HPath.Str));
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
 
 
@@ -309,7 +309,7 @@ begin
    begin
    begin
      s:=ObjectFiles.GetFirst;
      s:=ObjectFiles.GetFirst;
      if s<>'' then
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(maybequoted(s));
    end;
    end;
 
 
 {  LinkRes.Add('-lroot \');
 {  LinkRes.Add('-lroot \');
@@ -322,7 +322,7 @@ begin
      While not StaticLibFiles.Empty do
      While not StaticLibFiles.Empty do
       begin
       begin
         S:=StaticLibFiles.GetFirst;
         S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
+        LinkRes.AddFileName(maybequoted(s))
       end;
       end;
    end;
    end;
 
 
@@ -406,9 +406,9 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
@@ -458,9 +458,9 @@ var
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
@@ -470,7 +470,7 @@ var
   if success and (cs_link_strip in aktglobalswitches) then
   if success and (cs_link_strip in aktglobalswitches) then
    begin
    begin
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
+     Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
      success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
      success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
    end;
    end;
 
 
@@ -496,7 +496,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-11-19 16:30:24  peter
+  Revision 1.17  2004-12-22 16:32:45  peter
+    * maybequoted() added
+
+  Revision 1.16  2004/11/19 16:30:24  peter
     * fixed setting of mangledname when importing
     * fixed setting of mangledname when importing
 
 
   Revision 1.15  2004/11/08 22:09:59  peter
   Revision 1.15  2004/11/08 22:09:59  peter

+ 15 - 12
compiler/systems/t_bsd.pas

@@ -356,18 +356,18 @@ begin
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
      if LdSupportsNoResponseFile then
      if LdSupportsNoResponseFile then
-       LinkRes.Add('-L'+HPath.Str)
+       LinkRes.Add(maybequoted('-L'+HPath.Str))
      else
      else
-       LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
+       LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
   HPath:=TStringListItem(LibrarySearchPath.First);
   HPath:=TStringListItem(LibrarySearchPath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
      if LdSupportsNoResponseFile then
      if LdSupportsNoResponseFile then
-       LinkRes.Add('-L'+HPath.Str)
+       LinkRes.Add(maybequoted('-L'+HPath.Str))
      else
      else
-       LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
+       LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
 
 
@@ -390,7 +390,7 @@ begin
    begin
    begin
      s:=ObjectFiles.GetFirst;
      s:=ObjectFiles.GetFirst;
      if s<>'' then
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(maybequoted(s));
    end;
    end;
   if not LdSupportsNoResponseFile then
   if not LdSupportsNoResponseFile then
    LinkRes.Add(')');
    LinkRes.Add(')');
@@ -403,7 +403,7 @@ begin
      While not StaticLibFiles.Empty do
      While not StaticLibFiles.Empty do
       begin
       begin
         S:=StaticLibFiles.GetFirst;
         S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
+        LinkRes.AddFileName(maybequoted(s))
       end;
       end;
      if not LdSupportsNoResponseFile then
      if not LdSupportsNoResponseFile then
        LinkRes.Add(')');
        LinkRes.Add(')');
@@ -514,9 +514,9 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
@@ -545,16 +545,16 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
   success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
 
 
 { Strip the library ? }
 { Strip the library ? }
   if success and (cs_link_strip in aktglobalswitches) then
   if success and (cs_link_strip in aktglobalswitches) then
    begin
    begin
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
+     Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
      success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
      success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
    end;
    end;
 
 
@@ -612,7 +612,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.26  2004-11-19 16:30:24  peter
+  Revision 1.27  2004-12-22 16:32:45  peter
+    * maybequoted() added
+
+  Revision 1.26  2004/11/19 16:30:24  peter
     * fixed setting of mangledname when importing
     * fixed setting of mangledname when importing
 
 
   Revision 1.25  2004/11/19 14:21:44  marco
   Revision 1.25  2004/11/19 14:21:44  marco

+ 7 - 4
compiler/systems/t_emx.pas

@@ -484,11 +484,11 @@ begin
         Replace(cmdstr,'$DOSHEAPKB',tostr((stacksize+1023) shr 10));
         Replace(cmdstr,'$DOSHEAPKB',tostr((stacksize+1023) shr 10));
         Replace(cmdstr,'$STRIP',StripStr);
         Replace(cmdstr,'$STRIP',StripStr);
         Replace(cmdstr,'$APPTYPE',AppTypeStr);
         Replace(cmdstr,'$APPTYPE',AppTypeStr);
-        Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+        Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
         Replace(cmdstr,'$RSRC',RsrcStr);
         Replace(cmdstr,'$RSRC',RsrcStr);
-        Replace(cmdstr,'$OUT',OutName);
-        Replace(cmdstr,'$EXE',current_module.exefilename^);
+        Replace(cmdstr,'$OUT',maybequoted(OutName));
+        Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
         if i<>3 then
         if i<>3 then
          success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false)
          success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false)
         else
         else
@@ -516,7 +516,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2004-12-05 12:25:48  hajny
+  Revision 1.13  2004-12-22 16:32:45  peter
+    * maybequoted() added
+
+  Revision 1.12  2004/12/05 12:25:48  hajny
     * fix for compilation on 8.3 filesystems
     * fix for compilation on 8.3 filesystems
 
 
   Revision 1.11  2004/11/17 22:22:12  peter
   Revision 1.11  2004/11/17 22:22:12  peter

+ 14 - 11
compiler/systems/t_linux.pas

@@ -328,20 +328,20 @@ begin
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
+     LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
   HPath:=TStringListItem(LibrarySearchPath.First);
   HPath:=TStringListItem(LibrarySearchPath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
+     LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
 
 
   LinkRes.Add('INPUT(');
   LinkRes.Add('INPUT(');
   { add objectfiles, start with prt0 always }
   { add objectfiles, start with prt0 always }
   if prtobj<>'' then
   if prtobj<>'' then
-   LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
+   LinkRes.AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
   { try to add crti and crtbegin if linking to C }
   { try to add crti and crtbegin if linking to C }
   if linklibc then
   if linklibc then
    begin
    begin
@@ -355,7 +355,7 @@ begin
    begin
    begin
      s:=ObjectFiles.GetFirst;
      s:=ObjectFiles.GetFirst;
      if s<>'' then
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(maybequoted(s));
    end;
    end;
   LinkRes.Add(')');
   LinkRes.Add(')');
 
 
@@ -366,7 +366,7 @@ begin
      While not StaticLibFiles.Empty do
      While not StaticLibFiles.Empty do
       begin
       begin
         S:=StaticLibFiles.GetFirst;
         S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
+        LinkRes.AddFileName(maybequoted(s))
       end;
       end;
      LinkRes.Add(')');
      LinkRes.Add(')');
    end;
    end;
@@ -463,9 +463,9 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
   Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
@@ -503,9 +503,9 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$INIT',InitStr);
   Replace(cmdstr,'$INIT',InitStr);
   Replace(cmdstr,'$FINI',FiniStr);
   Replace(cmdstr,'$FINI',FiniStr);
   Replace(cmdstr,'$SONAME',SoNameStr);
   Replace(cmdstr,'$SONAME',SoNameStr);
@@ -515,7 +515,7 @@ begin
   if success and (cs_link_strip in aktglobalswitches) then
   if success and (cs_link_strip in aktglobalswitches) then
    begin
    begin
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
+     Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
      success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
      success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
    end;
    end;
 
 
@@ -578,7 +578,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2004-12-19 14:03:16  florian
+  Revision 1.32  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.31  2004/12/19 14:03:16  florian
     * dyn. linker path fixed for x86_64
     * dyn. linker path fixed for x86_64
 
 
   Revision 1.30  2004/11/17 22:22:12  peter
   Revision 1.30  2004/11/17 22:22:12  peter

+ 6 - 3
compiler/systems/t_macos.pas

@@ -203,9 +203,9 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',ScriptFixFileName(current_module.exefilename^));
+  Replace(cmdstr,'$EXE',maybequoted(ScriptFixFileName(current_module.exefilename^)));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',ScriptFixFileName(outputexedir+Info.ResName));
+  Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
@@ -245,7 +245,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.15  2004-11-19 16:30:24  peter
+  Revision 1.16  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.15  2004/11/19 16:30:24  peter
     * fixed setting of mangledname when importing
     * fixed setting of mangledname when importing
 
 
   Revision 1.14  2004/11/11 19:31:33  peter
   Revision 1.14  2004/11/11 19:31:33  peter

+ 11 - 21
compiler/systems/t_morph.pas

@@ -92,9 +92,7 @@ begin
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
      s:=HPath.Str;
      s:=HPath.Str;
-     if not (cs_link_on_target in aktglobalswitches) then
-       s:=GetShortName(s)
-     else
+     if (cs_link_on_target in aktglobalswitches) then
        s:=ScriptFixFileName(s);
        s:=ScriptFixFileName(s);
      LinkRes.Add('-L'+s);
      LinkRes.Add('-L'+s);
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
@@ -103,26 +101,20 @@ begin
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
      s:=HPath.Str;
      s:=HPath.Str;
-     if not (cs_link_on_target in aktglobalswitches) then
-       s:=GetShortName(s);
      if s<>'' then
      if s<>'' then
-       LinkRes.Add('SEARCH_DIR('+s+')');
+       LinkRes.Add('SEARCH_DIR('+maybequoted(s)+')');
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
 
 
   LinkRes.Add('INPUT (');
   LinkRes.Add('INPUT (');
   { add objectfiles, start with prt0 always }
   { add objectfiles, start with prt0 always }
   s:=FindObjectFile('prt0','',false);
   s:=FindObjectFile('prt0','',false);
-  if not (cs_link_on_target in aktglobalswitches) then
-    s:=GetShortName(s);
   LinkRes.AddFileName(s);
   LinkRes.AddFileName(s);
   while not ObjectFiles.Empty do
   while not ObjectFiles.Empty do
    begin
    begin
      s:=ObjectFiles.GetFirst;
      s:=ObjectFiles.GetFirst;
-     if not (cs_link_on_target in aktglobalswitches) then
-       s:=GetShortName(s);
      if s<>'' then
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(maybequoted(s));
    end;
    end;
   LinkRes.Add(')');
   LinkRes.Add(')');
 
 
@@ -133,9 +125,7 @@ begin
      While not StaticLibFiles.Empty do
      While not StaticLibFiles.Empty do
       begin
       begin
         S:=StaticLibFiles.GetFirst;
         S:=StaticLibFiles.GetFirst;
-        if not (cs_link_on_target in aktglobalswitches) then
-          s:=GetShortName(s);
-        LinkRes.AddFileName(s);
+        LinkRes.AddFileName(maybequoted(s));
       end;
       end;
      LinkRes.Add(')');
      LinkRes.Add(')');
    end;
    end;
@@ -190,12 +180,9 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  if pos(' ',current_module.exefilename^)>0 then
-    Replace(cmdstr,'$EXE','"'+ScriptFixFileName(current_module.exefilename^)+'"')
-  else
-    Replace(cmdstr,'$EXE',ScriptFixFileName(current_module.exefilename^));
+  Replace(cmdstr,'$EXE',maybequoted(ScriptFixFileName(current_module.exefilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',ScriptFixFileName(outputexedir+Info.ResName));
+  Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
   success:=DoExec(FindUtil(BinStr),cmdstr,true,false);
   success:=DoExec(FindUtil(BinStr),cmdstr,true,false);
 
 
 { Stripping Enabled? }
 { Stripping Enabled? }
@@ -205,7 +192,7 @@ begin
   if success and (cs_link_strip in aktglobalswitches) then
   if success and (cs_link_strip in aktglobalswitches) then
     begin
     begin
       SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
       SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
-      Replace(cmdstr,'$EXE',current_module.exefilename^);
+      Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
       success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
       success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
     end;
     end;
 
 
@@ -228,7 +215,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2004-10-25 15:38:41  peter
+  Revision 1.9  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.8  2004/10/25 15:38:41  peter
     * heap and heapsize removed
     * heap and heapsize removed
     * checkpointer fixes
     * checkpointer fixes
 
 

+ 8 - 5
compiler/systems/t_nwl.pas

@@ -589,10 +589,10 @@ begin
 { Call linker, this will generate a new object file that will be passed
 { Call linker, this will generate a new object file that will be passed
   to nlmconv. Otherwise we could not create nlms without debug info }
   to nlmconv. Otherwise we could not create nlms without debug info }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
-  Replace(cmdstr,'$TMPOBJ',outputexedir+tmpLinkFileName);
+  Replace(cmdstr,'$TMPOBJ',maybequoted(outputexedir+tmpLinkFileName));
   Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
   Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
   success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
   success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
 
 
@@ -606,7 +606,7 @@ begin
     NLMConvLinkFile.writetodisk;
     NLMConvLinkFile.writetodisk;
     NLMConvLinkFile.Free;
     NLMConvLinkFile.Free;
     SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
     SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
-    Replace(cmdstr,'$RES',outputexedir+'n'+Info.ResName);
+    Replace(cmdstr,'$RES',maybequoted(outputexedir+'n'+Info.ResName));
     Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
     Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
     success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
     success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
     if (success) and not(cs_link_extern in aktglobalswitches) then
     if (success) and not(cs_link_extern in aktglobalswitches) then
@@ -646,7 +646,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2004-11-25 18:46:11  armin
+  Revision 1.12  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.11  2004/11/25 18:46:11  armin
   * added utilsprefix for as,ld and nlmconv
   * added utilsprefix for as,ld and nlmconv
 
 
   Revision 1.10  2004/11/19 16:30:24  peter
   Revision 1.10  2004/11/19 16:30:24  peter

+ 8 - 5
compiler/systems/t_nwm.pas

@@ -520,10 +520,10 @@ begin
 { Call linker, this will generate a new object file that will be passed
 { Call linker, this will generate a new object file that will be passed
   to nlmconv. Otherwise we could not create nlms without debug info }
   to nlmconv. Otherwise we could not create nlms without debug info }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
-  Replace(cmdstr,'$TMPOBJ',outputexedir+tmpLinkFileName);
+  Replace(cmdstr,'$TMPOBJ',maybequoted(outputexedir+tmpLinkFileName));
   Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
   Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
   success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
   success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
 
 
@@ -537,7 +537,7 @@ begin
     NLMConvLinkFile.writetodisk;
     NLMConvLinkFile.writetodisk;
     NLMConvLinkFile.Free;
     NLMConvLinkFile.Free;
     SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
     SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
-    Replace(cmdstr,'$RES',outputexedir+'n'+Info.ResName);
+    Replace(cmdstr,'$RES',maybequoted(outputexedir+'n'+Info.ResName));
     Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
     Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
     success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
     success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
     if (success) and not(cs_link_extern in aktglobalswitches) then
     if (success) and not(cs_link_extern in aktglobalswitches) then
@@ -564,7 +564,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2004-11-25 18:46:11  armin
+  Revision 1.23  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.22  2004/11/25 18:46:11  armin
   * added utilsprefix for as,ld and nlmconv
   * added utilsprefix for as,ld and nlmconv
 
 
   Revision 1.21  2004/11/19 16:30:24  peter
   Revision 1.21  2004/11/19 16:30:24  peter

+ 13 - 10
compiler/systems/t_os2.pas

@@ -41,9 +41,9 @@ implementation
      strings,
      strings,
      dos,
      dos,
      cutils,cclasses,
      cutils,cclasses,
-     globtype,comphook,systems,symconst,symsym,symdef,
+     globtype,systems,symconst,symdef,
      globals,verbose,fmodule,script,
      globals,verbose,fmodule,script,
-     import,link,i_os2,ppu;
+     import,link,i_os2;
 
 
   type
   type
     timportlibos2=class(timportlib)
     timportlibos2=class(timportlib)
@@ -383,13 +383,13 @@ begin
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('-L'+HPath.Str);
+     LinkRes.Add(maybequoted('-L'+HPath.Str));
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
   HPath:=TStringListItem(LibrarySearchPath.First);
   HPath:=TStringListItem(LibrarySearchPath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('-L'+HPath.Str);
+     LinkRes.Add(maybequoted('-L'+HPath.Str));
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
 
 
@@ -399,7 +399,7 @@ begin
    begin
    begin
      s:=ObjectFiles.GetFirst;
      s:=ObjectFiles.GetFirst;
      if s<>'' then
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(maybequoted(s));
    end;
    end;
 
 
   { Write staticlibraries }
   { Write staticlibraries }
@@ -407,7 +407,7 @@ begin
   While not StaticLibFiles.Empty do
   While not StaticLibFiles.Empty do
    begin
    begin
      S:=StaticLibFiles.GetFirst;
      S:=StaticLibFiles.GetFirst;
-     LinkRes.AddFileName(s)
+     LinkRes.AddFileName(maybequoted(s))
    end;
    end;
 
 
   { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
   { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
@@ -484,11 +484,11 @@ begin
         Replace(cmdstr,'$DOSHEAPKB',tostr((stacksize+1023) shr 10));
         Replace(cmdstr,'$DOSHEAPKB',tostr((stacksize+1023) shr 10));
         Replace(cmdstr,'$STRIP',StripStr);
         Replace(cmdstr,'$STRIP',StripStr);
         Replace(cmdstr,'$APPTYPE',AppTypeStr);
         Replace(cmdstr,'$APPTYPE',AppTypeStr);
-        Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+        Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
         Replace(cmdstr,'$RSRC',RsrcStr);
         Replace(cmdstr,'$RSRC',RsrcStr);
-        Replace(cmdstr,'$OUT',OutName);
-        Replace(cmdstr,'$EXE',current_module.exefilename^);
+        Replace(cmdstr,'$OUT',maybequoted(OutName));
+        Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
         if i<>3 then
         if i<>3 then
          success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false)
          success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false)
         else
         else
@@ -516,7 +516,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-12-05 12:25:48  hajny
+  Revision 1.17  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.16  2004/12/05 12:25:48  hajny
     * fix for compilation on 8.3 filesystems
     * fix for compilation on 8.3 filesystems
 
 
   Revision 1.15  2004/11/17 22:22:12  peter
   Revision 1.15  2004/11/17 22:22:12  peter

+ 5 - 2
compiler/systems/t_palmos.pas

@@ -183,7 +183,7 @@ begin
       begin
       begin
         Replace(cmdstr,'$EXE',MaybeQuote(current_module.exefilename^));
         Replace(cmdstr,'$EXE',MaybeQuote(current_module.exefilename^));
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
-        Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+        Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
         Replace(cmdstr,'$STRIP',StripStr);
         Replace(cmdstr,'$STRIP',StripStr);
         Replace(cmdstr,'$SCRIPT',FindUtil('palm.ld'));
         Replace(cmdstr,'$SCRIPT',FindUtil('palm.ld'));
         Replace(cmdstr,'$APPNAME',palmos_applicationname);
         Replace(cmdstr,'$APPNAME',palmos_applicationname);
@@ -213,7 +213,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2004-06-20 08:55:32  florian
+  Revision 1.4  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.3  2004/06/20 08:55:32  florian
     * logs truncated
     * logs truncated
 
 
 }
 }

+ 13 - 10
compiler/systems/t_sunos.pas

@@ -292,13 +292,13 @@ begin
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
+     LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
   HPath:=TStringListItem(LibrarySearchPath.First);
   HPath:=TStringListItem(LibrarySearchPath.First);
   while assigned(HPath) do
   while assigned(HPath) do
    begin
    begin
-     LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
+     LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
      HPath:=TStringListItem(HPath.Next);
      HPath:=TStringListItem(HPath.Next);
    end;
    end;
 
 
@@ -319,7 +319,7 @@ begin
    begin
    begin
      s:=ObjectFiles.GetFirst;
      s:=ObjectFiles.GetFirst;
      if s<>'' then
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(maybequoted(s));
    end;
    end;
   LinkRes.Add(')');
   LinkRes.Add(')');
 
 
@@ -330,7 +330,7 @@ begin
      While not StaticLibFiles.Empty do
      While not StaticLibFiles.Empty do
       begin
       begin
         S:=StaticLibFiles.GetFirst;
         S:=StaticLibFiles.GetFirst;
-        LinkRes.AddFileName(s)
+        LinkRes.AddFileName(maybequoted(s))
       end;
       end;
      LinkRes.Add(')');
      LinkRes.Add(')');
    end;
    end;
@@ -416,9 +416,9 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.exefilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
@@ -448,16 +448,16 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
+  Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+  Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
   success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
 
 
 { Strip the library ? }
 { Strip the library ? }
   if success and (cs_link_strip in aktglobalswitches) then
   if success and (cs_link_strip in aktglobalswitches) then
    begin
    begin
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
      SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
-     Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
+     Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
      success:=DoExec(utilsprefix+FindUtil(binstr),cmdstr,true,false);
      success:=DoExec(utilsprefix+FindUtil(binstr),cmdstr,true,false);
    end;
    end;
 
 
@@ -491,7 +491,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.15  2004-11-19 16:30:24  peter
+  Revision 1.16  2004-12-22 16:32:46  peter
+    * maybequoted() added
+
+  Revision 1.15  2004/11/19 16:30:24  peter
     * fixed setting of mangledname when importing
     * fixed setting of mangledname when importing
 
 
   Revision 1.14  2004/11/08 22:09:59  peter
   Revision 1.14  2004/11/08 22:09:59  peter