浏览代码

+ create relocation objects for R_WASM_TYPE_INDEX_LEB relocations in the wasm object reader

Nikolay Nikolov 1 年之前
父节点
当前提交
73895d3cbc
共有 2 个文件被更改,包括 17 次插入1 次删除
  1. 8 0
      compiler/ogbase.pas
  2. 9 1
      compiler/ogwasm.pas

+ 8 - 0
compiler/ogbase.pas

@@ -3711,6 +3711,10 @@ implementation
             refobjsec:=objreloc.objsection
             refobjsec:=objreloc.objsection
           else if assigned(objreloc.group) then
           else if assigned(objreloc.group) then
             refgrp:=objreloc.group
             refgrp:=objreloc.group
+{$ifdef WASM}
+          else if objreloc.ftype=Ord(RELOC_TYPE_INDEX_LEB) then
+            {nothing}
+{$endif WASM}
           else
           else
             internalerror(200603316);
             internalerror(200603316);
           if assigned(exemap) then
           if assigned(exemap) then
@@ -3723,6 +3727,10 @@ implementation
                 exemap.Add('  References '+refobjsec.fullname)
                 exemap.Add('  References '+refobjsec.fullname)
               else if assigned(refgrp) then
               else if assigned(refgrp) then
                 exemap.Add('  References '+refgrp.Name)
                 exemap.Add('  References '+refgrp.Name)
+{$ifdef WASM}
+              else if objreloc.ftype=Ord(RELOC_TYPE_INDEX_LEB) then
+                {nothing}
+{$endif WASM}
               else
               else
                 internalerror(2006033111);
                 internalerror(2006033111);
             end;
             end;

+ 9 - 1
compiler/ogwasm.pas

@@ -3898,9 +3898,17 @@ implementation
                       else
                       else
                         Writeln('Warning! No object symbol created for ', SymbolTable[RelocIndex].SymName);
                         Writeln('Warning! No object symbol created for ', SymbolTable[RelocIndex].SymName);
                     end;
                     end;
+                  R_WASM_TYPE_INDEX_LEB:
+                    begin
+                      if RelocIndex>high(FFuncTypes) then
+                        begin
+                          InputError('Type index in relocation too high');
+                          exit;
+                        end;
+                      ObjSec.ObjRelocations.Add(TWasmObjRelocation.CreateTypeIndex(RelocOffset-BaseSectionOffset,RelocIndex));
+                    end;
                   R_WASM_SECTION_OFFSET_I32,
                   R_WASM_SECTION_OFFSET_I32,
                   R_WASM_FUNCTION_OFFSET_I32,
                   R_WASM_FUNCTION_OFFSET_I32,
-                  R_WASM_TYPE_INDEX_LEB,
                   R_WASM_GLOBAL_INDEX_LEB,
                   R_WASM_GLOBAL_INDEX_LEB,
                   R_WASM_TAG_INDEX_LEB:
                   R_WASM_TAG_INDEX_LEB:
                     {TODO};
                     {TODO};