* fixes to the compiler util exe search routines, which caused the compiler to

erroneusly find '/usr/bin/ld' instead of '/usr/bin/ld.bfd' on OpenBSD, which
  silently produced broken executables, which made this bug even more "fun" to
  find. :)

git-svn-id: trunk@42128 -
This commit is contained in:
nickysn 2019-05-26 16:57:08 +00:00
parent 0c471494e8
commit 40e6c06f67
2 changed files with 21 additions and 3 deletions

View File

@ -1284,8 +1284,16 @@ end;
function FindExe(const bin:TCmdStr;allowcache:boolean;var foundfile:TCmdStr):boolean;
var
b : TCmdStr;
begin
FindExe:=FindFileInExeLocations(ChangeFileExt(bin,source_info.exeext),allowcache,foundfile);
{ change extension only on platforms that use an exe extension, otherwise on OpenBSD
'ld.bfd' gets converted to 'ld' }
if source_info.exeext<>'' then
b:=ChangeFileExt(bin,source_info.exeext)
else
b:=bin;
FindExe:=FindFileInExeLocations(b,allowcache,foundfile);
end;

View File

@ -681,10 +681,20 @@ Implementation
if cs_link_on_target in current_settings.globalswitches then
begin
{ If linking on target, don't add any path PM }
FindUtil:=ChangeFileExt(s,target_info.exeext);
{ change extension only on platforms that use an exe extension, otherwise on OpenBSD 'ld.bfd' gets
converted to 'ld' }
if target_info.exeext<>'' then
FindUtil:=ChangeFileExt(s,target_info.exeext)
else
FindUtil:=s;
exit;
end;
UtilExe:=ChangeFileExt(s,source_info.exeext);
{ change extension only on platforms that use an exe extension, otherwise on OpenBSD 'ld.bfd' gets converted
to 'ld' }
if source_info.exeext<>'' then
UtilExe:=ChangeFileExt(s,source_info.exeext)
else
UtilExe:=s;
FoundBin:='';
Found:=false;
if utilsdirectory<>'' then