Allow use of native ld or GNU gld for AIX

git-svn-id: trunk@29047 -
This commit is contained in:
pierre 2014-11-09 22:22:29 +00:00
parent d9d5fd0647
commit 2202d60cdc

View File

@ -43,6 +43,7 @@ interface
TLinkerAIX=class(texternallinker)
private
prtobj : string[80];
assumebinutils,use_gld : boolean;
Function WriteResponseFile(isdll:boolean) : Boolean;
public
constructor Create;override;
@ -51,7 +52,6 @@ interface
function MakeSharedLibrary:boolean;override;
end;
implementation
uses
@ -117,8 +117,8 @@ begin
sure that the binary does not contain any relocations in the text
section (otherwise you get an error at load time instead of at link time
in case something is wrong) }
ExeCmd[1]:='ld -bpT:0x10000000 -bpD:0x20000000 -btextro $OPT $STRIP -L. -o $EXE $CATRES' {$ifdef powerpc64}+' -b64'{$endif};
DllCmd[1]:='ld -bpT:0x10000000 -bpD:0x20000000 -btextro $OPT $INITFINI $STRIP -G -L. -o $EXE $CATRES' {$ifdef powerpc64}+' -b64'{$endif};
ExeCmd[1]:='$LDBIN -bpT:0x10000000 -bpD:0x20000000 -btextro $OPT $STRIP -L. -o $EXE $CATRES' {$ifdef powerpc64}+' -b64'{$endif};
DllCmd[1]:='$LDBIN -bpT:0x10000000 -bpD:0x20000000 -btextro $OPT $INITFINI $STRIP -G -L. -o $EXE $CATRES' {$ifdef powerpc64}+' -b64'{$endif};
if cs_debuginfo in current_settings.moduleswitches then
begin
{ debugging helpers }
@ -139,6 +139,11 @@ begin
{$else}
{$error unsupported AIX architecture}
{$endif}
assumebinutils:=
not(cs_link_native in current_settings.globalswitches) or
(not(cs_link_on_target in current_settings.globalswitches) and
not(source_info.system in systems_aix)) ;
use_gld:=assumebinutils and (source_info.system in systems_aix)
end;
@ -148,12 +153,8 @@ Var
i : longint;
HPath : TCmdStrListItem;
s,s1 : TCmdStr;
assumebinutils : boolean;
begin
result:=False;
assumebinutils:=
not(cs_link_on_target in current_settings.globalswitches) and
not(source_info.system in systems_aix) ;
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,assumebinutils);
with linkres do
@ -261,6 +262,10 @@ begin
{ Call linker }
SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
if assumebinutils and (source_info.system in systems_aix) then
Replace(binstr,'$LDBIN','gld')
else
Replace(binstr,'$LDBIN','ld');
binstr:=FindUtil(utilsprefix+BinStr);
Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename));
Replace(cmdstr,'$OPT',Info.ExtraOptions);
@ -351,6 +356,10 @@ begin
{ Call linker }
SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
if assumebinutils and (source_info.system in systems_aix) then
Replace(binstr,'$LDBIN','gld')
else
Replace(binstr,'$LDBIN','ld');
binstr:=FindUtil(utilsprefix+BinStr);
{ on AIX, shared libraries are special object files that are stored inside
an archive. In that archive, the 32 bit version of the library is called