Browse Source

+ wasm internal linker: count the 'fpc.reshandles' section towards the bss size
of the binary

Nikolay Nikolov 1 year ago
parent
commit
924d4b9b53
1 changed files with 7 additions and 0 deletions
  1. 7 0
      compiler/systems/t_wasi.pas

+ 7 - 0
compiler/systems/t_wasi.pas

@@ -79,6 +79,7 @@ type
     procedure DefaultLinkScript;override;
     procedure DefaultLinkScript;override;
 
 
     function GetDataSize(aExeOutput: TExeOutput): QWord;override;
     function GetDataSize(aExeOutput: TExeOutput): QWord;override;
+    function GetBssSize(aExeOutput: TExeOutput): QWord;override;
   public
   public
     constructor create;override;
     constructor create;override;
 
 
@@ -313,6 +314,12 @@ begin
           aExeOutput.findexesection('fpc.resources').size;
           aExeOutput.findexesection('fpc.resources').size;
 end;
 end;
 
 
+function TInternalLinkerWasi.GetBssSize(aExeOutput: TExeOutput): QWord;
+begin
+  Result:=aExeOutput.findexesection('.bss').size +
+          aExeOutput.findexesection('fpc.reshandles').size;
+end;
+
 constructor TInternalLinkerWasi.create;
 constructor TInternalLinkerWasi.create;
 begin
 begin
   inherited create;
   inherited create;