diff options
author | Ivan Diaz Sanchez <ivdiazsa@microsoft.com> | 2021-04-16 23:56:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 23:56:57 +0300 |
commit | d97ef9fc5ccdb4d9f39239842f77816af5038bc1 (patch) | |
tree | 83027684a1b9069aefff7631cd9862015b87f59e /src/coreclr/tools/aot | |
parent | ff178463b4d5fe974b7f78aed88ccfcb9aca5888 (diff) |
Changed the CompilerIdentifier label from the previous hardcoded message to programmatically retrieve the current version. (#51352)
Diffstat (limited to 'src/coreclr/tools/aot')
-rw-r--r-- | src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs index 5ebf2e4f341..7fcd2febf1a 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Reflection; using System.Text; using Internal.Text; using Internal.TypeSystem; @@ -9,8 +10,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { internal class CompilerIdentifierNode : HeaderTableNode { - private static readonly string _compilerIdentifier = "CoreRT Ready-To-Run Compiler"; - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; public override int ClassCode => 230053202; @@ -25,12 +24,21 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun sb.Append("__ReadyToRunHeader_CompilerIdentifier"); } + private string GetCompilerVersion() + { + return Assembly + .GetExecutingAssembly() + .GetCustomAttribute<AssemblyFileVersionAttribute>() + .Version; + } + public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { ObjectDataBuilder builder = new ObjectDataBuilder(factory, relocsOnly); + string compilerIdentifier = $"Crossgen2 {GetCompilerVersion()}"; builder.RequireInitialPointerAlignment(); builder.AddSymbol(this); - builder.EmitBytes(Encoding.ASCII.GetBytes(_compilerIdentifier)); + builder.EmitBytes(Encoding.ASCII.GetBytes(compilerIdentifier)); return builder.ToObjectData(); } } |