Skip to content

Commit 09365c1

Browse files
committed
Make ElfFile constructors backward compatible (at Assembly binary level)
1 parent b2b6500 commit 09365c1

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/LibObjectFile/Elf/ElfFile.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,37 @@ public sealed partial class ElfFile : ElfObject, IEnumerable<ElfContent>
3333
/// <summary>
3434
/// Creates a new instance with the default sections (null and a shadow program header table).
3535
/// </summary>
36-
public ElfFile(ElfArch arch, bool addDefaultSections=true) : this(arch, ElfFileClass.None, ElfEncoding.None, addDefaultSections)
36+
public ElfFile(ElfArch arch) : this(arch, true)
37+
{
38+
}
39+
40+
/// <summary>
41+
/// Creates a new instance with optional default sections (null and a shadow program header table).
42+
/// </summary>
43+
/// <param name="arch">The machine architecture for the ELF file.</param>
44+
/// <param name="addDefaultSections">If <c>true</c>, adds default sections (null and a shadow program header table).</param>
45+
public ElfFile(ElfArch arch, bool addDefaultSections) : this(arch, ElfFileClass.None, ElfEncoding.None, addDefaultSections)
3746
{
3847
}
3948

4049
/// <summary>
4150
/// Creates a new instance with the default sections (null and a shadow program header table).
4251
/// </summary>
43-
public ElfFile(ElfArch arch, ElfFileClass fileClass, ElfEncoding encoding,bool addDefaultSections=true) : this(addDefaultSections)
52+
/// <param name="arch">The machine architecture for the ELF file.</param>
53+
/// <param name="fileClass">The file class (32 or 64 bits) for the ELF file.</param>
54+
/// <param name="encoding">The encoding (LSB or MSB) for the ELF file.</param>
55+
public ElfFile(ElfArch arch, ElfFileClass fileClass, ElfEncoding encoding) : this(arch, fileClass, encoding, true)
56+
{
57+
}
58+
59+
/// <summary>
60+
/// Creates a new instance with optional default sections (null and a shadow program header table).
61+
/// </summary>
62+
/// <param name="arch">The machine architecture for the ELF file.</param>
63+
/// <param name="fileClass">The file class (32 or 64 bits) for the ELF file.</param>
64+
/// <param name="encoding">The encoding (LSB or MSB) for the ELF file.</param>
65+
/// <param name="addDefaultSections">If <c>true</c>, adds default sections (null and a shadow program header table).</param>
66+
public ElfFile(ElfArch arch, ElfFileClass fileClass, ElfEncoding encoding, bool addDefaultSections) : this(addDefaultSections)
4467
{
4568
Arch = arch;
4669
switch (arch)

0 commit comments

Comments
 (0)