Browse Source

* wasm32 obj writer: do the relocations before writing the code, data and debug sections

Nikolay Nikolov 3 years ago
parent
commit
e959422753
1 changed files with 2 additions and 1 deletions
  1. 2 1
      compiler/ogwasm.pas

+ 2 - 1
compiler/ogwasm.pas

@@ -1915,6 +1915,8 @@ implementation
         MaybeAddDebugSectionToSymbolTable('.debug_aranges',wcstDebugAranges,debug_aranges_section_nr);
         MaybeAddDebugSectionToSymbolTable('.debug_aranges',wcstDebugAranges,debug_aranges_section_nr);
         MaybeAddDebugSectionToSymbolTable('.debug_ranges',wcstDebugRanges,debug_ranges_section_nr);
         MaybeAddDebugSectionToSymbolTable('.debug_ranges',wcstDebugRanges,debug_ranges_section_nr);
 
 
+        DoRelocations;
+
         if segment_count>0 then
         if segment_count>0 then
           begin
           begin
             WriteUleb(FWasmSections[wsiData],segment_count);
             WriteUleb(FWasmSections[wsiData],segment_count);
@@ -1974,7 +1976,6 @@ implementation
         MaybeWriteDebugSection('.debug_aranges',wcstDebugAranges);
         MaybeWriteDebugSection('.debug_aranges',wcstDebugAranges);
         MaybeWriteDebugSection('.debug_ranges',wcstDebugRanges);
         MaybeWriteDebugSection('.debug_ranges',wcstDebugRanges);
 
 
-        DoRelocations;
         WriteRelocations;
         WriteRelocations;
 
 
         WriteSymbolTable;
         WriteSymbolTable;