Search in sources :

Example 1 with TargetTriple

use of com.oracle.truffle.llvm.runtime.target.TargetTriple in project graal by oracle.

the class ParserDriver method verifyBitcodeSource.

private void verifyBitcodeSource(Source source, DataLayout targetDataLayout, TargetTriple targetTriple) {
    if (targetDataLayout.getByteOrder() != ByteOrder.LITTLE_ENDIAN) {
        throw new LLVMParserException("Byte order " + targetDataLayout.getByteOrder() + " of file " + source.getPath() + " is not supported");
    }
    boolean verifyBitcode = context.getEnv().getOptions().get(SulongEngineOption.VERIFY_BITCODE);
    TargetTriple defaultTargetTriple = language.getDefaultTargetTriple();
    if (defaultTargetTriple == null && !context.isInternalLibraryPath(Paths.get(source.getPath()))) {
        // some internal libraries (libsulong++) might be loaded before libsulong
        throw new IllegalStateException("No default target triple.");
    }
    if (defaultTargetTriple != null && targetTriple != null && !defaultTargetTriple.matches(targetTriple)) {
        TruffleLogger logger = TruffleLogger.getLogger(LLVMLanguage.ID, "BitcodeVerifier");
        String exceptionMessage = "Mismatching target triple (expected " + defaultTargetTriple + ", got " + targetTriple + ')';
        logger.severe(exceptionMessage);
        logger.severe("Source " + source.getPath());
        logger.severe("See https://www.graalvm.org/reference-manual/llvm/Compiling/ for more details");
        logger.severe("To silence this message, set --log." + logger.getName() + ".level=OFF");
        if (verifyBitcode) {
            logger.severe("To make this error non-fatal, set --" + SulongEngineOption.VERIFY_BITCODE_NAME + "=false");
            throw new LLVMParserException(exceptionMessage);
        }
    }
}
Also used : TruffleLogger(com.oracle.truffle.api.TruffleLogger) TargetTriple(com.oracle.truffle.llvm.runtime.target.TargetTriple) LLVMParserException(com.oracle.truffle.llvm.runtime.except.LLVMParserException)

Aggregations

TruffleLogger (com.oracle.truffle.api.TruffleLogger)1 LLVMParserException (com.oracle.truffle.llvm.runtime.except.LLVMParserException)1 TargetTriple (com.oracle.truffle.llvm.runtime.target.TargetTriple)1