Selaa lähdekoodia

* TExeOutput.Order_Symbol and Order_ProvideSymbol: Instead of searching objsection by name, search for the symbol and use its objsection.
* TExeOutput.WriteExeSectionContent: To write proper gap between exe sections, don't align writer position. The desired position is present in exesection.DataPos, so pad right up to it.

git-svn-id: trunk@22881 -

sergei 12 vuotta sitten
vanhempi
commit
8a56c9f7dc
1 muutettua tiedostoa jossa 12 lisäystä ja 10 poistoa
  1. 12 10
      compiler/ogbase.pas

+ 12 - 10
compiler/ogbase.pas

@@ -1940,29 +1940,29 @@ implementation
 
     procedure TExeOutput.Order_Symbol(const aname:string);
       var
-        ObjSection : TObjSection;
+        objsym: TObjSymbol;
       begin
-        ObjSection:=internalObjData.findsection('*'+aname);
-        if not assigned(ObjSection) then
+        objsym:=TObjSymbol(internalObjData.ObjSymbolList.Find(aname));
+        if (objsym=nil) or (objsym.ObjSection.ObjData<>internalObjData) then
           internalerror(200603041);
-        CurrExeSec.AddObjSection(ObjSection,True);
+        CurrExeSec.AddObjSection(objsym.ObjSection,True);
       end;
 
     procedure TExeOutput.Order_ProvideSymbol(const aname:string);
       var
-        ObjSection : TObjSection;
+        objsym : TObjSymbol;
         exesym : TExeSymbol;
       begin
-        ObjSection:=internalObjData.findsection('*'+aname);
-        if not assigned(ObjSection) then
+        objsym:=TObjSymbol(internalObjData.ObjSymbolList.Find(aname));
+        if (objsym=nil) or (objsym.ObjSection.ObjData<>internalObjData) then
           internalerror(200603041);
         exesym:=TExeSymbol(ExeSymbolList.Find(aname));
         if not assigned(exesym) then
           internalerror(201206301);
         { Only include this section if it actually resolves
           the symbol }
-        if exesym.objsymbol.objsection=objsection then
-          CurrExeSec.AddObjSection(ObjSection,True);
+        if exesym.objsymbol=objsym then
+          CurrExeSec.AddObjSection(objsym.ObjSection,True);
       end;
 
 
@@ -3244,7 +3244,9 @@ implementation
 
             if oso_data in exesec.SecOptions then
               begin
-                FWriter.Writezeros(Align(FWriter.Size,DataAlign(exesec))-FWriter.Size);
+                if exesec.DataPos<FWriter.Size then
+                  InternalError(2012103001);
+                FWriter.Writezeros(exesec.DataPos-FWriter.Size);
                 for i:=0 to exesec.ObjSectionList.Count-1 do
                   begin
                     objsec:=TObjSection(exesec.ObjSectionList[i]);