Search in sources :

Example 1 with ImageOptionNT64Header

use of com.oracle.truffle.llvm.parser.coff.CoffFile.ImageOptionNT64Header in project graal by oracle.

the class PEFile method getImportDataReader.

private ObjectFileReader getImportDataReader() {
    // First see if there is an import data directory
    ImageOptionNT64Header header = getOptionHeader();
    if (header != null) {
        ImageDataDirectory importDirectory = header.getImportDirectory();
        if (importDirectory != null) {
            return coffFile.getReaderAtVirtualAddress(importDirectory.getVirtualAddress());
        }
    }
    // Otherwise try to load it from the .idata section
    ImageSectionHeader imageSection = coffFile.getSection(".idata");
    if (imageSection != null) {
        return coffFile.getReaderAtVirtualAddress(imageSection.virtualAddress);
    }
    // Finally, give up
    return null;
}
Also used : ImageDataDirectory(com.oracle.truffle.llvm.parser.coff.CoffFile.ImageDataDirectory) ImageSectionHeader(com.oracle.truffle.llvm.parser.coff.CoffFile.ImageSectionHeader) ImageOptionNT64Header(com.oracle.truffle.llvm.parser.coff.CoffFile.ImageOptionNT64Header)

Aggregations

ImageDataDirectory (com.oracle.truffle.llvm.parser.coff.CoffFile.ImageDataDirectory)1 ImageOptionNT64Header (com.oracle.truffle.llvm.parser.coff.CoffFile.ImageOptionNT64Header)1 ImageSectionHeader (com.oracle.truffle.llvm.parser.coff.CoffFile.ImageSectionHeader)1