diff --git a/compiler/systems/t_wasi.pas b/compiler/systems/t_wasi.pas index 163c13795d..463cee7552 100644 --- a/compiler/systems/t_wasi.pas +++ b/compiler/systems/t_wasi.pas @@ -345,11 +345,20 @@ begin is important to keep the sections grouped, and keep the first section in each group intact (otherwise, TWasmExeOutput.MemPos_ExeSection in ogwasm.pas needs to be updated) } + { tags (used by WebAssembly native exceptions) } + ScriptAddGenericSections('.wasm_tags'); + { code } + if ts_wasm_threads in current_settings.targetswitches then + begin + linkscript.Concat('EXESECTION .text'); + linkscript.Concat(' OBJSECTION .text*'); + { functions, generated by the linker: } + linkscript.Concat(' SYMBOL __wasm_init_tls'); + linkscript.Concat('ENDEXESECTION'); + end + else + ScriptAddGenericSections('.text'); ScriptAddGenericSections( - { tags (used by WebAssembly native exceptions) } - '.wasm_tags,'+ - { code } - '.text,'+ { data (initialized data first, uninitialized data later) } '.rodata,.data,fpc.resources,fpc.reshandles,.bss,'+ { debug info }