Browse Source

+ WebAssembly object writer: record the custom section index for debug sections
in a new field TWasmObjSection.CustomSectionIdx

Nikolay Nikolov 11 months ago
parent
commit
27fd290150
1 changed files with 3 additions and 0 deletions
  1. 3 0
      compiler/ogwasm.pas

+ 3 - 0
compiler/ogwasm.pas

@@ -132,6 +132,7 @@ interface
         SegOfs: qword;
         SegOfs: qword;
         FileSectionOfs: qword;
         FileSectionOfs: qword;
         MainFuncSymbol: TWasmObjSymbol;
         MainFuncSymbol: TWasmObjSymbol;
+        CustomSectionIdx: Integer;
         constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:longint;Aoptions:TObjSectionOptions);override;
         constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:longint;Aoptions:TObjSectionOptions);override;
         function IsCode: Boolean;
         function IsCode: Boolean;
         function IsData: Boolean;
         function IsData: Boolean;
@@ -753,6 +754,7 @@ implementation
         inherited create(AList, Aname, Aalign, Aoptions);
         inherited create(AList, Aname, Aalign, Aoptions);
         SegIdx:=-1;
         SegIdx:=-1;
         SegSymIdx:=-1;
         SegSymIdx:=-1;
+        CustomSectionIdx:=-1;
         MainFuncSymbol:=nil;
         MainFuncSymbol:=nil;
       end;
       end;
 
 
@@ -1679,6 +1681,7 @@ implementation
                 debug_section_nr:=section_nr;
                 debug_section_nr:=section_nr;
                 Inc(section_nr);
                 Inc(section_nr);
                 objsec.SegSymIdx:=FWasmSymbolTableEntriesCount;
                 objsec.SegSymIdx:=FWasmSymbolTableEntriesCount;
+                objsec.CustomSectionIdx:=debug_section_nr;
                 Inc(FWasmSymbolTableEntriesCount);
                 Inc(FWasmSymbolTableEntriesCount);
                 WriteByte(FWasmSymbolTable,Ord(SYMTAB_SECTION));
                 WriteByte(FWasmSymbolTable,Ord(SYMTAB_SECTION));
                 WriteUleb(FWasmSymbolTable,WASM_SYM_BINDING_LOCAL);
                 WriteUleb(FWasmSymbolTable,WASM_SYM_BINDING_LOCAL);