فهرست منبع

fpc_cpuinit: add destroyed register lists to assembler blocks

Otherwise the compiler assumes no registers are overwritten. And while the
regular code generator won't use register variables if assembler blocks are
present, LLVM is not restricted like that (and it could still cause issues
even with the default code generator in case PIC-rebased addresses are
accessed).
Jonas Maebe 9 ماه پیش
والد
کامیت
91667644f4
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      rtl/x86_64/x86_64.inc

+ 3 - 3
rtl/x86_64/x86_64.inc

@@ -1636,7 +1636,7 @@ procedure fpc_cpuinit;
       xorl %ecx,%ecx
       xorl %ecx,%ecx
       cpuid
       cpuid
       movl %ecx,cpuid1_ecx
       movl %ecx,cpuid1_ecx
-    end;
+    end ['eax', 'ebx', 'ecx', 'edx'];
     has_sse41_support:=boolean(cpuid1_ecx shr 19 and 1);
     has_sse41_support:=boolean(cpuid1_ecx shr 19 and 1);
     if _eax>=7 then
     if _eax>=7 then
       begin
       begin
@@ -1645,7 +1645,7 @@ procedure fpc_cpuinit;
           xorl %ecx,%ecx
           xorl %ecx,%ecx
           cpuid
           cpuid
           movl %ebx,cpuid7_ebx
           movl %ebx,cpuid7_ebx
-        end;
+        end ['eax', 'ebx', 'ecx', 'edx'];
 {$ifdef use_fast_repmovstos}
 {$ifdef use_fast_repmovstos}
         fast_large_repmovstosb:=cpuid7_ebx and (1 shl 9)<>0;
         fast_large_repmovstosb:=cpuid7_ebx and (1 shl 9)<>0;
 {$endif}
 {$endif}
@@ -1656,7 +1656,7 @@ procedure fpc_cpuinit;
               xorl %ecx,%ecx
               xorl %ecx,%ecx
               .byte   0x0f,0x01,0xd0 { xgetbv }
               .byte   0x0f,0x01,0xd0 { xgetbv }
               movl %eax,_eax
               movl %eax,_eax
-            end;
+            end ['eax', 'rcx', 'edx'];
             if (_eax and 6)=6 then
             if (_eax and 6)=6 then
               begin
               begin
                 has_avx_support:=(cpuid1_ecx and $10000000)<>0;
                 has_avx_support:=(cpuid1_ecx and $10000000)<>0;