Skip to content

Commit

Permalink
Fix race condition in ddprof.o generation (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsavoire committed May 17, 2023
1 parent 6a00eee commit 524be01
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ add_custom_command(
COMMAND objcopy --rename-section .data=.rodata,alloc,load,readonly,data,contents
${DDPROF_EXE_OBJECT}
DEPENDS ddprof)
# add_custom_target is required here, because multiple targets depend on ${DDPROF_EXE_OBJECT}
# Without add_custom_target (only add_custom_command), each dependent target will run the custom
# command and they will race, leading to spurious failures.
add_custom_target(generate_ddprof_object DEPENDS ${DDPROF_EXE_OBJECT})

add_library(ddprof_exe_object OBJECT IMPORTED GLOBAL)
set_target_properties(ddprof_exe_object PROPERTIES IMPORTED_OBJECTS "${DDPROF_EXE_OBJECT}")
Expand Down

0 comments on commit 524be01

Please sign in to comment.