Kaynağa Gözat

* Fixed internal assembler writer to handle offset calculations with forward symbols involved. Internal assembler can handle dwarf debug info now.

git-svn-id: trunk@13096 -
yury 16 yıl önce
ebeveyn
işleme
b1427bad2e
1 değiştirilmiş dosya ile 12 ekleme ve 5 silme
  1. 12 5
      compiler/assemble.pas

+ 12 - 5
compiler/assemble.pas

@@ -971,12 +971,17 @@ Implementation
                  if assigned(tai_const(hp).sym) then
                    begin
                      objsym:=Objdata.SymbolRef(tai_const(hp).sym);
-                     if assigned(tai_const(hp).endsym) then
+                     { objsym already defined and there is endsym? }
+                     if assigned(objsym.objsection) and assigned(tai_const(hp).endsym) then
                        begin
                          objsymend:=Objdata.SymbolRef(tai_const(hp).endsym);
-                         if objsymend.objsection<>objsym.objsection then
-                           internalerror(200404124);
-                         Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs;
+                         { objsymend already defined? }
+                         if assigned(objsymend.objsection) then
+                           begin
+                             if objsymend.objsection<>objsym.objsection then
+                               internalerror(200404124);
+                             Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs;
+                           end;
                        end;
                    end;
                  ObjData.alloc(tai_const(hp).size);
@@ -1058,12 +1063,14 @@ Implementation
                ObjData.alloc(8);
              ait_const:
                begin
-                 { Recalculate relative symbols, all checks are done in treepass0 }
+                 { Recalculate relative symbols }
                  if assigned(tai_const(hp).sym) and
                     assigned(tai_const(hp).endsym) then
                    begin
                      objsym:=Objdata.SymbolRef(tai_const(hp).sym);
                      objsymend:=Objdata.SymbolRef(tai_const(hp).endsym);
+                     if objsymend.objsection<>objsym.objsection then
+                       internalerror(200905042);
                      Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs;
                    end;
                  ObjData.alloc(tai_const(hp).size);