Fix x86 analysis based on ELF PLT

This commit is contained in:
Katy Coe
2019-10-26 15:18:55 +02:00
parent 3a66e59447
commit 9ee2e7567c
2 changed files with 59 additions and 45 deletions

View File

@@ -79,7 +79,12 @@ namespace Il2CppInspector
public uint[] UIntArray(ulong[] a) => Array.ConvertAll(a, x => (uint) x);
}
internal abstract class ElfReader<TWord, TPHdr, TSym, TReader, TMath> : FileFormatReader<TReader>
interface IElfReader
{
uint GetPLTAddress();
}
internal abstract class ElfReader<TWord, TPHdr, TSym, TReader, TMath> : FileFormatReader<TReader>, IElfReader
where TWord : struct
where TPHdr : Ielf_phdr<TWord>, new()
where TSym : Ielf_sym<TWord>, new()
@@ -335,5 +340,8 @@ namespace Il2CppInspector
var program_header_table = this.program_header_table.First(x => uiAddr >= math.ULong(x.p_vaddr) && uiAddr <= math.ULong(math.Add(x.p_vaddr, x.p_filesz)));
return (uint) (uiAddr - math.ULong(math.Sub(program_header_table.p_vaddr, program_header_table.p_offset)));
}
// Get the address of the procedure linkage table (.got.plt) which is needed for some disassemblies
public uint GetPLTAddress() => (uint) math.ULong(getDynamic(Elf.DT_PLTGOT).d_un);
}
}