Răsfoiți Sursa

* added several missing make_simple_ref() calls
* removed addr_pic again for darwin, as you have to explicitly code
the relative address using a relsym instead of using an assembler
directive like @GOT there

git-svn-id: trunk@9353 -

Jonas Maebe 17 ani în urmă
părinte
comite
6c536dab3e

+ 6 - 5
compiler/i386/cgcpu.pas

@@ -743,8 +743,9 @@ unit cgcpu;
         tempref : treference;
       begin
         get_64bit_ops(op,op1,op2);
-        list.concat(taicpu.op_ref_reg(op1,S_L,ref,reg.reglo));
         tempref:=ref;
+        tcgx86(cg).make_simple_ref(list,tempref);
+        list.concat(taicpu.op_ref_reg(op1,S_L,tempref,reg.reglo));
         inc(tempref.offset,4);
         list.concat(taicpu.op_ref_reg(op2,S_L,tempref,reg.reghi));
       end;
@@ -807,11 +808,12 @@ unit cgcpu;
         op1,op2 : TAsmOp;
         tempref : treference;
       begin
+        tempref:=ref;
+        tcgx86(cg).make_simple_ref(list,tempref);
         case op of
           OP_AND,OP_OR,OP_XOR:
             begin
-              cg.a_op_const_ref(list,op,OS_32,aint(lo(value)),ref);
-              tempref:=ref;
+              cg.a_op_const_ref(list,op,OS_32,aint(lo(value)),tempref);
               inc(tempref.offset,4);
               cg.a_op_const_ref(list,op,OS_32,aint(hi(value)),tempref);
             end;
@@ -819,8 +821,7 @@ unit cgcpu;
             begin
               get_64bit_ops(op,op1,op2);
               // can't use a_op_const_ref because this may use dec/inc
-              list.concat(taicpu.op_const_ref(op1,S_L,aint(lo(value)),ref));
-              tempref:=ref;
+              list.concat(taicpu.op_const_ref(op1,S_L,aint(lo(value)),tempref));
               inc(tempref.offset,4);
               list.concat(taicpu.op_const_ref(op2,S_L,aint(hi(value)),tempref));
             end;

+ 3 - 1
compiler/i386/n386add.pas

@@ -44,7 +44,7 @@ interface
       aasmbase,aasmtai,aasmdata,aasmcpu,
       cgbase,procinfo,
       ncon,nset,cgutils,tgobj,
-      cga,ncgutil,cgobj,cg64f32;
+      cga,ncgutil,cgobj,cg64f32,cgx86;
 
 {*****************************************************************************
                                 Add64bit
@@ -312,6 +312,7 @@ interface
              LOC_CREFERENCE,
              LOC_REFERENCE :
                begin
+                 tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,right.location.reference);
                  href:=right.location.reference;
                  inc(href.offset,4);
                  emit_ref_reg(A_CMP,S_L,href,left.location.register64.reghi);
@@ -361,6 +362,7 @@ interface
         reg:=left.location.register
       else if left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
         begin
+          tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,left.location.reference);
           ref:=left.location.reference;
           use_ref:=true;
         end

+ 0 - 1
compiler/x86/cgx86.pas

@@ -426,7 +426,6 @@ unit cgx86;
                    include(current_procinfo.flags,pi_needs_got);
                    hreg:=current_procinfo.got;
                    ref.relsymbol:=current_procinfo.CurrGOTLabel;
-                   ref.refaddr:=addr_pic;
                  end;
                add_hreg:=true
              end

+ 3 - 0
compiler/x86/nx86add.pas

@@ -589,6 +589,7 @@ unit nx86add;
                   internalerror(200203245);
 
                  hregister:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList);
+                 tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,left.location.reference);
                  emit_ref_reg(A_MOVQ,S_NO,left.location.reference,hregister);
                end;
 
@@ -612,6 +613,7 @@ unit nx86add;
                begin
                  if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
                   internalerror(200203247);
+                 tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,right.location.reference);
                  emit_ref_reg(A_MOVQ,S_NO,right.location.reference,hreg);
                  emit_reg_reg(op,S_NO,left.location.register,hreg);
                end;
@@ -625,6 +627,7 @@ unit nx86add;
                begin
                  if not(right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
                   internalerror(200203246);
+                 tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,right.location.reference);
                  emit_ref_reg(op,S_NO,right.location.reference,left.location.register);
                end;
               location.register:=left.location.register;