[PATCH] D145827: [cmake] Quote args when generating /libpath option specifying runtime dir for link/lld-link
Matthew Voss via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 10 13:35:00 PST 2023
ormris created this revision.
ormris added reviewers: smeenai, mstorsjo, ychen.
Herald added a project: All.
ormris requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When the runtime dir path includes whitespace (ex. when it's installed under "Program Files" on Windows), the lack of quotes causes the linker to interpret the path as one or more arguments. None of these path fragments exist, so the link fails.
https://reviews.llvm.org/D145827
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1102,7 +1102,7 @@
endif()
file(TO_CMAKE_PATH "${clang_compiler_rt_file}" clang_compiler_rt_file)
get_filename_component(clang_runtime_dir "${clang_compiler_rt_file}" DIRECTORY)
- append("/libpath:${clang_runtime_dir}"
+ append("/libpath:\"${clang_runtime_dir}\""
CMAKE_EXE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145827.504265.patch
Type: text/x-patch
Size: 581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230310/0fe9957b/attachment.bin>
More information about the llvm-commits
mailing list