From aba44452f36284f757f4b8e899910b328864ce12 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Sun, 15 Sep 2024 08:59:04 +0300 Subject: [PATCH] * WebAssembly internal linker: also don't remove unused data sections if smartlinking is turned off. --- compiler/ogwasm.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/ogwasm.pas b/compiler/ogwasm.pas index 2c4c2cb08c..fc3dd1ea7e 100644 --- a/compiler/ogwasm.pas +++ b/compiler/ogwasm.pas @@ -4388,7 +4388,10 @@ implementation with DataSegments[i] do if Active then begin - CurrSec:=ObjData.createsection(SegName,1 shl SegAlignment,[oso_Data,oso_load,oso_write],false); + if not (cs_link_smart in current_settings.globalswitches) then + CurrSec:=ObjData.createsection(SegName,1 shl SegAlignment,[oso_Data,oso_load,oso_write,oso_keep],false) + else + CurrSec:=ObjData.createsection(SegName,1 shl SegAlignment,[oso_Data,oso_load,oso_write],false); CurrSec.DataPos:=DataPos; CurrSec.MemPos:=Offset; CurrSec.Size:=Len;