|
@@ -4632,15 +4632,28 @@ implementation
|
|
|
internalerror(2024010107);
|
|
|
end;
|
|
|
|
|
|
+ const
|
|
|
+ DataSections: array [1..3] of string = (
|
|
|
+ '.rodata',
|
|
|
+ '.data',
|
|
|
+ 'fpc.resources');
|
|
|
var
|
|
|
DataCount: Integer;
|
|
|
+ DataSecName: string;
|
|
|
+ ExeSec: TExeSection;
|
|
|
begin
|
|
|
- DataCount:=3;
|
|
|
+ DataCount:=0;
|
|
|
+ for DataSecName in DataSections do
|
|
|
+ if FindExeSection(DataSecName).Size>0 then
|
|
|
+ Inc(DataCount);
|
|
|
WriteUleb(FWasmSections[wsiDataCount],DataCount);
|
|
|
WriteUleb(FWasmSections[wsiData],DataCount);
|
|
|
- WriteExeSection(FindExeSection('.rodata'));
|
|
|
- WriteExeSection(FindExeSection('.data'));
|
|
|
- WriteExeSection(FindExeSection('fpc.resources'));
|
|
|
+ for DataSecName in DataSections do
|
|
|
+ begin
|
|
|
+ ExeSec:=FindExeSection(DataSecName);
|
|
|
+ if ExeSec.Size>0 then
|
|
|
+ WriteExeSection(ExeSec);
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
procedure WriteTableAndElemSections;
|