diff --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt deleted file mode 100644 --- a/clang/runtime/CMakeLists.txt +++ /dev/null @@ -1,168 +0,0 @@ -# TODO: Set the install directory. - -include(ExternalProject) - -set(known_subdirs - "libcxx" - ) - -foreach (dir ${known_subdirs}) - if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${dir}) - endif() -endforeach() - -function(get_ext_project_build_command out_var target) - if (CMAKE_GENERATOR MATCHES "Make") - # Use special command for Makefiles to support parallelism. - set(${out_var} "$(MAKE)" "${target}" PARENT_SCOPE) - else() - set(${out_var} ${CMAKE_COMMAND} --build . --target ${target} - --config $ PARENT_SCOPE) - endif() -endfunction() - -set(COMPILER_RT_SRC_ROOT ${LLVM_MAIN_SRC_DIR}/projects/compiler-rt) -# Fallback to the external path, if the other one isn't available. -# This is the same behavior (try "internal", then check the LLVM_EXTERNAL_... -# variable) as in add_llvm_external_project -if(NOT EXISTS ${COMPILER_RT_SRC_ROOT}) - # We don't want to set it if LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR is "" - if(LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR) - set(COMPILER_RT_SRC_ROOT ${LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR}) - endif() -endif() - -if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/) - - # Add compiler-rt as an external project. - set(COMPILER_RT_PREFIX ${CMAKE_BINARY_DIR}/projects/compiler-rt) - - set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/compiler-rt-stamps/) - set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/compiler-rt-bins/) - - add_custom_target(compiler-rt-clear - COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR} - COMMENT "Clobberring compiler-rt build and stamp directories" - ) - - # Find all variables that start with COMPILER_RT and populate a variable with - # them. - get_cmake_property(variableNames VARIABLES) - foreach(variableName ${variableNames}) - if(variableName MATCHES "^COMPILER_RT") - string(REPLACE ";" "\;" value "${${variableName}}") - list(APPEND COMPILER_RT_PASSTHROUGH_VARIABLES - -D${variableName}=${value}) - endif() - endforeach() - - set(compiler_rt_configure_deps) - if(TARGET cxx-headers) - list(APPEND compiler_rt_configure_deps "cxx-headers") - endif() - if(LLVM_INCLUDE_TESTS) - list(APPEND compiler_rt_configure_deps LLVMTestingSupport) - endif() - - ExternalProject_Add(compiler-rt - DEPENDS llvm-config clang ${compiler_rt_configure_deps} - PREFIX ${COMPILER_RT_PREFIX} - SOURCE_DIR ${COMPILER_RT_SRC_ROOT} - STAMP_DIR ${STAMP_DIR} - BINARY_DIR ${BINARY_DIR} - CMAKE_ARGS ${CLANG_COMPILER_RT_CMAKE_ARGS} - -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang - -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++ - -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} - -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config - -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS} - -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION} - -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR} - -DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} - -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} - -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_RUNTIME_OUTPUT_INTDIR} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} - -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT} - ${COMPILER_RT_PASSTHROUGH_VARIABLES} - INSTALL_COMMAND "" - STEP_TARGETS configure build - USES_TERMINAL_CONFIGURE 1 - USES_TERMINAL_BUILD 1 - USES_TERMINAL_INSTALL 1 - # Always run the build command so that incremental builds are correct. - BUILD_ALWAYS 1 - ) - - get_ext_project_build_command(run_clean_compiler_rt clean) - ExternalProject_Add_Step(compiler-rt clean - COMMAND ${run_clean_compiler_rt} - COMMENT "Cleaning compiler-rt..." - DEPENDEES configure - DEPENDERS build - DEPENDS clang - WORKING_DIRECTORY ${BINARY_DIR} - ) - - install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${BINARY_DIR}/cmake_install.cmake \)" - COMPONENT compiler-rt) - - add_llvm_install_targets(install-compiler-rt - DEPENDS compiler-rt - COMPONENT compiler-rt) - - # Add top-level targets that build specific compiler-rt runtimes. - set(COMPILER_RT_RUNTIMES fuzzer asan builtins dfsan lsan msan profile tsan ubsan ubsan-minimal) - foreach(runtime ${COMPILER_RT_RUNTIMES}) - get_ext_project_build_command(build_runtime_cmd ${runtime}) - add_custom_target(${runtime} - COMMAND ${build_runtime_cmd} - DEPENDS compiler-rt-configure - WORKING_DIRECTORY ${BINARY_DIR} - VERBATIM USES_TERMINAL) - endforeach() - - if(LLVM_INCLUDE_TESTS) - # Add binaries that compiler-rt tests depend on. - set(COMPILER_RT_TEST_DEPENDENCIES - FileCheck count not llvm-nm llvm-objdump llvm-symbolizer) - - # Add top-level targets for various compiler-rt test suites. - set(COMPILER_RT_TEST_SUITES check-fuzzer check-asan check-hwasan check-asan-dynamic check-dfsan - check-lsan check-msan check-sanitizer check-tsan check-ubsan check-ubsan-minimal - check-profile check-cfi check-cfi-and-supported check-safestack check-gwp_asan) - foreach(test_suite ${COMPILER_RT_TEST_SUITES}) - get_ext_project_build_command(run_test_suite ${test_suite}) - add_custom_target(${test_suite} - COMMAND ${run_test_suite} - DEPENDS compiler-rt-build ${COMPILER_RT_TEST_DEPENDENCIES} - WORKING_DIRECTORY ${BINARY_DIR} - VERBATIM - USES_TERMINAL - ) - endforeach() - - # Add special target to run all compiler-rt test suites. - get_ext_project_build_command(run_check_compiler_rt check-all) - add_custom_target(check-compiler-rt - COMMAND ${run_check_compiler_rt} - DEPENDS compiler-rt-build ${COMPILER_RT_TEST_DEPENDENCIES} - WORKING_DIRECTORY ${BINARY_DIR} - VERBATIM USES_TERMINAL) - - # Add special target to run all compiler-rt test suites. - get_ext_project_build_command(run_check_compiler_rt compiler-rt-test-depends) - add_custom_target(compiler-rt-test-depends - COMMAND ${run_check_compiler_rt} - DEPENDS compiler-rt-build ${COMPILER_RT_TEST_DEPENDENCIES} - WORKING_DIRECTORY ${BINARY_DIR} - VERBATIM USES_TERMINAL) - set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS compiler-rt-test-depends) - set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-compiler-rt) - endif() -endif() diff --git a/clang/runtime/compiler-rt/clang_linux_test_input.c b/clang/runtime/compiler-rt/clang_linux_test_input.c deleted file mode 100644 --- a/clang/runtime/compiler-rt/clang_linux_test_input.c +++ /dev/null @@ -1,4 +0,0 @@ -// This file is used to check if we can produce working executables -// for i386 and x86_64 archs on Linux. -#include -int main(){} diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -510,7 +510,7 @@ add_custom_target(${target_name} DEPENDS ${dst_file}) # Install in Clang resource directory. install(FILES ${file_name} - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share + DESTINATION share COMPONENT ${component}) add_dependencies(${component} ${target_name}) @@ -527,7 +527,7 @@ add_custom_target(${name} DEPENDS ${dst}) install(FILES ${dst} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin) + DESTINATION bin) endmacro(add_compiler_rt_script src name) # Builds custom version of libc++ and installs it in . diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake --- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake @@ -508,7 +508,7 @@ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded) set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded) + lib/macho_embedded) set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi") set(CFLAGS_i386 "-march=pentium") diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -386,7 +386,7 @@ function(get_compiler_rt_install_dir arch install_dir) if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) get_compiler_rt_target(${arch} target) - set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE) + set(${install_dir} lib/${target} PARENT_SCOPE) else() set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE) endif() diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake --- a/compiler-rt/cmake/base-config-ix.cmake +++ b/compiler-rt/cmake/base-config-ix.cmake @@ -92,12 +92,12 @@ set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR}) set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}) + "") else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) + lib/${COMPILER_RT_OS_DIR}) endif() if(APPLE) diff --git a/compiler-rt/include/CMakeLists.txt b/compiler-rt/include/CMakeLists.txt --- a/compiler-rt/include/CMakeLists.txt +++ b/compiler-rt/include/CMakeLists.txt @@ -69,22 +69,22 @@ install(FILES ${SANITIZER_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer) + DESTINATION include/sanitizer) # Install fuzzer headers. install(FILES ${FUZZER_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer) + DESTINATION include/fuzzer) # Install xray headers. install(FILES ${XRAY_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray) + DESTINATION include/xray) # Install profile headers. install(FILES ${PROFILE_HEADERS} COMPONENT compiler-rt-headers PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile) + DESTINATION include/profile) if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs. add_custom_target(install-compiler-rt-headers diff --git a/compiler-rt/lib/dfsan/CMakeLists.txt b/compiler-rt/lib/dfsan/CMakeLists.txt --- a/compiler-rt/lib/dfsan/CMakeLists.txt +++ b/compiler-rt/lib/dfsan/CMakeLists.txt @@ -62,4 +62,4 @@ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt) add_dependencies(dfsan dfsan_abilist) install(FILES ${dfsan_abilist_filename} - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share) + DESTINATION share) diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -1,6 +1,6 @@ # TODO: This file assumes the Clang toolchain so it'd be better if it lived in -# Clang, except there already is clang/runtime directory which contains -# similar although simpler functionality. We should figure out how to merge +# Clang, except there already is runtimes directory which contains +# similar functionality. We should figure out how to merge # the two files. # TODO: Selecting runtimes should be always performed inside the runtimes