summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorpierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-17 22:17:46 +0000
committerpierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-17 22:17:46 +0000
commit003a6cf3bbb6833d60fdf0df1ad4d75449951a8e (patch)
tree7dd7b885144b39d7f7c49991d4ef84213c8b5f02 /compiler
parent95f10f174917c96077a4b8a8da0d69d6fc775349 (diff)
downloadfpc-003a6cf3bbb6833d60fdf0df1ad4d75449951a8e.tar.gz
Add fForceUseForwardSlash to TLinkRes class, used for vlink linker on hosts using backslashes
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@49223 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cscript.pas25
-rw-r--r--compiler/systems/t_amiga.pas3
-rw-r--r--compiler/systems/t_atari.pas2
-rw-r--r--compiler/systems/t_morph.pas2
-rw-r--r--compiler/systems/t_msxdos.pas2
-rw-r--r--compiler/systems/t_sinclairql.pas2
-rw-r--r--compiler/systems/t_zxspectrum.pas2
7 files changed, 31 insertions, 7 deletions
diff --git a/compiler/cscript.pas b/compiler/cscript.pas
index 0ecb4eff7d..121e0deb07 100644
--- a/compiler/cscript.pas
+++ b/compiler/cscript.pas
@@ -91,6 +91,7 @@ type
TLinkRes = Class (TScript)
section: string[30];
fRealResponseFile: Boolean;
+ fForceUseForwardSlash: Boolean;
constructor Create(const ScriptName : TCmdStr; RealResponseFile: Boolean);
procedure Add(const s:TCmdStr);
procedure AddFileName(const s:TCmdStr);
@@ -497,6 +498,7 @@ constructor TLinkRes.Create(const ScriptName: TCmdStr; RealResponseFile: Boolean
begin
inherited Create(ScriptName);
fRealResponseFile:=RealResponseFile;
+ fForceUseForwardSlash:=false;
end;
procedure TLinkRes.Add(const s:TCmdStr);
@@ -506,6 +508,9 @@ begin
end;
procedure TLinkRes.AddFileName(const s:TCmdStr);
+var
+ ls: TCmdStr;
+ i: longint;
begin
if section<>'' then
begin
@@ -514,23 +519,31 @@ begin
end;
if s<>'' then
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. }
if fRealResponseFile and
- (s[1]='''') and
+ (ls[1]='''') and
(((cs_link_on_target in current_settings.globalswitches) and
(target_info.script=script_unix)) or
(not(cs_link_on_target in current_settings.globalswitches) and
(source_info.script=script_unix))) then
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
- 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
- inherited Add('.'+source_info.DirSep+s);
+ inherited Add('.'+source_info.DirSep+ls);
end
else
- inherited Add(s);
+ inherited Add(ls);
end;
end;
diff --git a/compiler/systems/t_amiga.pas b/compiler/systems/t_amiga.pas
index 03a2896952..431dbdc69c 100644
--- a/compiler/systems/t_amiga.pas
+++ b/compiler/systems/t_amiga.pas
@@ -131,7 +131,8 @@ begin
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
-
+ if UseVLink and (source_info.dirsep <> '/') then
+ LinkRes.fForceUseForwardSlash:=true;
{ Write path to search libraries }
HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
while assigned(HPath) do
diff --git a/compiler/systems/t_atari.pas b/compiler/systems/t_atari.pas
index 0cf5e3359a..ed93d9f72f 100644
--- a/compiler/systems/t_atari.pas
+++ b/compiler/systems/t_atari.pas
@@ -104,6 +104,8 @@ begin
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+ if UseVLink and (source_info.dirsep <> '/') then
+ LinkRes.fForceUseForwardSlash:=true;
{ Write path to search libraries }
HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
diff --git a/compiler/systems/t_morph.pas b/compiler/systems/t_morph.pas
index 16c4926625..5a2360c42e 100644
--- a/compiler/systems/t_morph.pas
+++ b/compiler/systems/t_morph.pas
@@ -98,6 +98,8 @@ begin
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+ if UseVLink and (source_info.dirsep <> '/') then
+ LinkRes.fForceUseForwardSlash:=true;
{ Write path to search libraries }
HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
diff --git a/compiler/systems/t_msxdos.pas b/compiler/systems/t_msxdos.pas
index 04c49df622..0d7475dca2 100644
--- a/compiler/systems/t_msxdos.pas
+++ b/compiler/systems/t_msxdos.pas
@@ -141,6 +141,8 @@ function TLinkerMSXDOS.WriteResponseFile_Vlink: Boolean;
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+ if (source_info.dirsep <> '/') then
+ LinkRes.fForceUseForwardSlash:=true;
LinkRes.Add('INPUT (');
diff --git a/compiler/systems/t_sinclairql.pas b/compiler/systems/t_sinclairql.pas
index 42da38a77b..1e16e4ebab 100644
--- a/compiler/systems/t_sinclairql.pas
+++ b/compiler/systems/t_sinclairql.pas
@@ -144,6 +144,8 @@ begin
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+ if UseVLink and (source_info.dirsep <> '/') then
+ LinkRes.fForceUseForwardSlash:=true;
{ Write path to search libraries }
HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
diff --git a/compiler/systems/t_zxspectrum.pas b/compiler/systems/t_zxspectrum.pas
index 6c055000ed..e4adc0d334 100644
--- a/compiler/systems/t_zxspectrum.pas
+++ b/compiler/systems/t_zxspectrum.pas
@@ -140,6 +140,8 @@ function TLinkerZXSpectrum.WriteResponseFile_Vlink: Boolean;
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
+ if (source_info.dirsep <> '/') then
+ LinkRes.fForceUseForwardSlash:=true;
LinkRes.Add('INPUT (');