Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ The .NET Foundation licenses this file to you under the MIT license.
<IlcArg Condition="$(IlcMultiModule) == 'true'" Include="--multifile" />
<IlcArg Condition="$(Optimize) == 'true'" Include="-O" />
<IlcArg Condition="$(NativeDebugSymbols) == 'true'" Include="-g" />
<IlcArg Condition="$(IlcDwarfVersion) == '5'" Include="--gdwarf-5" />
<IlcArg Condition="$(IlcGenerateMapFile) == 'true'" Include="--map:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).map.xml" />
<IlcArg Condition="$(IlcGenerateDgmlFile) == 'true'" Include="--dgmllog:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).codegen.dgml.xml" />
<IlcArg Condition="$(IlcGenerateDgmlFile) == 'true'" Include="--scandgmllog:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).scan.dgml.xml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ partial class CompilationBuilder
protected bool _methodBodyFolding;
protected InstructionSetSupport _instructionSetSupport;
protected SecurityMitigationOptions _mitigationOptions;
protected bool _useDwarf5;

partial void InitializePartial()
{
Expand Down Expand Up @@ -103,6 +104,12 @@ public CompilationBuilder UseMethodImportationErrorProvider(MethodImportationErr
return this;
}

public CompilationBuilder UseDwarf5(bool value)
{
_useDwarf5 = value;
return this;
}

protected PreinitializationManager GetPreinitializationManager()
{
if (_preinitializationManager == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public class ObjectWriter : IDisposable, ITypesDebugInfoWriter
[DllImport(NativeObjectWriterFileName)]
private static extern void FinishObjWriter(IntPtr objWriter);

[DllImport(NativeObjectWriterFileName)]
private static extern void SetDwarfVersion(IntPtr objWriter, ushort v);

[DllImport(NativeObjectWriterFileName)]
private static extern void SwitchSection(IntPtr objWriter, string sectionName, CustomSectionAttributes attributes = 0, string comdatName = null);

Expand Down Expand Up @@ -884,6 +887,11 @@ public ObjectWriter(string objectFilePath, NodeFactory factory, ObjectWritingOpt
_isSingleFileCompilation = _nodeFactory.CompilationModuleGroup.IsSingleFileCompilation;
_userDefinedTypeDescriptor = new UserDefinedTypeDescriptor(this, factory);
_options = options;

if ((_options & ObjectWritingOptions.UseDwarf5) != 0)
{
SetDwarfVersion(_nativeObjectWriter, 5);
}
}

public void Dispose()
Expand Down Expand Up @@ -1319,5 +1327,6 @@ public enum ObjectWritingOptions
{
GenerateDebugInfo = 0x01,
ControlFlowGuard = 0x02,
UseDwarf5 = 0x4,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ protected override void CompileInternal(string outputFile, ObjectDumper dumper)
NodeFactory.SetMarkingComplete();

ObjectWritingOptions options = default;
if ((_compilationOptions & RyuJitCompilationOptions.UseDwarf5) != 0)
options |= ObjectWritingOptions.UseDwarf5;

if (_debugInformationProvider is not NullDebugInformationProvider)
options |= ObjectWritingOptions.GenerateDebugInfo;

Expand Down Expand Up @@ -242,5 +245,6 @@ public enum RyuJitCompilationOptions
{
MethodBodyFolding = 0x1,
ControlFlowGuardAnnotations = 0x2,
UseDwarf5 = 0x4,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public override ICompilation ToCompilation()
if ((_mitigationOptions & SecurityMitigationOptions.ControlFlowGuardAnnotations) != 0)
options |= RyuJitCompilationOptions.ControlFlowGuardAnnotations;

if (_useDwarf5)
options |= RyuJitCompilationOptions.UseDwarf5;

var factory = new RyuJitNodeFactory(_context, _compilationGroup, _metadataManager, _interopStubManager, _nameMangler, _vtableSliceProvider, _dictionaryLayoutProvider, GetPreinitializationManager());

JitConfigProvider.Initialize(_context.Target, jitFlagBuilder.ToArray(), _ryujitOptions);
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/tools/aot/ILCompiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ internal class Program
private string _instructionSet;
private string _guard;
private int _maxGenericCycle = CompilerTypeSystemContext.DefaultGenericCycleCutoffPoint;
private bool _useDwarf5;

private string _singleMethodTypeName;
private string _singleMethodName;
Expand Down Expand Up @@ -178,6 +179,7 @@ private ArgumentSyntax ParseCommandLine(string[] args)
syntax.DefineOption("Ot", ref optimizeTime, "Enable optimizations, favor code speed");
syntax.DefineOptionList("m|mibc", ref _mibcFilePaths, "Mibc file(s) for profile guided optimization"); ;
syntax.DefineOption("g", ref _enableDebugInfo, "Emit debugging information");
syntax.DefineOption("gdwarf-5", ref _useDwarf5, "Generate source-level debug information with dwarf version 5");
syntax.DefineOption("nativelib", ref _nativeLib, "Compile as static or shared library");
syntax.DefineOption("exportsfile", ref _exportsFile, "File to write exported method definitions");
syntax.DefineOption("dgmllog", ref _dgmlLogFileName, "Save result of dependency analysis as DGML");
Expand Down Expand Up @@ -769,7 +771,8 @@ static string ILLinkify(string rootedAssembly)
.UseCompilationRoots(compilationRoots)
.UseOptimizationMode(_optimizationMode)
.UseSecurityMitigationOptions(securityMitigationOptions)
.UseDebugInfoProvider(debugInfoProvider);
.UseDebugInfoProvider(debugInfoProvider)
.UseDwarf5(_useDwarf5);

if (scanResults != null)
{
Expand Down