浏览代码

Use writeint8/writeuint8 methods to avoid cross-endian issues

Pierre Muller 1 年之前
父节点
当前提交
5c564ea940
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      compiler/x86/aasmcpu.pas

+ 4 - 4
compiler/x86/aasmcpu.pas

@@ -4217,7 +4217,7 @@ implementation
                 if assigned(currsym) then
                 if assigned(currsym) then
                   objdata_writereloc(currval,1,currsym,currabsreloc)
                   objdata_writereloc(currval,1,currsym,currabsreloc)
                 else
                 else
-                  objdata.writebytes(currval,1);
+                  objdata.writeint8(shortint(currval));
               end;
               end;
             &20,&21,&22 :
             &20,&21,&22 :
               begin
               begin
@@ -4227,7 +4227,7 @@ implementation
                 if assigned(currsym) then
                 if assigned(currsym) then
                  objdata_writereloc(currval,1,currsym,currabsreloc)
                  objdata_writereloc(currval,1,currsym,currabsreloc)
                 else
                 else
-                 objdata.writebytes(currval,1);
+                 objdata.writeuint8(byte(currval));
               end;
               end;
             &23 :
             &23 :
               begin
               begin
@@ -4254,7 +4254,7 @@ implementation
                 if assigned(currsym) then
                 if assigned(currsym) then
                  objdata_writereloc(currval,1,currsym,currabsreloc)
                  objdata_writereloc(currval,1,currsym,currabsreloc)
                 else
                 else
-                 objdata.writebytes(currval,1);
+                 objdata.writeuint8(byte(currval));
               end;
               end;
             &30,&31,&32 :     // 030..032
             &30,&31,&32 :     // 030..032
               begin
               begin
@@ -4343,7 +4343,7 @@ implementation
 {$pop}
 {$pop}
                 if (data>127) or (data<-128) then
                 if (data>127) or (data<-128) then
                  Message1(asmw_e_short_jmp_out_of_range,tostr(data));
                  Message1(asmw_e_short_jmp_out_of_range,tostr(data));
-                objdata.writebytes(data,1);
+                objdata.writeint8(shortint(data));
               end;
               end;
             &54,&55,&56:   // 054..056 - qword immediate operand
             &54,&55,&56:   // 054..056 - qword immediate operand
               begin
               begin