You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/LibObjectFile/Elf/ElfObjectFile.cs
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -179,6 +179,12 @@ public override void Verify(DiagnosticBag diagnostics)
179
179
diagnostics.Error(DiagnosticId.ELF_ERR_InvalidHeaderFileClassNone,$"Cannot compute the layout with an {nameof(ElfObjectFile)} having a {nameof(FileClass)} == {ElfFileClass.None}");
180
180
}
181
181
182
+
if(VisibleSectionCount>=ElfNative.SHN_LORESERVE&&
183
+
Sections[0]is not ElfNullSection)
184
+
{
185
+
diagnostics.Error(DiagnosticId.ELF_ERR_MissingNullSection,$"Section count is higher than SHN_LORESERVE ({ElfNative.SHN_LORESERVE}) but the first section is not a NULL section");
entry.Section=reader.ResolveLink(entry.Section,$"Invalid link section index {entry.Section.SpecialIndex} for symbol table entry [{i}] from symbol table section [{this}]");
entry.Section=reader.ResolveLink(entry.Section,$"Invalid link section index {entry.Section.SpecialIndex} for symbol table entry [{i}] from symbol table section [{this}]");
204
+
}
199
205
200
206
Entries[i]=entry;
201
207
}
@@ -212,6 +218,7 @@ public override void Verify(DiagnosticBag diagnostics)
212
218
}
213
219
214
220
boolisAllowingLocal=true;
221
+
boolneedsSectionHeaderIndices=false;
215
222
216
223
for(inti=0;i<Entries.Count;i++)
217
224
{
@@ -222,9 +229,14 @@ public override void Verify(DiagnosticBag diagnostics)
222
229
diagnostics.Error(DiagnosticId.ELF_ERR_InvalidFirstSymbolEntryNonNull,$"Invalid entry #{i} in the {nameof(ElfSymbolTable)} section [{Index}]. The first entry must be null/undefined");
diagnostics.Error(DiagnosticId.ELF_ERR_InvalidSymbolEntrySectionParent,$"Invalid section for the symbol entry #{i} in the {nameof(ElfSymbolTable)} section [{Index}]. The section of the entry `{entry}` must the same than this symbol table section");
234
+
if(entry.Section.Section.Parent!=Parent)
235
+
{
236
+
diagnostics.Error(DiagnosticId.ELF_ERR_InvalidSymbolEntrySectionParent,$"Invalid section for the symbol entry #{i} in the {nameof(ElfSymbolTable)} section [{Index}]. The section of the entry `{entry}` must the same than this symbol table section");
diagnostics.Error(DiagnosticId.ELF_ERR_MissingSectionHeaderIndices,$"Symbol table [{Name.Value}] references section indexes higher than SHN_LORESERVE and accompanying {nameof(ElfSymbolTableSectionHeaderIndices)} section is missing");
thrownewArgumentException($"Invalid type `{Type}` of the section [{Index}] `{nameof(ElfSymbolTableSectionHeaderIndices)}`. Only `{ElfSectionType.SymbolTableSectionHeaderIndices}` is valid");
33
+
}
34
+
base.Type=value;
35
+
}
36
+
}
37
+
38
+
/// <summary>
39
+
/// Gets a list of <see cref="ElfSectionLink"/> entries.
entry=reader.ResolveLink(entry.Section,$"Invalid link section index {entry.SpecialIndex} for symbol table entry [{i}] from symbol table section [{this}]");
diagnostics.Error(DiagnosticId.ELF_ERR_InvalidSymbolEntrySectionParent,$"Invalid section for the symbol entry #{i} in the {nameof(ElfSymbolTable)} section [{Index}]");
0 commit comments