diff --git a/libclamav/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp index e69889ee5..9ab263b14 100644 --- a/libclamav/c++/bytecode2llvm.cpp +++ b/libclamav/c++/bytecode2llvm.cpp @@ -1451,6 +1451,11 @@ public: assert(inst->u.ops.funcid < cli_apicall_maxapi && "APICall out of range"); std::vector args; Function *DestF = apiFuncs[inst->u.ops.funcid]; + if (!strcmp(cli_apicalls[inst->u.ops.funcid].name, "engine_functionality_level")) { + Store(inst->dest, + ConstantInt::get(Type::getInt32Ty(Context), + cl_retflevel())); + } else { args.push_back(&*F->arg_begin()); // pass hidden arg for (unsigned a=0;au.ops.numOps;a++) { operand_t op = inst->u.ops.ops[a]; @@ -1459,6 +1464,7 @@ public: CallInst *CI = Builder.CreateCall(DestF, args.begin(), args.end()); CI->setDoesNotThrow(true); Store(inst->dest, CI); + } break; } case OP_BC_GEP1: @@ -2103,8 +2109,8 @@ int cli_bytecode_prepare_jit(struct cli_all_bc *bcs) // TODO: only run this on the untrusted bytecodes, not all of them... if (has_untrusted) PM.add(createClamBCRTChecks()); - PM.add(createCFGSimplificationPass()); PM.add(createSCCPPass()); + PM.add(createCFGSimplificationPass()); PM.add(createGlobalOptimizerPass()); PM.add(createConstantMergePass()); PM.add(new RuntimeLimits()); @@ -2121,8 +2127,9 @@ int cli_bytecode_prepare_jit(struct cli_all_bc *bcs) // compile all functions now, not lazily! for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { Function *Fn = &*I; - if (!Fn->isDeclaration()) + if (!Fn->isDeclaration()) { EE->getPointerToFunction(Fn); + } } codegenTimer.stopTimer(); }