mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 03:39:40 +01:00 
			
		
		
		
	* change hashobjectlist.Delete() calls to :=nil now that the .Delete() behaviour
is changed git-svn-id: trunk@5365 -
This commit is contained in:
		
							parent
							
								
									25e9a60553
								
							
						
					
					
						commit
						f21f055373
					
				@ -384,7 +384,7 @@ interface
 | 
			
		||||
 | 
			
		||||
      TExeOutput = class
 | 
			
		||||
      private
 | 
			
		||||
        { ExeSections }
 | 
			
		||||
        { ExeSectionList }
 | 
			
		||||
        FCObjData         : TObjDataClass;
 | 
			
		||||
        FCExeSection      : TExeSectionClass;
 | 
			
		||||
        FCurrExeSec       : TExeSection;
 | 
			
		||||
@ -450,7 +450,7 @@ interface
 | 
			
		||||
        procedure GenerateLibraryImports(ImportLibraryList:TFPHashObjectList);virtual;
 | 
			
		||||
        function  writeexefile(const fn:string):boolean;
 | 
			
		||||
        property Writer:TObjectWriter read FWriter;
 | 
			
		||||
        property ExeSections:TFPHashObjectList read FExeSectionList;
 | 
			
		||||
        property ExeSectionList:TFPHashObjectList read FExeSectionList;
 | 
			
		||||
        property ObjDataList:TFPObjectList read FObjDataList;
 | 
			
		||||
        property ExeSymbolList:TFPHashObjectList read FExeSymbolList;
 | 
			
		||||
        property UnresolvedExeSymbols:TFPObjectList read FUnresolvedExeSymbols;
 | 
			
		||||
@ -1407,7 +1407,7 @@ implementation
 | 
			
		||||
 | 
			
		||||
    function  TExeOutput.FindExeSection(const aname:string):TExeSection;
 | 
			
		||||
      begin
 | 
			
		||||
        result:=TExeSection(FExeSectionList.Find(aname));
 | 
			
		||||
        result:=TExeSection(ExeSectionList.Find(aname));
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1485,7 +1485,7 @@ implementation
 | 
			
		||||
      begin
 | 
			
		||||
        sec:=FindExeSection(aname);
 | 
			
		||||
        if not assigned(sec) then
 | 
			
		||||
          sec:=CExeSection.create(FExeSectionList,aname);
 | 
			
		||||
          sec:=CExeSection.create(ExeSectionList,aname);
 | 
			
		||||
        { Clear ExeSection contents }
 | 
			
		||||
        FCurrExeSec:=sec;
 | 
			
		||||
      end;
 | 
			
		||||
@ -1952,9 +1952,9 @@ implementation
 | 
			
		||||
        if not assigned(exemap) then
 | 
			
		||||
          exit;
 | 
			
		||||
        exemap.AddMemoryMapHeader(ImageBase);
 | 
			
		||||
        for i:=0 to ExeSections.Count-1 do
 | 
			
		||||
        for i:=0 to ExeSectionList.Count-1 do
 | 
			
		||||
          begin
 | 
			
		||||
            exesec:=TExeSection(ExeSections[i]);
 | 
			
		||||
            exesec:=TExeSection(ExeSectionList[i]);
 | 
			
		||||
            exemap.AddMemoryMapExeSection(exesec);
 | 
			
		||||
            for j:=0 to exesec.ObjSectionList.count-1 do
 | 
			
		||||
              begin
 | 
			
		||||
@ -2203,9 +2203,9 @@ implementation
 | 
			
		||||
        i      : longint;
 | 
			
		||||
        exesec : TExeSection;
 | 
			
		||||
      begin
 | 
			
		||||
        for i:=0 to ExeSections.Count-1 do
 | 
			
		||||
        for i:=0 to ExeSectionList.Count-1 do
 | 
			
		||||
          begin
 | 
			
		||||
            exesec:=TExeSection(ExeSections[i]);
 | 
			
		||||
            exesec:=TExeSection(ExeSectionList[i]);
 | 
			
		||||
            if not(oso_keep in exesec.SecOptions) and
 | 
			
		||||
                (
 | 
			
		||||
                 (exesec.ObjSectionlist.count=0) or
 | 
			
		||||
@ -2216,10 +2216,10 @@ implementation
 | 
			
		||||
               ) then
 | 
			
		||||
              begin
 | 
			
		||||
                Comment(V_Debug,'Deleting empty section '+exesec.name);
 | 
			
		||||
                FExeSectionList.Delete(i);
 | 
			
		||||
                ExeSectionList[i]:=nil;
 | 
			
		||||
              end;
 | 
			
		||||
          end;
 | 
			
		||||
        ExeSections.Pack;
 | 
			
		||||
        ExeSectionList.Pack;
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -2367,10 +2367,10 @@ implementation
 | 
			
		||||
        ObjSectionWorkList.Free;
 | 
			
		||||
        ObjSectionWorkList:=nil;
 | 
			
		||||
 | 
			
		||||
        { Remove unused objsections from exesections }
 | 
			
		||||
        for i:=0 to ExeSections.Count-1 do
 | 
			
		||||
        { Remove unused objsections from ExeSectionList }
 | 
			
		||||
        for i:=0 to ExeSectionList.Count-1 do
 | 
			
		||||
          begin
 | 
			
		||||
            exesec:=TExeSection(ExeSections[i]);
 | 
			
		||||
            exesec:=TExeSection(ExeSectionList[i]);
 | 
			
		||||
            for j:=0 to exesec.ObjSectionlist.count-1 do
 | 
			
		||||
              begin
 | 
			
		||||
                objsec:=TObjSection(exesec.ObjSectionlist[j]);
 | 
			
		||||
@ -2393,9 +2393,9 @@ implementation
 | 
			
		||||
        exesec  : TExeSection;
 | 
			
		||||
        objsec  : TObjSection;
 | 
			
		||||
      begin
 | 
			
		||||
        for i:=0 to ExeSections.Count-1 do
 | 
			
		||||
        for i:=0 to ExeSectionList.Count-1 do
 | 
			
		||||
          begin
 | 
			
		||||
            exesec:=TExeSection(ExeSections[i]);
 | 
			
		||||
            exesec:=TExeSection(ExeSectionList[i]);
 | 
			
		||||
            if not assigned(exesec) then
 | 
			
		||||
              continue;
 | 
			
		||||
            for j:=0 to exesec.ObjSectionlist.count-1 do
 | 
			
		||||
 | 
			
		||||
@ -224,11 +224,11 @@ interface
 | 
			
		||||
         nsects    : smallint;
 | 
			
		||||
         nsyms,
 | 
			
		||||
         sympos    : aint;
 | 
			
		||||
         procedure ExeSections_pass2_header(p:TObject;arg:pointer);
 | 
			
		||||
         procedure ExeSectionList_pass2_header(p:TObject;arg:pointer);
 | 
			
		||||
         procedure write_symbol(const name:string;value:aint;section:smallint;typ,aux:byte);
 | 
			
		||||
         procedure globalsyms_write_symbol(p:TObject;arg:pointer);
 | 
			
		||||
         procedure ExeSections_write_header(p:TObject;arg:pointer);
 | 
			
		||||
         procedure ExeSections_write_data(p:TObject;arg:pointer);
 | 
			
		||||
         procedure ExeSectionList_write_header(p:TObject;arg:pointer);
 | 
			
		||||
         procedure ExeSectionList_write_data(p:TObject;arg:pointer);
 | 
			
		||||
       protected
 | 
			
		||||
         procedure CalcPos_Header;override;
 | 
			
		||||
         procedure CalcPos_Symbols;override;
 | 
			
		||||
@ -1934,7 +1934,7 @@ const pemagic : array[0..3] of byte = (
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    procedure TCoffexeoutput.ExeSections_write_header(p:TObject;arg:pointer);
 | 
			
		||||
    procedure TCoffexeoutput.ExeSectionList_write_header(p:TObject;arg:pointer);
 | 
			
		||||
      var
 | 
			
		||||
        sechdr    : tcoffsechdr;
 | 
			
		||||
      begin
 | 
			
		||||
@ -1969,7 +1969,7 @@ const pemagic : array[0..3] of byte = (
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    procedure TCoffexeoutput.ExeSections_pass2_header(p:TObject;arg:pointer);
 | 
			
		||||
    procedure TCoffexeoutput.ExeSectionList_pass2_header(p:TObject;arg:pointer);
 | 
			
		||||
      begin
 | 
			
		||||
        with TExeSection(p) do
 | 
			
		||||
          begin
 | 
			
		||||
@ -1979,7 +1979,7 @@ const pemagic : array[0..3] of byte = (
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    procedure Tcoffexeoutput.ExeSections_write_Data(p:TObject;arg:pointer);
 | 
			
		||||
    procedure Tcoffexeoutput.ExeSectionList_write_Data(p:TObject;arg:pointer);
 | 
			
		||||
      var
 | 
			
		||||
        objsec : TObjSection;
 | 
			
		||||
        i      : longint;
 | 
			
		||||
@ -2024,7 +2024,7 @@ const pemagic : array[0..3] of byte = (
 | 
			
		||||
          end;
 | 
			
		||||
        { retrieve amount of ObjSections }
 | 
			
		||||
        nsects:=0;
 | 
			
		||||
        ExeSections.ForEachCall(@ExeSections_pass2_header,@nsects);
 | 
			
		||||
        ExeSectionList.ForEachCall(@ExeSectionList_pass2_header,@nsects);
 | 
			
		||||
        { calculate start positions after the headers }
 | 
			
		||||
        currdatapos:=stubsize+optheadersize+sizeof(tcoffsechdr)*nsects;
 | 
			
		||||
        currmempos:=stubsize+optheadersize+sizeof(tcoffsechdr)*nsects;
 | 
			
		||||
@ -2045,7 +2045,7 @@ const pemagic : array[0..3] of byte = (
 | 
			
		||||
             begin
 | 
			
		||||
               sym:=TExeSymbol(ExeSymbolList[i]);
 | 
			
		||||
               if not sym.ObjSymbol.objsection.Used then
 | 
			
		||||
                 ExeSymbolList.Delete(i);
 | 
			
		||||
                 ExeSymbolList[i]:=nil;
 | 
			
		||||
             end;
 | 
			
		||||
           ExeSymbolList.Pack;
 | 
			
		||||
           { Calculating symbols position and size }
 | 
			
		||||
@ -2191,9 +2191,9 @@ const pemagic : array[0..3] of byte = (
 | 
			
		||||
            FWriter.write(djoptheader,sizeof(djoptheader));
 | 
			
		||||
          end;
 | 
			
		||||
        { Section headers }
 | 
			
		||||
        ExeSections.ForEachCall(@ExeSections_write_header,nil);
 | 
			
		||||
        ExeSectionList.ForEachCall(@ExeSectionList_write_header,nil);
 | 
			
		||||
        { Section data }
 | 
			
		||||
        ExeSections.ForEachCall(@ExeSections_write_data,nil);
 | 
			
		||||
        ExeSectionList.ForEachCall(@ExeSectionList_write_data,nil);
 | 
			
		||||
        { Optional ObjSymbols }
 | 
			
		||||
        if not(cs_link_strip in current_settings.globalswitches) then
 | 
			
		||||
         begin
 | 
			
		||||
@ -2474,9 +2474,9 @@ const pemagic : array[0..3] of byte = (
 | 
			
		||||
        exesec.AddObjSection(objsec);
 | 
			
		||||
        pgaddr:=-1;
 | 
			
		||||
        hdrpos:=-1;
 | 
			
		||||
        for i:=0 to ExeSections.Count-1 do
 | 
			
		||||
        for i:=0 to ExeSectionList.Count-1 do
 | 
			
		||||
          begin
 | 
			
		||||
            exesec:=TExeSection(ExeSections[i]);
 | 
			
		||||
            exesec:=TExeSection(ExeSectionList[i]);
 | 
			
		||||
            for j:=0 to exesec.ObjSectionList.count-1 do
 | 
			
		||||
              begin
 | 
			
		||||
                objsec:=TObjSection(exesec.ObjSectionList[j]);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user