Skip to content

Commit f3c9c6c

Browse files
authored
RuntimeLibcalls: Use get_host_tool_path for executables used in benchmark (#153955)
Copied from what the llvm-shlib build is doing. This reverts commit 0b1b567.
1 parent 38f2a1c commit f3c9c6c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

llvm/benchmarks/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,22 @@ add_benchmark(SandboxIRBench SandboxIRBench.cpp PARTIAL_SOURCES_INTENDED)
1414
add_benchmark(RuntimeLibcallsBench RuntimeLibcalls.cpp PARTIAL_SOURCES_INTENDED)
1515

1616

17+
# Extract the list of symbols in a random utility as sample data.
18+
set(SYMBOL_TEST_DATA_FILE "sample_symbol_list.txt")
19+
20+
get_host_tool_path(llvm-nm LLVM_NM llvm_nm_exe llvm_nm_target)
21+
get_host_tool_path(llc LLC llc_exe llc_target)
22+
set(SYMBOL_TEST_DATA_SOURCE_BINARY ${llc_exe})
23+
24+
add_custom_command(OUTPUT ${SYMBOL_TEST_DATA_FILE}
25+
COMMAND ${llvm_nm_exe} --no-demangle --no-sort
26+
--format=just-symbols
27+
${SYMBOL_TEST_DATA_SOURCE_BINARY} > ${SYMBOL_TEST_DATA_FILE}
28+
DEPENDS ${llvm_nm_target} ${llc_target})
29+
30+
add_custom_target(generate-runtime-libcalls-sample-symbol-list
31+
DEPENDS ${SYMBOL_TEST_DATA_FILE})
32+
33+
add_dependencies(RuntimeLibcallsBench generate-runtime-libcalls-sample-symbol-list)
34+
target_compile_definitions(RuntimeLibcallsBench PRIVATE
35+
-DSYMBOL_TEST_DATA_FILE="${CMAKE_CURRENT_BINARY_DIR}/${SYMBOL_TEST_DATA_FILE}")

0 commit comments

Comments
 (0)