* patch by Christo Crause: Passing a file name with extension to cross compiler

with -o causes error, fixed, resolves #36562

git-svn-id: trunk@43921 -
This commit is contained in:
florian 2020-01-12 20:57:52 +00:00
parent 5a1e6c2e91
commit 9926eb8dc6

View File

@ -1260,13 +1260,15 @@ var
StaticStr, StaticStr,
GCSectionsStr, GCSectionsStr,
DynLinkStr, DynLinkStr,
StripStr: string; StripStr,
FixedExeFileName: string;
begin begin
{ for future use } { for future use }
StaticStr:=''; StaticStr:='';
StripStr:=''; StripStr:='';
mapstr:=''; mapstr:='';
DynLinkStr:=''; DynLinkStr:='';
FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
GCSectionsStr:='--gc-sections'; GCSectionsStr:='--gc-sections';
//if not(cs_link_extern in current_settings.globalswitches) then //if not(cs_link_extern in current_settings.globalswitches) then
@ -1284,7 +1286,7 @@ begin
Replace(cmdstr,'$OPT',Info.ExtraOptions); Replace(cmdstr,'$OPT',Info.ExtraOptions);
if not(cs_link_on_target in current_settings.globalswitches) then if not(cs_link_on_target in current_settings.globalswitches) then
begin begin
Replace(cmdstr,'$EXE',(maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf'))))); Replace(cmdstr,'$EXE',FixedExeFileName);
Replace(cmdstr,'$RES',(maybequoted(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);
@ -1294,7 +1296,7 @@ begin
end end
else else
begin begin
Replace(cmdstr,'$EXE',maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')))); Replace(cmdstr,'$EXE',FixedExeFileName);
Replace(cmdstr,'$RES',maybequoted(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);
@ -1310,16 +1312,16 @@ begin
{ Post process } { Post process }
if success and not(cs_link_nolink in current_settings.globalswitches) then if success and not(cs_link_nolink in current_settings.globalswitches) then
success:=PostProcessExecutable(current_module.exefilename+'.elf',false); success:=PostProcessExecutable(FixedExeFileName,false);
if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded]) then if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded]) then
begin begin
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+ success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')))+' '+ FixedExeFileName+' '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false); maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
if success then if success then
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+ success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')))+' '+ FixedExeFileName+' '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false); maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
end; end;