diff options
author | Morgan Brown <morganbr@users.noreply.github.com> | 2018-05-23 09:53:58 +0300 |
---|---|---|
committer | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2018-05-23 09:53:58 +0300 |
commit | 4aeeb6a582156f52d1d25912e8819c50ea9e5917 (patch) | |
tree | 628c6e620870286384bfcf5487cdc4313539097b /src/ILCompiler.WebAssembly | |
parent | 023db45b41948bb85858766eefd9840a7a608d78 (diff) |
Fixes emitting end offsets for R2R header regions by: (#5844)
1. Incoporating offsetFromSymbolName in offset calculations
2. Sorting node emission so sizes are computed before trying to emit them
Diffstat (limited to 'src/ILCompiler.WebAssembly')
-rw-r--r-- | src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs | 4 | ||||
-rw-r--r-- | src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilationBuilder.cs | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs index 2bf071588..cec8c0563 100644 --- a/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs +++ b/src/ILCompiler.WebAssembly/src/CodeGen/WebAssemblyObjectWriter.cs @@ -503,13 +503,15 @@ namespace ILCompiler.DependencyAnalysis delta = checked(delta + sizeof(int)); } + int totalOffset = checked(delta + offsetFromSymbolName); + EmitBlob(new byte[this._nodeFactory.Target.PointerSize]); if (relocType == RelocType.IMAGE_REL_BASED_REL32) { return this._nodeFactory.Target.PointerSize; } - _currentObjectSymbolRefs.Add(symbolStartOffset, new SymbolRefData(isFunction, realSymbolName, delta)); + _currentObjectSymbolRefs.Add(symbolStartOffset, new SymbolRefData(isFunction, realSymbolName, totalOffset)); return _nodeFactory.Target.PointerSize; } diff --git a/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilationBuilder.cs b/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilationBuilder.cs index e6f82061e..c65371259 100644 --- a/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilationBuilder.cs +++ b/src/ILCompiler.WebAssembly/src/Compiler/WebAssemblyCodegenCompilationBuilder.cs @@ -33,7 +33,7 @@ namespace ILCompiler { var interopStubManager = new CompilerGeneratedInteropStubManager(_compilationGroup, _context, new InteropStateManager(_context.GeneratedAssembly)); WebAssemblyCodegenNodeFactory factory = new WebAssemblyCodegenNodeFactory(_context, _compilationGroup, _metadataManager, interopStubManager, _nameMangler, _vtableSliceProvider, _dictionaryLayoutProvider); - DependencyAnalyzerBase<NodeFactory> graph = CreateDependencyGraph(factory); + DependencyAnalyzerBase<NodeFactory> graph = CreateDependencyGraph(factory, new ObjectNode.ObjectNodeComparer(new CompilerComparer())); return new WebAssemblyCodegenCompilation(graph, factory, _compilationRoots, _logger, _config); } |