Skip to content

Commit 6ce54aa

Browse files
committed
[libclc] link_bc target should depends on target builtins.link.clc-arch_suffix
Currently link_bc command depends on the bitcode file that is associated with custom target builtins.link.clc-arch_suffix. On windows we randomly see following error: ` Generating builtins.link.clc-${ARCH}--.bc Generating builtins.link.libspirv-${ARCH}.bc error : The requested operation cannot be performed on a file with a user-mapped section open. ` I suspect that builtins.link.clc-${ARCH}--.bc file is being generated while it is being used in link_bc. This PR adds target-level dependency to ensure builtins.link.clc-${ARCH}--.bc is generated first.
1 parent f5ee105 commit 6ce54aa

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

libclc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
413413
GEN_FILES ${opencl_gen_files}
414414
ALIASES ${${d}_aliases}
415415
# Link in the CLC builtins and internalize their symbols
416-
INTERNAL_LINK_DEPENDENCIES $<TARGET_PROPERTY:builtins.link.clc-${arch_suffix},TARGET_FILE>
416+
INTERNAL_LINK_DEPENDENCIES builtins.link.clc-${arch_suffix}
417417
)
418418
endforeach( d )
419419
endforeach( t )

libclc/cmake/modules/AddLibclc.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ endfunction()
211211
# * ALIASES <string> ...
212212
# List of aliases
213213
# * INTERNAL_LINK_DEPENDENCIES <string> ...
214-
# A list of extra bytecode files to link into the builtin library. Symbols
215-
# from these link dependencies will be internalized during linking.
214+
# A list of extra bytecode file's targets. The bitcode files will be linked
215+
# into the builtin library. Symbols from these link dependencies will be
216+
# internalized during linking.
216217
function(add_libclc_builtin_set)
217218
cmake_parse_arguments(ARG
218219
"CLC_INTERNAL"
@@ -313,8 +314,8 @@ function(add_libclc_builtin_set)
313314
INTERNALIZE
314315
TARGET ${builtins_link_lib_tgt}
315316
INPUTS $<TARGET_PROPERTY:${builtins_link_lib_tmp_tgt},TARGET_FILE>
316-
${ARG_INTERNAL_LINK_DEPENDENCIES}
317-
DEPENDENCIES ${builtins_link_lib_tmp_tgt}
317+
$<TARGET_PROPERTY:${ARG_INTERNAL_LINK_DEPENDENCIES},TARGET_FILE>
318+
DEPENDENCIES ${builtins_link_lib_tmp_tgt} ${ARG_INTERNAL_LINK_DEPENDENCIES}
318319
)
319320
endif()
320321

0 commit comments

Comments
 (0)