Browse Source

* fix for older GAS assemblers that don't parse (rex64Z) "lock cmpxchg8b (%r8)" properly, as used on FreeBSD7 and up till 8.2.

git-svn-id: trunk@17060 -
marco 14 years ago
parent
commit
f0fee289c9
1 changed files with 11 additions and 1 deletions
  1. 11 1
      rtl/x86_64/cpu.pp

+ 11 - 1
rtl/x86_64/cpu.pp

@@ -18,6 +18,13 @@ unit cpu;
 
   interface
 
+  {$ifdef freebsd}                 // FreeBSD 7/8 have binutils version that don't support cmpxchg16b
+			           // Unless overridebinutils is defined (for ports usage), use db instead of the instruction
+     {$ifndef overridebinutils}
+       {$define oldbinutils}
+     {$endif} 
+  {$endif}
+
     uses
       sysutils;
 
@@ -60,8 +67,11 @@ unit cpu;
         movq (%r9),%rax
         movq 8(%r9),%rdx
 
+        {$ifdef oldbinutils}
+           .byte 0xF0,0x49,0x0F,0xC7,0x08 
+        {$else}
         lock cmpxchg16b (%r8)
-
+        {$endif}
         { restore result pointer }
         popq %rcx