Browse Source

* WebAssembly internal linker: don't remove unused code sections if smartlinking
is turned off. This is needed for debugging, because FPC doesn't support debug
info with smartlinking on most platforms, and that includes WebAssembly.

Nikolay Nikolov 11 months ago
parent
commit
36ecb2b5da
1 changed files with 1 additions and 1 deletions
  1. 1 1
      compiler/ogwasm.pas

+ 1 - 1
compiler/ogwasm.pas

@@ -4376,7 +4376,7 @@ implementation
                   InputError('Code section ' + tostr(i) + ' does not have a main symbol defined in the symbol table');
                   InputError('Code section ' + tostr(i) + ' does not have a main symbol defined in the symbol table');
                   exit;
                   exit;
                 end;
                 end;
-              if SegIsExported then
+              if SegIsExported or not (cs_link_smart in current_settings.globalswitches) then
                 CurrSec:=ObjData.createsection(SegName,1,[oso_executable,oso_Data,oso_load,oso_keep],false)
                 CurrSec:=ObjData.createsection(SegName,1,[oso_executable,oso_Data,oso_load,oso_keep],false)
               else
               else
                 CurrSec:=ObjData.createsection(SegName,1,[oso_executable,oso_Data,oso_load],false);
                 CurrSec:=ObjData.createsection(SegName,1,[oso_executable,oso_Data,oso_load],false);