浏览代码

* some fixes for the x86 assembler writer, when running on a big-endian hosted platform

Nikolay Nikolov 1 年之前
父节点
当前提交
b5fa73b82c
共有 1 个文件被更改,包括 10 次插入10 次删除
  1. 10 10
      compiler/x86/aasmcpu.pas

+ 10 - 10
compiler/x86/aasmcpu.pas

@@ -4271,7 +4271,7 @@ implementation
                 then
                 then
                  objdata_writereloc(currval,2,currsym,currabsreloc)
                  objdata_writereloc(currval,2,currsym,currabsreloc)
                 else
                 else
-                 objdata.writebytes(currval,2);
+                 objdata.writeInt16LE(int16(currval));
               end;
               end;
             &34,&35,&36 :     // 034..036
             &34,&35,&36 :     // 034..036
               { !!! These are intended (and used in opcode table) to select depending
               { !!! These are intended (and used in opcode table) to select depending
@@ -4282,21 +4282,21 @@ implementation
                 if assigned(currsym) then
                 if assigned(currsym) then
                   objdata_writereloc(currval,2,currsym,currabsreloc)
                   objdata_writereloc(currval,2,currsym,currabsreloc)
                 else
                 else
-                  objdata.writebytes(currval,2);
+                  objdata.writeInt16LE(int16(currval));
 {$else i8086}
 {$else i8086}
                 if opsize=S_Q then
                 if opsize=S_Q then
                   begin
                   begin
                     if assigned(currsym) then
                     if assigned(currsym) then
                      objdata_writereloc(currval,8,currsym,currabsreloc)
                      objdata_writereloc(currval,8,currsym,currabsreloc)
                     else
                     else
-                     objdata.writebytes(currval,8);
+                     objdata.writeInt64LE(int64(currval));
                   end
                   end
                 else
                 else
                   begin
                   begin
                     if assigned(currsym) then
                     if assigned(currsym) then
                       objdata_writereloc(currval,4,currsym,currabsreloc32)
                       objdata_writereloc(currval,4,currsym,currabsreloc32)
                     else
                     else
-                      objdata.writebytes(currval,4);
+                      objdata.writeInt32LE(int32(currval));
                   end
                   end
 {$endif i8086}
 {$endif i8086}
               end;
               end;
@@ -4310,7 +4310,7 @@ implementation
                 then
                 then
                  objdata_writereloc(currval,4,currsym,currabsreloc32)
                  objdata_writereloc(currval,4,currsym,currabsreloc32)
                 else
                 else
-                 objdata.writebytes(currval,4);
+                 objdata.writeInt32LE(int32(currval));
               end;
               end;
             &44,&45,&46 :// 044..046 - select between word/dword/qword depending on
             &44,&45,&46 :// 044..046 - select between word/dword/qword depending on
               begin      // address size (we support only default address sizes).
               begin      // address size (we support only default address sizes).
@@ -4319,17 +4319,17 @@ implementation
                 if assigned(currsym) then
                 if assigned(currsym) then
                   objdata_writereloc(currval,8,currsym,currabsreloc)
                   objdata_writereloc(currval,8,currsym,currabsreloc)
                 else
                 else
-                  objdata.writebytes(currval,8);
+                  objdata.writeInt64LE(int64(currval));
 {$elseif defined(i386)}
 {$elseif defined(i386)}
                 if assigned(currsym) then
                 if assigned(currsym) then
                   objdata_writereloc(currval,4,currsym,currabsreloc32)
                   objdata_writereloc(currval,4,currsym,currabsreloc32)
                 else
                 else
-                  objdata.writebytes(currval,4);
+                  objdata.writeInt32LE(int32(currval));
 {$elseif defined(i8086)}
 {$elseif defined(i8086)}
                 if assigned(currsym) then
                 if assigned(currsym) then
                   objdata_writereloc(currval,2,currsym,currabsreloc)
                   objdata_writereloc(currval,2,currsym,currabsreloc)
                 else
                 else
-                  objdata.writebytes(currval,2);
+                  objdata.writeInt16LE(int16(currval));
 {$endif}
 {$endif}
               end;
               end;
             &50,&51,&52 :   // 050..052 - byte relative operand
             &50,&51,&52 :   // 050..052 - byte relative operand
@@ -4351,7 +4351,7 @@ implementation
                 if assigned(currsym) then
                 if assigned(currsym) then
                   objdata_writereloc(currval,8,currsym,currabsreloc)
                   objdata_writereloc(currval,8,currsym,currabsreloc)
                 else
                 else
-                  objdata.writebytes(currval,8);
+                  objdata.writeInt64LE(int64(currval));
               end;
               end;
             &60,&61,&62 :
             &60,&61,&62 :
               begin
               begin
@@ -4403,7 +4403,7 @@ implementation
                 if assigned(currsym) then
                 if assigned(currsym) then
                   objdata_writereloc(currval,4,currsym,currabsreloc32)
                   objdata_writereloc(currval,4,currsym,currabsreloc32)
                 else
                 else
-                  objdata.writebytes(currval,4);
+                  objdata.writeInt32LE(int32(currval));
               end;
               end;
             &300,&301,&302:
             &300,&301,&302:
               begin
               begin