diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp index 3815c79c1c..596c8d6ac1 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -1833,19 +1833,14 @@ HSAILProgram::linkImpl( binaries_to_link.push_back(bin); } - // At this stage each HSAILProgram in the list has an aclBinary initialized - // and contains LLVMIR - // We can now go ahead and link them. - if (binaries_to_link.size() > 1) { - errorCode = aclLink(dev().hsaCompiler(), - binaries_to_link[0], binaries_to_link.size() - 1, - &binaries_to_link[1], ACL_TYPE_LLVMIR_BINARY, "-create-library", NULL); - if (errorCode != ACL_SUCCESS) { - buildLog_ += aclGetCompilerLog(dev().hsaCompiler()); - buildLog_ +="Error while linking : \ - aclLink failed" ; - return false; - } + errorCode = aclLink(dev().hsaCompiler(), + binaries_to_link[0], binaries_to_link.size() - 1, + binaries_to_link.size() > 1 ? &binaries_to_link[1] : NULL, + ACL_TYPE_LLVMIR_BINARY, "-create-library", NULL); + if (errorCode != ACL_SUCCESS) { + buildLog_ += aclGetCompilerLog(dev().hsaCompiler()); + buildLog_ +="Error while linking : aclLink failed" ; + return false; } // Store the newly linked aclBinary for this program. binaryElf_ = binaries_to_link[0];