Prechádzať zdrojové kódy

* on AIX, functions are called via function descriptors whose name
is '.' followed by the function symbol name (like on linux/ppc64)

git-svn-id: trunk@20796 -

Jonas Maebe 13 rokov pred
rodič
commit
b738657bf3

+ 15 - 5
compiler/powerpc/cgcpu.pas

@@ -181,14 +181,24 @@ const
          { MacOS: The linker on MacOS (PPCLink) inserts a call to glue code,
          { MacOS: The linker on MacOS (PPCLink) inserts a call to glue code,
            if it is a cross-TOC call. If so, it also replaces the NOP
            if it is a cross-TOC call. If so, it also replaces the NOP
            with some restore code.}
            with some restore code.}
-         if (target_info.system <> system_powerpc_darwin) then
+         if (target_info.system<>system_powerpc_darwin) then
            begin
            begin
-             if not(weak) then
-               list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s)))
+             if target_info.system<>system_powerpc_aix then
+               begin
+                 if not(weak) then
+                   list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s)))
+                 else
+                   list.concat(taicpu.op_sym(A_BL,current_asmdata.WeakRefAsmSymbol(s)));
+               end
              else
              else
-               list.concat(taicpu.op_sym(A_BL,current_asmdata.WeakRefAsmSymbol(s)));
+               begin
+                 if not(weak) then
+                   list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol('.'+s)))
+                 else
+                   list.concat(taicpu.op_sym(A_BL,current_asmdata.WeakRefAsmSymbol('.'+s)));
+               end;
 
 
-             if target_info.system=system_powerpc_macos then
+             if target_info.system in [system_powerpc_macos,system_powerpc_aix] then
                list.concat(taicpu.op_none(A_NOP));
                list.concat(taicpu.op_none(A_NOP));
            end
            end
          else
          else

+ 5 - 0
compiler/powerpc/rappcgas.pas

@@ -752,6 +752,11 @@ Unit rappcgas;
                (instr.Operands[1].opr.ref.index<>NR_NO) then
                (instr.Operands[1].opr.ref.index<>NR_NO) then
               Message(asmr_e_syn_operand);
               Message(asmr_e_syn_operand);
           end;
           end;
+        { regular name is toc entry, .-based name is actual code }
+        if (target_info.system in (systems_aix+[system_powerpc64_linux])) and
+           (instr.Operands[1].opr.typ = OPR_SYMBOL) and
+           (instr.Operands[1].opr.symbol.typ=AT_FUNCTION) then
+          instr.Operands[1].opr.symbol:=current_asmdata.DefineAsmSymbol('.'+instr.Operands[1].opr.symbol.name,instr.Operands[1].opr.symbol.bind,AT_FUNCTION);
       end;
       end;
 
 
 
 

+ 3 - 1
compiler/ppcgen/cgppc.pas

@@ -779,7 +779,9 @@ unit cgppc;
             system_powerpc_darwin,
             system_powerpc_darwin,
             system_powerpc64_darwin:
             system_powerpc64_darwin:
               list.concat(taicpu.op_sym(A_B,get_darwin_call_stub(procdef.mangledname,false)));
               list.concat(taicpu.op_sym(A_B,get_darwin_call_stub(procdef.mangledname,false)));
-            system_powerpc64_linux:
+            system_powerpc64_linux,
+            system_powerpc_aix,
+            system_powerpc64_aix:
               {$note ts:todo add GOT change?? - think not needed :) }
               {$note ts:todo add GOT change?? - think not needed :) }
               list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname)));
               list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname)));
             else
             else