Browse Source

Fix go32v2 rtl compilation error and add warning for %es:Const

git-svn-id: trunk@19057 -
pierre 14 years ago
parent
commit
5a671336c7
2 changed files with 9 additions and 3 deletions
  1. 3 0
      compiler/msg/errore.msg
  2. 6 3
      compiler/x86/rax86att.pas

+ 3 - 0
compiler/msg/errore.msg

@@ -2428,6 +2428,9 @@ asmr_e_empty_regset=07109_E_A register set cannot be empty
 asmr_w_useless_got_for_local=07110_W_@GOTPCREL is useless and potentially dangereous for local symbols
 asmr_w_useless_got_for_local=07110_W_@GOTPCREL is useless and potentially dangereous for local symbols
 % The use of @GOTPCREL supposes an extra indirection that is
 % The use of @GOTPCREL supposes an extra indirection that is
 % not present if the symbol is local, which might lead to wrong asembler code
 % not present if the symbol is local, which might lead to wrong asembler code
+asmr_w_general_segment_with_constant=07111_W_Constant with general purpose segment register
+% General purpose register should not have constant offsets
+% as OS memory allocation might not be compatible with that.
 #
 #
 # Assembler/binary writers
 # Assembler/binary writers
 #
 #

+ 6 - 3
compiler/x86/rax86att.pas

@@ -454,14 +454,17 @@ Implementation
                   { allow %segmentregister:number }
                   { allow %segmentregister:number }
                   if oper.opr.ref.segment<>NR_NO then
                   if oper.opr.ref.segment<>NR_NO then
                     begin
                     begin
-                      oper.InitRef;
+                      // already done before calling oper.InitRef;
                       if oper.opr.Ref.Offset <> 0 Then
                       if oper.opr.Ref.Offset <> 0 Then
                         Message(asmr_e_invalid_reference_syntax)
                         Message(asmr_e_invalid_reference_syntax)
                       else
                       else
                         begin
                         begin
-                          oper.opr.Ref.Offset:=BuildConstExpression(false,true);
+                          oper.opr.Ref.Offset:=BuildConstExpression(true,false);
                           if actasmtoken=AS_LPAREN then
                           if actasmtoken=AS_LPAREN then
-                            BuildReference(oper);
+                            BuildReference(oper)
+                          else if (oper.opr.ref.segment <> NR_FS) and
+                            (oper.opr.ref.segment <> NR_GS) then
+                           Message(asmr_w_general_segment_with_constant);
                         end;
                         end;
                     end
                     end
                   else
                   else