mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 02:12:50 +02:00
+ detect heap sections and fill the local heap size in the NewExe header
git-svn-id: trunk@42595 -
This commit is contained in:
parent
cffc8317fa
commit
0c4d02ff9c
@ -496,6 +496,7 @@ interface
|
|||||||
private
|
private
|
||||||
FEarlySize: QWord;
|
FEarlySize: QWord;
|
||||||
FStackSize: QWord;
|
FStackSize: QWord;
|
||||||
|
FLocalHeapSize: QWord;
|
||||||
FExeMetaSec: TNewExeMetaSection;
|
FExeMetaSec: TNewExeMetaSection;
|
||||||
FMemBasePos: Word;
|
FMemBasePos: Word;
|
||||||
FDataPosSectors: Word;
|
FDataPosSectors: Word;
|
||||||
@ -508,6 +509,7 @@ interface
|
|||||||
function CanAddObjSection(objsec:TObjSection;ExeSectionLimit:QWord):boolean;
|
function CanAddObjSection(objsec:TObjSection;ExeSectionLimit:QWord):boolean;
|
||||||
property EarlySize: QWord read FEarlySize write FEarlySize;
|
property EarlySize: QWord read FEarlySize write FEarlySize;
|
||||||
property StackSize: QWord read FStackSize write FStackSize;
|
property StackSize: QWord read FStackSize write FStackSize;
|
||||||
|
property LocalHeapSize: QWord read FLocalHeapSize write FLocalHeapSize;
|
||||||
property ExeMetaSec: TNewExeMetaSection read FExeMetaSec write FExeMetaSec;
|
property ExeMetaSec: TNewExeMetaSection read FExeMetaSec write FExeMetaSec;
|
||||||
property MemBasePos: Word read FMemBasePos write FMemBasePos;
|
property MemBasePos: Word read FMemBasePos write FMemBasePos;
|
||||||
property DataPosSectors: Word read FDataPosSectors write FDataPosSectors;
|
property DataPosSectors: Word read FDataPosSectors write FDataPosSectors;
|
||||||
@ -3630,7 +3632,7 @@ cleanup:
|
|||||||
s: TSymStr;
|
s: TSymStr;
|
||||||
Separator: SizeInt;
|
Separator: SizeInt;
|
||||||
SegName, SegClass: string;
|
SegName, SegClass: string;
|
||||||
IsStack: Boolean;
|
IsStack, IsHeap: Boolean;
|
||||||
begin
|
begin
|
||||||
{ allow mixing initialized and uninitialized data in the same section
|
{ allow mixing initialized and uninitialized data in the same section
|
||||||
=> set ignoreprops=true }
|
=> set ignoreprops=true }
|
||||||
@ -3658,6 +3660,9 @@ cleanup:
|
|||||||
IsStack:=True;
|
IsStack:=True;
|
||||||
if IsStack then
|
if IsStack then
|
||||||
StackSize:=StackSize+objsec.Size;
|
StackSize:=StackSize+objsec.Size;
|
||||||
|
IsHeap:=SegClass='HEAP';
|
||||||
|
if IsHeap then
|
||||||
|
LocalHeapSize:=LocalHeapSize+objsec.Size;
|
||||||
EarlySize:=align_qword(EarlySize,SecAlign)+objsec.Size;
|
EarlySize:=align_qword(EarlySize,SecAlign)+objsec.Size;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3742,7 +3747,8 @@ cleanup:
|
|||||||
Header.InitialSP:=0;
|
Header.InitialSP:=0;
|
||||||
Header.InitialSS:=Header.AutoDataSegmentNumber;
|
Header.InitialSS:=Header.AutoDataSegmentNumber;
|
||||||
Header.InitialStackSize:=TNewExeSection(ExeSectionList[Header.AutoDataSegmentNumber-1]).StackSize;
|
Header.InitialStackSize:=TNewExeSection(ExeSectionList[Header.AutoDataSegmentNumber-1]).StackSize;
|
||||||
{todo: subtract the stack size from the size of the auto data segment }
|
Header.InitialLocalHeapSize:=TNewExeSection(ExeSectionList[Header.AutoDataSegmentNumber-1]).LocalHeapSize;
|
||||||
|
{todo: subtract the stack size and the local heap size from the size of the auto data segment }
|
||||||
|
|
||||||
Header.SegmentTableStart:=NewExeHeaderSize;
|
Header.SegmentTableStart:=NewExeHeaderSize;
|
||||||
Header.SegmentTableEntriesCount:=ExeSectionList.Count;
|
Header.SegmentTableEntriesCount:=ExeSectionList.Count;
|
||||||
|
Loading…
Reference in New Issue
Block a user