use of com.oracle.truffle.llvm.parser.filereader.ObjectFileReader in project graal by oracle.
the class CoffFile method getReaderAtVirtualAddress.
public ObjectFileReader getReaderAtVirtualAddress(int virtualAddress) {
ImageSectionHeader section = lookupOffset(virtualAddress);
ByteSequence sectionBytes = bytes.subSequence(section.pointerToRawData, section.pointerToRawData + section.sizeOfRawData);
ObjectFileReader reader = new ObjectFileReader(sectionBytes, true);
reader.setPosition(virtualAddress - section.virtualAddress);
return reader;
}
use of com.oracle.truffle.llvm.parser.filereader.ObjectFileReader in project graal by oracle.
the class PEFile method create.
public static PEFile create(ByteSequence bytes) {
ObjectFileReader reader = new ObjectFileReader(bytes, true);
short machine = reader.getShort();
if (machine != IMAGE_DOS_SIGNATURE) {
throw new LLVMParserException("Invalid MS DOS file!");
}
reader.setPosition(OFFSET_TO_PE_SIGNATURE);
int peOffset = reader.getInt();
reader.setPosition(peOffset);
int reSignature = reader.getInt();
if (reSignature != IMAGE_NT_SIGNATURE) {
throw new LLVMParserException("No PE Signature found in MS DOS Executable!");
}
return new PEFile(CoffFile.create(bytes, reader));
}
use of com.oracle.truffle.llvm.parser.filereader.ObjectFileReader in project graal by oracle.
the class Xar method create.
public static Xar create(ByteSequence bytes) {
ObjectFileReader data = new ObjectFileReader(bytes, false);
// magic
data.getInt();
XarHeader header = XarHeader.create(data);
List<XarFile> files = TocParser.parse(data, header);
ByteSequence heap = data.slice();
return new Xar(header, files, heap);
}
use of com.oracle.truffle.llvm.parser.filereader.ObjectFileReader in project graal by oracle.
the class PEFile method loadImportData.
private void loadImportData() {
ObjectFileReader reader = getImportDataReader();
importData = reader == null ? null : ImageImportData.create(coffFile, reader);
}
Aggregations