amiga: section smartlinking support for amiga. needs vlink nightly

git-svn-id: trunk@35243 -
This commit is contained in:
Károly Balogh 2017-01-05 23:08:08 +00:00
parent 48de52f41b
commit 48744d0abd
2 changed files with 34 additions and 14 deletions

View File

@ -97,7 +97,7 @@ unit i_amiga;
system : system_powerpc_Amiga;
name : 'AmigaOS for PowerPC';
shortname : 'amiga';
flags : [tf_files_case_aware,tf_requires_proper_alignment,tf_has_winlike_resources];
flags : [tf_files_case_aware,tf_requires_proper_alignment,tf_has_winlike_resources,tf_smartlink_sections];
cpu : cpu_powerpc;
unit_env : 'AMIGAUNITS';
extradefines : 'PPC603;HASAMIGA;AMIGAOS4';

View File

@ -52,7 +52,7 @@ implementation
uses
SysUtils,
cutils,cfileutl,cclasses,
cutils,cfileutl,cclasses,aasmbase,
globtype,globals,systems,verbose,script,fmodule,i_amiga;
@ -82,7 +82,7 @@ begin
end
else
begin
ExeCmd[1]:='vlink -b amigahunk $OPT $STRIP -o $EXE -T $RES';
ExeCmd[1]:='vlink -b amigahunk $GCSECTIONS $OPT $STRIP -o $EXE -T $RES';
end;
end;
end;
@ -97,7 +97,7 @@ begin
end
else
begin
ExeCmd[1]:='vlink -q -n -b elf32amigaos -P_start -P__amigaos4__ -nostdlib $OPT $STRIP -o $EXE -T $RES';
ExeCmd[1]:='vlink -q -n -b elf32amigaos -P_start -P__amigaos4__ -nostdlib $GCSECTIONS $OPT $STRIP -o $EXE -T $RES';
end;
end;
end;
@ -346,9 +346,21 @@ var
CmdStr : TCmdStr;
StripStr: string[40];
DynLinkStr : string;
GCSectionsStr : string;
begin
StripStr:='';
if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s';
GCSectionsStr:='';
DynLinkStr:='';
if (cs_link_strip in current_settings.globalswitches) then
StripStr:='-s';
if rlinkpath<>'' Then
DynLinkStr:='--rpath-link '+rlinkpath;
if UseVLink then
begin
if create_smartlink_sections then
GCSectionsStr:='-gc-all -sc -sd';
end;
{ Call linker }
SplitBinCmd(Info.ExeCmd[1],BinStr,CmdStr);
@ -357,11 +369,9 @@ begin
Replace(cmdstr,'$EXE',Unix2AmigaPath(maybequoted(ScriptFixFileName(current_module.exefilename))));
Replace(cmdstr,'$RES',Unix2AmigaPath(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
Replace(cmdstr,'$STRIP',StripStr);
if rlinkpath<>'' Then
DynLinkStr:='--rpath-link '+rlinkpath
else
DynLinkStr:='';
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
Replace(cmdstr,'$DYNLINK',DynLinkStr);
MakeAmiga68kExe:=DoExec(BinStr,CmdStr,true,false);
end;
@ -372,9 +382,21 @@ var
CmdStr : TCmdStr;
StripStr: string[40];
DynLinkStr : string;
GCSectionsStr : string;
begin
StripStr:='';
if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s';
GCSectionsStr:='';
DynLinkStr:='';
if (cs_link_strip in current_settings.globalswitches) then
StripStr:='-s';
if rlinkpath<>'' Then
DynLinkStr:='--rpath-link '+rlinkpath;
if UseVLink then
begin
if create_smartlink_sections then
GCSectionsStr:='-gc-all -sc -sd';
end;
{ Call linker }
SplitBinCmd(Info.ExeCmd[1],BinStr,CmdStr);
@ -383,11 +405,9 @@ begin
Replace(cmdstr,'$EXE',Unix2AmigaPath(maybequoted(ScriptFixFileName(current_module.exefilename))));
Replace(cmdstr,'$RES',Unix2AmigaPath(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
Replace(cmdstr,'$STRIP',StripStr);
if rlinkpath<>'' Then
DynLinkStr:='--rpath-link '+rlinkpath
else
DynLinkStr:='';
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
Replace(cmdstr,'$DYNLINK',DynLinkStr);
MakeAmigaPPCExe:=DoExec(BinStr,CmdStr,true,false);
end;