mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:09:20 +02:00
Add fForceUseForwardSlash to TLinkRes class, used for vlink linker on hosts using backslashes
git-svn-id: trunk@49223 -
This commit is contained in:
parent
d8f02107a1
commit
f5e5f9645c
@ -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
|
if fForceUseForwardSlash then
|
||||||
inherited Add('.'+target_info.DirSep+s)
|
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;
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
@ -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 (');
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -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 (');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user