Browse Source

* fix for the stab section size changes with smartlinking

pierre 25 years ago
parent
commit
dd89e25cb2
2 changed files with 35 additions and 23 deletions
  1. 28 20
      compiler/ag386bin.pas
  2. 7 3
      compiler/og386cff.pas

+ 28 - 20
compiler/ag386bin.pas

@@ -729,6 +729,11 @@ unit ag386bin;
       var
       var
         hp : pai;
         hp : pai;
       begin
       begin
+        objectalloc^.resetsections;
+        objectalloc^.setsection(sec_code);
+
+        objectoutput^.initwriting(cut_normal);
+        objectoutput^.defaultsection(sec_code);
       { reset the asmsymbol list }
       { reset the asmsymbol list }
         ResetAsmsymbolList;
         ResetAsmsymbolList;
         objectoutput^.defaultsection(sec_code);
         objectoutput^.defaultsection(sec_code);
@@ -795,6 +800,13 @@ unit ag386bin;
 {$ifdef GDB}
 {$ifdef GDB}
         EndFileLineInfo;
         EndFileLineInfo;
 {$endif GDB}
 {$endif GDB}
+
+        { leave if errors have occured }
+        if errorcount>0 then
+         exit;
+
+        { write last objectfile }
+        objectoutput^.donewriting;
       end;
       end;
 
 
 
 
@@ -803,6 +815,11 @@ unit ag386bin;
         hp : pai;
         hp : pai;
         startsec : tsection;
         startsec : tsection;
       begin
       begin
+        objectalloc^.resetsections;
+        objectalloc^.setsection(sec_code);
+
+        objectoutput^.initwriting(cut_normal);
+        objectoutput^.defaultsection(sec_code);
         startsec:=sec_code;
         startsec:=sec_code;
         { start with list 1 }
         { start with list 1 }
         currlistidx:=1;
         currlistidx:=1;
@@ -850,16 +867,19 @@ unit ag386bin;
            StartFileLineInfo;
            StartFileLineInfo;
 {$endif GDB}
 {$endif GDB}
            hp:=TreePass2(hp);
            hp:=TreePass2(hp);
+{$ifdef GDB}
+           EndFileLineInfo;
+{$endif GDB}
            { leave if errors have occured }
            { leave if errors have occured }
            if errorcount>0 then
            if errorcount>0 then
             exit;
             exit;
 
 
-           { end of lists? }
-           if not MaybeNextList(hp) then
-            break;
            { if not end then write the current objectfile }
            { if not end then write the current objectfile }
            objectoutput^.donewriting;
            objectoutput^.donewriting;
 
 
+           { end of lists? }
+           if not MaybeNextList(hp) then
+            break;
            { save section for next loop }
            { save section for next loop }
            { this leads to a problem if startsec is sec_none !! PM }
            { this leads to a problem if startsec is sec_none !! PM }
            startsec:=objectalloc^.currsec;
            startsec:=objectalloc^.currsec;
@@ -886,10 +906,7 @@ unit ag386bin;
              startsec:=sec_code;
              startsec:=sec_code;
 
 
            if not MaybeNextList(hp) then
            if not MaybeNextList(hp) then
-            break;
-{$ifdef GDB}
-        EndFileLineInfo;
-{$endif GDB}
+             break;
          end;
          end;
       end;
       end;
 
 
@@ -903,11 +920,6 @@ unit ag386bin;
         end;
         end;
 
 
       begin
       begin
-        objectalloc^.resetsections;
-        objectalloc^.setsection(sec_code);
-
-        objectoutput^.initwriting(cut_normal);
-        objectoutput^.defaultsection(sec_code);
 
 
         if cs_debuginfo in aktmoduleswitches then
         if cs_debuginfo in aktmoduleswitches then
           addlist(debuglist);
           addlist(debuglist);
@@ -929,13 +941,6 @@ unit ag386bin;
           writetreesmart
           writetreesmart
         else
         else
           writetree;
           writetree;
-
-        { leave if errors have occured }
-        if errorcount>0 then
-         exit;
-
-        { write last objectfile }
-        objectoutput^.donewriting;
       end;
       end;
 
 
 
 
@@ -966,7 +971,10 @@ unit ag386bin;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.39  2000-03-09 10:07:18  pierre
+  Revision 1.40  2000-03-09 14:29:47  pierre
+   * fix for the stab section size changes with smartlinking
+
+  Revision 1.39  2000/03/09 10:07:18  pierre
    * fix a problem with smartlink and stabs
    * fix a problem with smartlink and stabs
 
 
   Revision 1.38  2000/02/18 21:54:07  pierre
   Revision 1.38  2000/02/18 21:54:07  pierre

+ 7 - 3
compiler/og386cff.pas

@@ -815,7 +815,8 @@ unit og386cff;
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
           { check if the section is still the same size }
           { check if the section is still the same size }
             if (sects[sec]^.len<>sects[sec]^.size) then
             if (sects[sec]^.len<>sects[sec]^.size) then
-              Comment(V_Warning,'Size of section changed '+tostr(sects[sec]^.size)+'->'+tostr(sects[sec]^.len)+
+              Comment(V_Warning,'Size of section changed '+
+                tostr(sects[sec]^.size)+'->'+tostr(sects[sec]^.len)+
                 ' ['+target_asm.secnames[sec]+']');
                 ' ['+target_asm.secnames[sec]+']');
 {$endif EXTDEBUG}
 {$endif EXTDEBUG}
           { fill with zero }
           { fill with zero }
@@ -984,7 +985,10 @@ unit og386cff;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2000-02-09 13:22:54  peter
+  Revision 1.20  2000-03-09 14:29:47  pierre
+   * fix for the stab section size changes with smartlinking
+
+  Revision 1.19  2000/02/09 13:22:54  peter
     * log truncated
     * log truncated
 
 
   Revision 1.18  2000/01/12 10:38:18  peter
   Revision 1.18  2000/01/12 10:38:18  peter
@@ -1023,4 +1027,4 @@ end.
   Revision 1.10  1999/08/04 00:23:05  florian
   Revision 1.10  1999/08/04 00:23:05  florian
     * renamed i386asm and i386base to cpuasm and cpubase
     * renamed i386asm and i386base to cpuasm and cpubase
 
 
-}
+}