Browse Source

* wasm internal linker: use the main symbol (without WASM_SYM_EXPLICIT_NAME,
i.e. not an alias) to define code section names in the wasm object reader.
For example, the section for the INITHEAP function is now called:
.text.n_SYSTEM_$$_INITHEAP
instead of
.text.n__FPC_InitHeap
(which is based on an explicit alias for the function - '_FPC_InitHeap')

Nikolay Nikolov 1 year ago
parent
commit
e1d56a9944
1 changed files with 6 additions and 3 deletions
  1. 6 3
      compiler/ogwasm.pas

+ 6 - 3
compiler/ogwasm.pas

@@ -3777,10 +3777,13 @@ implementation
                     InputError('WASM_SYM_UNDEFINED not set on a SYMTAB_FUNCTION symbol, that is an import');
                     exit;
                   end;
-                with CodeSegments[SymIndex-FuncTypeImportsCount] do
+                if (SymFlags and WASM_SYM_EXPLICIT_NAME)=0 then
                   begin
-                    SegName:='.text.n_'+SymName;
-                    SegIsExported:=FuncTypes[SymIndex].IsExported;
+                    with CodeSegments[SymIndex-FuncTypeImportsCount] do
+                      begin
+                        SegName:='.text.n_'+SymName;
+                        SegIsExported:=FuncTypes[SymIndex].IsExported;
+                      end;
                   end;
               end;