mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 18:29:13 +02:00
+ added a 'producers' custom section to WebAssembly object modules, containing the FPC version
This commit is contained in:
parent
1ce1a0fe1f
commit
1dd80d596d
@ -169,7 +169,7 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
verbose;
|
verbose,version;
|
||||||
|
|
||||||
procedure WriteUleb5(d: tdynamicarray; v: uint64);
|
procedure WriteUleb5(d: tdynamicarray; v: uint64);
|
||||||
var
|
var
|
||||||
@ -1655,6 +1655,18 @@ implementation
|
|||||||
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
||||||
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
||||||
|
|
||||||
|
{ Write the producers section:
|
||||||
|
https://github.com/WebAssembly/tool-conventions/blob/main/ProducersSection.md }
|
||||||
|
WriteUleb(FWasmCustomSections[wcstProducers],2);
|
||||||
|
WriteName(FWasmCustomSections[wcstProducers],'language');
|
||||||
|
WriteUleb(FWasmCustomSections[wcstProducers],1);
|
||||||
|
WriteName(FWasmCustomSections[wcstProducers],'Pascal');
|
||||||
|
WriteName(FWasmCustomSections[wcstProducers],'');
|
||||||
|
WriteName(FWasmCustomSections[wcstProducers],'processed-by');
|
||||||
|
WriteUleb(FWasmCustomSections[wcstProducers],1);
|
||||||
|
WriteName(FWasmCustomSections[wcstProducers],'Free Pascal Compiler (FPC)');
|
||||||
|
WriteName(FWasmCustomSections[wcstProducers],full_version_string+' ['+date_string+'] for '+target_cpu_string+' - '+target_info.shortname);
|
||||||
|
|
||||||
code_section_nr:=-1;
|
code_section_nr:=-1;
|
||||||
data_section_nr:=-1;
|
data_section_nr:=-1;
|
||||||
section_nr:=0;
|
section_nr:=0;
|
||||||
@ -1708,6 +1720,8 @@ implementation
|
|||||||
WriteWasmCustomSection(wcstRelocData);
|
WriteWasmCustomSection(wcstRelocData);
|
||||||
Inc(section_nr);
|
Inc(section_nr);
|
||||||
end;
|
end;
|
||||||
|
WriteWasmCustomSection(wcstProducers);
|
||||||
|
Inc(section_nr);
|
||||||
|
|
||||||
result:=true;
|
result:=true;
|
||||||
end;
|
end;
|
||||||
|
@ -49,13 +49,15 @@ type
|
|||||||
TWasmCustomSectionType = (
|
TWasmCustomSectionType = (
|
||||||
wcstLinking,
|
wcstLinking,
|
||||||
wcstRelocCode,
|
wcstRelocCode,
|
||||||
wcstRelocData);
|
wcstRelocData,
|
||||||
|
wcstProducers);
|
||||||
|
|
||||||
const
|
const
|
||||||
WasmCustomSectionName: array [TWasmCustomSectionType] of string =
|
WasmCustomSectionName: array [TWasmCustomSectionType] of string =
|
||||||
('linking',
|
('linking',
|
||||||
'reloc.CODE',
|
'reloc.CODE',
|
||||||
'reloc.DATA');
|
'reloc.DATA',
|
||||||
|
'producers');
|
||||||
|
|
||||||
type
|
type
|
||||||
TWasmRelocationType = (
|
TWasmRelocationType = (
|
||||||
|
Loading…
Reference in New Issue
Block a user