浏览代码

* check in the internal assembler for references with incorrect use of RIP
+ test

git-svn-id: trunk@43461 -

florian 5 年之前
父节点
当前提交
e1433adc2e
共有 6 个文件被更改,包括 318 次插入307 次删除
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/msg/errore.msg
  3. 3 2
      compiler/msgidx.inc
  4. 303 302
      compiler/msgtxt.inc
  5. 3 3
      compiler/x86/aasmcpu.pas
  6. 7 0
      tests/tbf/tb0271.pp

+ 1 - 0
.gitattributes

@@ -12296,6 +12296,7 @@ tests/tbf/tb0267.pp svneol=native#text/plain
 tests/tbf/tb0268.pp svneol=native#text/pascal
 tests/tbf/tb0269.pp svneol=native#text/pascal
 tests/tbf/tb0270.pp svneol=native#text/pascal
+tests/tbf/tb0271.pp svneol=native#text/pascal
 tests/tbf/tb0588.pp svneol=native#text/pascal
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain

+ 1 - 0
compiler/msg/errore.msg

@@ -2934,6 +2934,7 @@ asmw_f_code_segment_too_large=08030_F_Code segment too large
 asmw_f_data_segment_too_large=08031_F_Data segment too large
 asmw_e_instruction_not_supported_by_cpu=08032_E_Instruction not supported by the selected instruction set
 asmw_e_brxx_out_of_range=08033_E_Asm: conditional branch destination is out of range
+asmw_e_illegal_use_of_rip=08034_E_Asm: RIP cannot be used as index register or with another register in a reference
 #
 # Executing linker/assembler
 #

+ 3 - 2
compiler/msgidx.inc

@@ -874,6 +874,7 @@ const
   asmw_f_data_segment_too_large=08031;
   asmw_e_instruction_not_supported_by_cpu=08032;
   asmw_e_brxx_out_of_range=08033;
+  asmw_e_illegal_use_of_rip=08034;
   exec_w_source_os_redefined=09000;
   exec_i_assembling_pipe=09001;
   exec_d_cant_create_asmfile=09002;
@@ -1114,9 +1115,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 83732;
+  MsgTxtSize = 83822;
 
   MsgIdxMax : array[1..20] of longint=(
-    28,106,353,126,99,61,143,34,221,68,
+    28,106,353,126,99,61,143,35,221,68,
     62,20,30,1,1,1,1,1,1,1
   );

文件差异内容过多而无法显示
+ 303 - 302
compiler/msgtxt.inc


+ 3 - 3
compiler/x86/aasmcpu.pas

@@ -2572,6 +2572,9 @@ implementation
         else
         { it's an indirection }
          begin
+           if ((br=NR_RIP) and (ir<>NR_NO)) or
+             (ir=NR_RIP) then
+             message(asmw_e_illegal_use_of_rip);
            { 16 bit? }
 
            if ((ir<>NR_NO) and (isub in [R_SUBMMX,R_SUBMMY,R_SUBMMZ]) and
@@ -3722,11 +3725,8 @@ implementation
 
       begin
         { safety check }
-
         if objdata.currobjsec.size<>longword(insoffset) then
-        begin
           internalerror(200130121);
-        end;
 
         { those variables are initialized inside local procedures, the dfa cannot handle this yet }
         currsym:=nil;

+ 7 - 0
tests/tbf/tb0271.pp

@@ -0,0 +1,7 @@
+{ %fail }
+{ %cpu=x86_64 }
+begin
+  asm
+    leaq (%rip,%rax),%rax
+  end;
+end.

部分文件因为文件数量过多而无法显示