mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 20:28:13 +02:00
+ produce a target_features section when compiling with -CTwasmthreads
This commit is contained in:
parent
1dd80d596d
commit
7cd082ba5f
@ -169,7 +169,7 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
verbose,version;
|
||||
verbose,version,globals;
|
||||
|
||||
procedure WriteUleb5(d: tdynamicarray; v: uint64);
|
||||
var
|
||||
@ -1655,6 +1655,19 @@ implementation
|
||||
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
||||
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
||||
|
||||
if ts_wasm_threads in current_settings.targetswitches then
|
||||
begin
|
||||
WriteUleb(FWasmCustomSections[wcstTargetFeatures],4);
|
||||
WriteUleb(FWasmCustomSections[wcstTargetFeatures],$2B);
|
||||
WriteName(FWasmCustomSections[wcstTargetFeatures],'atomics');
|
||||
WriteUleb(FWasmCustomSections[wcstTargetFeatures],$2B);
|
||||
WriteName(FWasmCustomSections[wcstTargetFeatures],'bulk-memory');
|
||||
WriteUleb(FWasmCustomSections[wcstTargetFeatures],$2B);
|
||||
WriteName(FWasmCustomSections[wcstTargetFeatures],'mutable-globals');
|
||||
WriteUleb(FWasmCustomSections[wcstTargetFeatures],$2B);
|
||||
WriteName(FWasmCustomSections[wcstTargetFeatures],'sign-ext');
|
||||
end;
|
||||
|
||||
{ Write the producers section:
|
||||
https://github.com/WebAssembly/tool-conventions/blob/main/ProducersSection.md }
|
||||
WriteUleb(FWasmCustomSections[wcstProducers],2);
|
||||
@ -1722,6 +1735,11 @@ implementation
|
||||
end;
|
||||
WriteWasmCustomSection(wcstProducers);
|
||||
Inc(section_nr);
|
||||
if ts_wasm_threads in current_settings.targetswitches then
|
||||
begin
|
||||
WriteWasmCustomSection(wcstTargetFeatures);
|
||||
Inc(section_nr);
|
||||
end;
|
||||
|
||||
result:=true;
|
||||
end;
|
||||
|
@ -50,14 +50,16 @@ type
|
||||
wcstLinking,
|
||||
wcstRelocCode,
|
||||
wcstRelocData,
|
||||
wcstProducers);
|
||||
wcstProducers,
|
||||
wcstTargetFeatures);
|
||||
|
||||
const
|
||||
WasmCustomSectionName: array [TWasmCustomSectionType] of string =
|
||||
('linking',
|
||||
'reloc.CODE',
|
||||
'reloc.DATA',
|
||||
'producers');
|
||||
'producers',
|
||||
'target_features');
|
||||
|
||||
type
|
||||
TWasmRelocationType = (
|
||||
|
Loading…
Reference in New Issue
Block a user