mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:09:20 +02:00
* powerpc-morphos: add support for linker map file generation, some code cleanups
This commit is contained in:
parent
dea81f4f60
commit
4b88fa8e3b
@ -69,12 +69,12 @@ begin
|
|||||||
begin
|
begin
|
||||||
if not UseVLink then
|
if not UseVLink then
|
||||||
begin
|
begin
|
||||||
ExeCmd[1]:='ld $OPT $GCSECTIONS -o $EXE $RES';
|
ExeCmd[1]:='ld $OPT $GCSECTIONS $MAP -o $EXE $RES';
|
||||||
ExeCmd[2]:='strip --strip-unneeded --remove-section .comment $EXE';
|
ExeCmd[2]:='strip --strip-unneeded --remove-section .comment $EXE';
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ExeCmd[1]:='vlink -b elf32amiga $OPT $STRIP $GCSECTIONS -o $EXE -T $RES';
|
ExeCmd[1]:='vlink -b elf32amiga $OPT $STRIP $GCSECTIONS $MAP -o $EXE -T $RES';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -212,25 +212,31 @@ var
|
|||||||
success : boolean;
|
success : boolean;
|
||||||
GCSectionsStr: string;
|
GCSectionsStr: string;
|
||||||
StripStr: string[40];
|
StripStr: string[40];
|
||||||
|
MapStr: string;
|
||||||
begin
|
begin
|
||||||
StripStr:='';
|
StripStr:='';
|
||||||
GCSectionsStr:='';
|
GCSectionsStr:='';
|
||||||
|
MapStr:='';
|
||||||
|
|
||||||
if not(cs_link_nolink in current_settings.globalswitches) then
|
if not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
Message1(exec_i_linking,current_module.exefilename);
|
Message1(exec_i_linking,current_module.exefilename);
|
||||||
|
|
||||||
if UseVLink then
|
if UseVLink then
|
||||||
begin
|
begin
|
||||||
if (cs_link_strip in current_settings.globalswitches) then
|
if (cs_link_strip in current_settings.globalswitches) then
|
||||||
StripStr:='-s -P __abox__';
|
StripStr:='-s -P __abox__';
|
||||||
if create_smartlink_sections then
|
if (cs_link_map in current_settings.globalswitches) then
|
||||||
GCSectionsStr:='-gc-all -sc -sd';
|
MapStr:='-M'+Unix2AmigaPath(maybequoted(ScriptFixFilename(current_module.mapfilename)));
|
||||||
end
|
if create_smartlink_sections then
|
||||||
|
GCSectionsStr:='-gc-all -sc -sd';
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if create_smartlink_sections then
|
if (cs_link_map in current_settings.globalswitches) then
|
||||||
GCSectionsStr:='--gc-sections -e _start';
|
MapStr:='-Map '+maybequoted(ScriptFixFileName(current_module.mapfilename));
|
||||||
end;
|
if create_smartlink_sections then
|
||||||
|
GCSectionsStr:='--gc-sections -e _start';
|
||||||
|
end;
|
||||||
|
|
||||||
{ Write used files and libraries }
|
{ Write used files and libraries }
|
||||||
WriteResponseFile(false);
|
WriteResponseFile(false);
|
||||||
@ -238,19 +244,19 @@ begin
|
|||||||
{ Call linker }
|
{ Call linker }
|
||||||
SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
|
SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
|
||||||
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
||||||
|
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
||||||
|
Replace(cmdstr,'$MAP',MapStr);
|
||||||
if UseVLink then
|
if UseVLink then
|
||||||
begin
|
begin
|
||||||
Replace(cmdstr,'$EXE',Unix2AmigaPath(maybequoted(ScriptFixFileName(current_module.exefilename))));
|
Replace(cmdstr,'$EXE',Unix2AmigaPath(maybequoted(ScriptFixFileName(current_module.exefilename))));
|
||||||
Replace(cmdstr,'$RES',Unix2AmigaPath(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
|
Replace(cmdstr,'$RES',Unix2AmigaPath(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
|
||||||
Replace(cmdstr,'$STRIP',StripStr);
|
Replace(cmdstr,'$STRIP',StripStr);
|
||||||
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Replace(cmdstr,'$EXE',maybequoted(ScriptFixFileName(current_module.exefilename)));
|
Replace(cmdstr,'$EXE',maybequoted(ScriptFixFileName(current_module.exefilename)));
|
||||||
Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
|
Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
|
||||||
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
end;
|
||||||
end;
|
|
||||||
success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
|
success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
|
||||||
|
|
||||||
{ Stripping Enabled? }
|
{ Stripping Enabled? }
|
||||||
@ -258,21 +264,20 @@ begin
|
|||||||
{ __abox__ symbol, which is required to be present in current MorphOS }
|
{ __abox__ symbol, which is required to be present in current MorphOS }
|
||||||
{ executables. }
|
{ executables. }
|
||||||
if not UseVLink then
|
if not UseVLink then
|
||||||
begin
|
begin
|
||||||
if success and (cs_link_strip in current_settings.globalswitches) then
|
if success and (cs_link_strip in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
|
SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
|
||||||
Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename));
|
Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename));
|
||||||
success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
|
success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
DeleteFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user