diff options
author | Gaurav Khanna <gkhanna@microsoft.com> | 2015-11-22 20:03:29 +0300 |
---|---|---|
committer | Gaurav Khanna <gkhanna@microsoft.com> | 2015-11-23 20:58:49 +0300 |
commit | 0ef1812a36b822a429dd1a58aa70a057bd7bf4e7 (patch) | |
tree | 482e5b9e0dded9e84bdc71777cc36b71018d20ee /src/ILCompiler.Compiler | |
parent | 730da9d499bb88e9df6b003e74533ca26859b85f (diff) |
Fixes regression introduced by https://github.com/dotnet/corert/commit/8e0b6a850a17703e47ce50eb7dcd364e85c78149#diff-56344fb6f0d526f3fd8611ebd82ed7d6
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r-- | src/ILCompiler.Compiler/src/Compiler/Compilation.cs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs index cf0482ec3..f8b2377db 100644 --- a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs +++ b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs @@ -291,9 +291,7 @@ namespace ILCompiler { if (_mainMethod != null) { - AddCompilationRoot(_mainMethod, "Main method"); - - _nodeFactory.NodeAliases.Add(_nodeFactory.MethodEntrypoint(_mainMethod), "__managed__Main"); + AddCompilationRoot(_mainMethod, "Main method", "__managed__Main"); } foreach (var inputFile in _typeSystemContext.InputFilePaths) @@ -305,21 +303,24 @@ namespace ILCompiler { if (method.HasCustomAttribute("System.Runtime", "RuntimeExportAttribute")) { - AddCompilationRoot(method, "Runtime export"); - string exportName = ((EcmaMethod)method).GetAttributeStringValue("System.Runtime", "RuntimeExportAttribute"); - _nodeFactory.NodeAliases.Add(_nodeFactory.MethodEntrypoint(method), exportName); + AddCompilationRoot(method, "Runtime export", exportName); } } } } } - private void AddCompilationRoot(MethodDesc method, string reason) + private void AddCompilationRoot(MethodDesc method, string reason, string exportName = null) { if (_dependencyGraph != null) { - _dependencyGraph.AddRoot(_nodeFactory.MethodEntrypoint(method), reason); + var methodEntryPoint = _nodeFactory.MethodEntrypoint(method); + + _dependencyGraph.AddRoot(methodEntryPoint, reason); + + if (exportName != null) + _nodeFactory.NodeAliases.Add(methodEntryPoint, exportName); } else { |