Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LIBCLC] Modify libclc-remangler cmds for cross-compile support #16182

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libclc/cmake/modules/AddLibclc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ function(add_libclc_builtin_set)
"${LIBCLC_LIBRARY_OUTPUT_INTDIR}/remangled-${long_width}-${signedness}_char.${obj_suffix_mangled}" )
add_custom_command( OUTPUT "${builtins_remangle_path}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBCLC_LIBRARY_OUTPUT_INTDIR}
COMMAND libclc::libclc-remangler
COMMAND ${LIBCLC_REMANGLER_PATH}
-o "${builtins_remangle_path}"
--long-width=${long_width}
--char-signedness=${signedness}
Expand Down Expand Up @@ -489,7 +489,7 @@ function(add_libclc_builtin_set)
math(EXPR libclc-remangler-test-no "${libclc-remangler-test-no}+1")
set(current-test "libclc-remangler-test-${obj_suffix}-${libclc-remangler-test-no}")
add_custom_target(${current-test}
COMMAND libclc::libclc-remangler
COMMAND ${LIBCLC_REMANGLER_PATH}
--long-width=l32
--char-signedness=signed
--input-ir=${target-ir}
Expand Down
18 changes: 18 additions & 0 deletions libclc/utils/libclc-remangler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ clang_target_link_libraries(libclc-remangler
LLVMOption
)

if(CMAKE_CROSSCOMPILING)
if(LLVM_NATIVE_TOOL_DIR AND NOT LIBCLC_REMANGLER_PATH)
if(EXISTS "${LLVM_NATIVE_TOOL_DIR}/libclc-remangler${LLVM_HOST_EXECUTABLE_SUFFIX}")
set(LLVM_CONFIG_PATH "${LLVM_NATIVE_TOOL_DIR}/libclc-remangler${LLVM_HOST_EXECUTABLE_SUFFIX}")
endif()
endif()

if(NOT LIBCLC_REMANGLER_PATH)
build_native_tool(libclc-remangler LIBCLC_REMANGLER_PATH)
set(LIBCLC_REMANGLER_PATH "${LIBCLC_REMANGLER_PATH}" CACHE STRING "")

add_custom_target(NativeLibCLCRemangler DEPENDS ${LIBCLC_REMANGLER_PATH})
add_dependencies(libclc-remangler NativeLibCLCRemangler)
endif()
else()
set(LIBCLC_REMANGLER_PATH "${CMAKE_CURRENT_BINARY_DIR}/bin/libclc-remangler" CACHE STRING "")
endif()

# If we've not already imported a libclc-remangler tool from an external build,
# set it up now.
if(NOT TARGET libclc::libclc-remangler)
Expand Down