Commit bad161c8 authored by Pierre Moreau's avatar Pierre Moreau Committed by Karol Herbst
Browse files

clover/api: Fail if trying to build a non-executable binary



From the OpenCL 1.2 Specification, Section 5.6.2 (about clBuildProgram):

> If program is created with clCreateProgramWithBinary, then the
> program binary must be an executable binary (not a compiled binary or
> library).
Reviewed-by: Aaron Watry's avatarAaron Watry <awatry@gmail.com>
Reviewed-by: Francisco Jerez's avatarFrancisco Jerez <currojerez@riseup.net>
parent 25d4e65e
......@@ -186,6 +186,13 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
if (prog.has_source) {
prog.compile(devs, opts);
prog.link(devs, opts, { prog });
} else if (any_of([&](const device &dev){
return prog.build(dev).binary_type() != CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
}, devs)) {
// According to the OpenCL 1.2 specification, “if program is created
// with clCreateProgramWithBinary, then the program binary must be an
// executable binary (not a compiled binary or library).”
throw error(CL_INVALID_BINARY);
}
return CL_SUCCESS;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment