diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-11-17 10:31:10 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-11-18 10:11:26 +0300 |
commit | 5d6fa77372bf9c94a74ab3974a257646335d4340 (patch) | |
tree | 84a2c3bdb638b0712d0e023e91898c51a2a68be7 /src/ILCompiler | |
parent | 0fcbfff14ab3afb8aed2bb89cc1bb9b2edc0bb37 (diff) |
Make Runtime.Base compile with ilc
- Add -systemmodule command line option that allows specification of the system module
- Root RuntimeExport methods for compilation
- Change the static constructor helpers to be looked up lazily in ReadyToRunHelperNode
- Fix up a few places in Runtime.Base that used to need static constructors
Diffstat (limited to 'src/ILCompiler')
-rw-r--r-- | src/ILCompiler/src/Program.cs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/ILCompiler/src/Program.cs b/src/ILCompiler/src/Program.cs index bda427601..444e1a8c6 100644 --- a/src/ILCompiler/src/Program.cs +++ b/src/ILCompiler/src/Program.cs @@ -24,6 +24,8 @@ namespace ILCompiler Dictionary<string, string> _inputFilePaths = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); Dictionary<string, string> _referenceFilePaths = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + string _systemModuleName = "System.Private.CoreLib"; + CompilationOptions _options; CompilerTypeSystemContext _compilerTypeSystemContext; @@ -88,6 +90,10 @@ namespace ILCompiler _options.NoLineNumbers = true; break; + case "systemmodule": + _systemModuleName = parser.GetStringValue(); + break; + default: throw new CommandLineException("Unrecognized option: " + parser.GetCurrentOption()); } @@ -112,12 +118,15 @@ namespace ILCompiler void SingleFileCompilation() { - EcmaModule entryPointModule = GetEntryPointModule(); - if (entryPointModule == null) - throw new CommandLineException("No entrypoint module"); + List<MethodDesc> rootMethods = new List<MethodDesc>(); + MethodDesc entryPointMethod = null; - int entryPointToken = entryPointModule.PEReader.PEHeaders.CorHeader.EntryPointTokenOrRelativeVirtualAddress; - MethodDesc entryPointMethod = entryPointModule.GetMethod(MetadataTokens.EntityHandle(entryPointToken)); + EcmaModule entryPointModule = GetEntryPointModule(); + if (entryPointModule != null) + { + int entryPointToken = entryPointModule.PEReader.PEHeaders.CorHeader.EntryPointTokenOrRelativeVirtualAddress; + entryPointMethod = entryPointModule.GetMethod(MetadataTokens.EntityHandle(entryPointToken)); + } Compilation compilation = new Compilation(_compilerTypeSystemContext, _options); compilation.Log = Console.Out; @@ -165,7 +174,7 @@ namespace ILCompiler _compilerTypeSystemContext.InputFilePaths = _inputFilePaths; _compilerTypeSystemContext.ReferenceFilePaths = _referenceFilePaths; - _compilerTypeSystemContext.SetSystemModule(_compilerTypeSystemContext.GetModuleForSimpleName("System.Private.CoreLib")); + _compilerTypeSystemContext.SetSystemModule(_compilerTypeSystemContext.GetModuleForSimpleName(_systemModuleName)); // For now, we can do single file compilation only // TODO: Multifile |