llvm.org GIT mirror llvm / 2bed43d
[CMake] Replace the sanitizer support in runtimes build with multilib This is a more generic solution; while the sanitizer support can be used only for sanitizer instrumented builds, the multilib support can be used to build other variants such as noexcept which is what we would like to use in Fuchsia. The name CMake target name uses the target name, same as for the regular runtimes build and the name of the multilib, concatenated with '+'. The libraries are installed in a subdirectory named after the multilib. Differential Revision: https://reviews.llvm.org/D60926 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358935 91177308-0d34-0410-b5e6-96231b3b80d8 Petr Hosek 4 months ago
1 changed file(s) with 17 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
6969 get_compiler_rt_path(compiler_rt_path)
7070 if(compiler_rt_path)
7171 list(REMOVE_ITEM runtimes ${compiler_rt_path})
72 if(NOT LLVM_BUILD_COMPILER_RT)
72 if(NOT DEFINED LLVM_BUILD_COMPILER_RT OR LLVM_BUILD_COMPILER_RT)
7373 list(INSERT runtimes 0 ${compiler_rt_path})
7474 endif()
7575 endif()
241241
242242 get_cmake_property(variableNames VARIABLES)
243243 foreach(variableName ${variableNames})
244 if(variableName MATCHES "^BUILTINS_${target}")
244 string(FIND "${variableName}" "BUILTINS_${target}" out)
245 if("${out}" EQUAL 0)
245246 string(REPLACE "BUILTINS_${target}_" "" new_name ${variableName})
246247 list(APPEND ${target}_extra_args "-D${new_name}=${${variableName}}")
247248 endif()
424425
425426 get_cmake_property(variableNames VARIABLES)
426427 foreach(variableName ${variableNames})
427 if(variableName MATCHES "^RUNTIMES_${name}")
428 string(FIND "${variableName}" "RUNTIMES_${name}_" out)
429 if("${out}" EQUAL 0)
428430 string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName})
429431 list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
430 elseif(variableName MATCHES "^RUNTIMES_${target}")
432 endif()
433 string(FIND "${variableName}" "RUNTIMES_${target}_" out)
434 if("${out}" EQUAL 0)
431435 string(REPLACE "RUNTIMES_${target}_" "" new_name ${variableName})
432436 list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
433437 endif()
509513 endif()
510514 endforeach()
511515
512 foreach(sanitizer ${LLVM_RUNTIME_SANITIZERS})
513 if (sanitizer STREQUAL "Address")
514 set(sanitizer_name "asan")
515 elseif (sanitizer STREQUAL "Memory")
516 set(sanitizer_name "msan")
517 elseif (sanitizer STREQUAL "Thread")
518 set(sanitizer_name "tsan")
519 elseif (sanitizer STREQUAL "Undefined")
520 set(sanitizer_name "ubsan")
521 else()
522 message(FATAL_ERROR "Unsupported value of LLVM_RUNTIME_TARGET_SANITIZERS: ${sanitizers}")
523 endif()
524 foreach(name ${LLVM_RUNTIME_SANITIZER_${sanitizer}_TARGETS})
525 runtime_register_target(${name}-${sanitizer_name} ${name}
516 foreach(multilib ${LLVM_RUNTIME_MULTILIBS})
517 foreach(name ${LLVM_RUNTIME_MULTILIB_${multilib}_TARGETS})
518 runtime_register_target(${name}+${multilib} ${name}
526519 DEPENDS runtimes-${name}
527 CMAKE_ARGS -DLLVM_USE_SANITIZER=${sanitizer}
528 -DLLVM_RUNTIMES_PREFIX=${name}/
529 -DLLVM_RUNTIMES_LIBDIR_SUFFIX=/${sanitizer_name})
530 add_dependencies(runtimes runtimes-${name}-${sanitizer_name})
531 add_dependencies(runtimes-configure runtimes-${name}-${sanitizer_name}-configure)
532 add_dependencies(install-runtimes install-runtimes-${name}-${sanitizer_name})
533 add_dependencies(install-runtimes-stripped install-runtimes-${name}-${sanitizer_name}-stripped)
520 CMAKE_ARGS -DLLVM_RUNTIMES_PREFIX=${name}/
521 -DLLVM_RUNTIMES_LIBDIR_SUFFIX=/${multilib})
522 add_dependencies(runtimes runtimes-${name}+${multilib})
523 add_dependencies(runtimes-configure runtimes-${name}+${multilib}-configure)
524 add_dependencies(install-runtimes install-runtimes-${name}+${multilib})
525 add_dependencies(install-runtimes-stripped install-runtimes-${name}+${multilib}-stripped)
534526 endforeach()
535527 endforeach()
536528 endif()