ソースを参照

Add fForceUseForwardSlash to TLinkRes class, used for vlink linker on hosts using backslashes

git-svn-id: trunk@49223 -
pierre 4 年 前
コミット
f5e5f9645c

+ 19 - 6
compiler/cscript.pas

@@ -91,6 +91,7 @@ type
   TLinkRes = Class (TScript)
   TLinkRes = Class (TScript)
     section: string[30];
     section: string[30];
     fRealResponseFile: Boolean;
     fRealResponseFile: Boolean;
+    fForceUseForwardSlash: Boolean;
     constructor Create(const ScriptName : TCmdStr; RealResponseFile: Boolean);
     constructor Create(const ScriptName : TCmdStr; RealResponseFile: Boolean);
     procedure Add(const s:TCmdStr);
     procedure Add(const s:TCmdStr);
     procedure AddFileName(const s:TCmdStr);
     procedure AddFileName(const s:TCmdStr);
@@ -497,6 +498,7 @@ constructor TLinkRes.Create(const ScriptName: TCmdStr; RealResponseFile: Boolean
 begin
 begin
   inherited Create(ScriptName);
   inherited Create(ScriptName);
   fRealResponseFile:=RealResponseFile;
   fRealResponseFile:=RealResponseFile;
+  fForceUseForwardSlash:=false;
 end;
 end;
 
 
 procedure TLinkRes.Add(const s:TCmdStr);
 procedure TLinkRes.Add(const s:TCmdStr);
@@ -506,6 +508,9 @@ begin
 end;
 end;
 
 
 procedure TLinkRes.AddFileName(const s:TCmdStr);
 procedure TLinkRes.AddFileName(const s:TCmdStr);
+var
+  ls: TCmdStr;
+  i: longint;
 begin
 begin
   if section<>'' then
   if section<>'' then
    begin
    begin
@@ -514,23 +519,31 @@ begin
    end;
    end;
   if s<>'' then
   if s<>'' then
    begin
    begin
+     ls:=s;
+     if fForceUseForwardSlash then
+       { Fix separator }
+       for i:=1 to length(ls) do
+         if (ls[i]=source_info.dirsep) then
+           ls[i]:='/';
      { GNU ld only supports double quotes in the response file. }
      { GNU ld only supports double quotes in the response file. }
      if fRealResponseFile and
      if fRealResponseFile and
-        (s[1]='''') and
+        (ls[1]='''') and
         (((cs_link_on_target in current_settings.globalswitches) and
         (((cs_link_on_target in current_settings.globalswitches) and
           (target_info.script=script_unix)) or
           (target_info.script=script_unix)) or
          (not(cs_link_on_target in current_settings.globalswitches) and
          (not(cs_link_on_target in current_settings.globalswitches) and
           (source_info.script=script_unix))) then
           (source_info.script=script_unix))) then
        inherited add(UnixRequoteWithDoubleQuotes(s))
        inherited add(UnixRequoteWithDoubleQuotes(s))
-     else if not(s[1] in ['a'..'z','A'..'Z','/','\','.','"']) then
+     else if not(ls[1] in ['a'..'z','A'..'Z','/','\','.','"']) then
       begin
       begin
-        if cs_link_on_target in current_settings.globalswitches then
-          inherited Add('.'+target_info.DirSep+s)
+        if fForceUseForwardSlash then
+          inherited Add('./'+ls)
+        else if (cs_link_on_target in current_settings.globalswitches) then
+          inherited Add('.'+target_info.DirSep+ls)
         else
         else
-          inherited Add('.'+source_info.DirSep+s);
+          inherited Add('.'+source_info.DirSep+ls);
       end
       end
      else
      else
-      inherited Add(s);
+      inherited Add(ls);
    end;
    end;
 end;
 end;
 
 

+ 2 - 1
compiler/systems/t_amiga.pas

@@ -131,7 +131,8 @@ begin
 
 
   { Open link.res file }
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
-
+  if UseVLink and (source_info.dirsep <> '/') then
+    LinkRes.fForceUseForwardSlash:=true;
   { Write path to search libraries }
   { Write path to search libraries }
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
   while assigned(HPath) do
   while assigned(HPath) do

+ 2 - 0
compiler/systems/t_atari.pas

@@ -104,6 +104,8 @@ begin
 
 
   { Open link.res file }
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+  if UseVLink and (source_info.dirsep <> '/') then
+    LinkRes.fForceUseForwardSlash:=true;
 
 
   { Write path to search libraries }
   { Write path to search libraries }
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);

+ 2 - 0
compiler/systems/t_morph.pas

@@ -98,6 +98,8 @@ begin
 
 
   { Open link.res file }
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+  if UseVLink and (source_info.dirsep <> '/') then
+    LinkRes.fForceUseForwardSlash:=true;
 
 
   { Write path to search libraries }
   { Write path to search libraries }
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);

+ 2 - 0
compiler/systems/t_msxdos.pas

@@ -141,6 +141,8 @@ function TLinkerMSXDOS.WriteResponseFile_Vlink: Boolean;
 
 
     { Open link.res file }
     { Open link.res file }
     LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
     LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+    if (source_info.dirsep <> '/') then
+      LinkRes.fForceUseForwardSlash:=true;
 
 
     LinkRes.Add('INPUT (');
     LinkRes.Add('INPUT (');
 
 

+ 2 - 0
compiler/systems/t_sinclairql.pas

@@ -144,6 +144,8 @@ begin
 
 
   { Open link.res file }
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+  if UseVLink and (source_info.dirsep <> '/') then
+    LinkRes.fForceUseForwardSlash:=true;
 
 
   { Write path to search libraries }
   { Write path to search libraries }
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
   HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);

+ 2 - 0
compiler/systems/t_zxspectrum.pas

@@ -140,6 +140,8 @@ function TLinkerZXSpectrum.WriteResponseFile_Vlink: Boolean;
 
 
     { Open link.res file }
     { Open link.res file }
     LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
     LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+    if (source_info.dirsep <> '/') then
+      LinkRes.fForceUseForwardSlash:=true;
 
 
     LinkRes.Add('INPUT (');
     LinkRes.Add('INPUT (');