Procházet zdrojové kódy

Allow use of native ld or GNU gld for AIX

git-svn-id: trunk@29047 -
pierre před 10 roky
rodič
revize
2202d60cdc
1 změnil soubory, kde provedl 16 přidání a 7 odebrání
  1. 16 7
      compiler/systems/t_aix.pas

+ 16 - 7
compiler/systems/t_aix.pas

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