Explorar o código

* x86-64: sign/zero extend arguments only if it is an external call as
FPC generated code follows the ABI

florian %!s(int64=3) %!d(string=hai) anos
pai
achega
bab7dcece1
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      compiler/x86_64/cpupara.pas

+ 5 - 2
compiler/x86_64/cpupara.pas

@@ -57,7 +57,7 @@ unit cpupara;
        systems,
        globals,defutil,
        symtable,symutil,
-       cpupi,
+       procinfo,cpupi,
        cgx86,cgobj,cgcpu;
 
     const
@@ -1809,12 +1809,15 @@ unit cpupara;
                                 be compatible with the system compiler clang
                                 (which extends on the caller side).
 
+                                Exception: if the call is not external, then we can follow the ABI as FPC
+                                generated code follows the ABI
+
                                 Not for LLVM, since there the zero/signext
                                 attributes by definition only apply to the
                                 caller side }
 {$ifndef LLVM}
                               if not(target_info.system in systems_darwin) and
-                                 (side=calleeside) and
+                                 ((side=calleeside) or (([po_weakexternal,po_external]*p.procoptions)=[])) and
                                  (hp.paraloc[side].intsize in [1,2]) then
                                 begin
                                   paraloc^.def:=hp.paraloc[side].def