diff --git a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake --- a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake @@ -24,7 +24,7 @@ endif() endfunction() -macro(archive_aix_libatomic name) +macro(archive_aix_libatomic name libname) cmake_parse_arguments(LIB "" "" @@ -33,7 +33,7 @@ set(objects_to_archive "") foreach (arch ${LIB_ARCHS}) if(CAN_TARGET_${arch}) - set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/libatomic-${arch}.dir") + set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/${libname}-${arch}.dir") # FIXME: Target name should be kept consistent with definition # in AddCompilerRT.cmake added by # add_compiler_rt_runtime( SHARED ...) @@ -67,14 +67,14 @@ get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} output_dir) get_compiler_rt_install_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} install_dir) endif() - add_custom_command(OUTPUT "${output_dir}/libatomic.a" - COMMAND ${CMAKE_AR} -X32_64 r "${output_dir}/libatomic.a" + add_custom_command(OUTPUT "${output_dir}/${libname}.a" + COMMAND ${CMAKE_AR} -X32_64 r "${output_dir}/${libname}.a" ${objects_to_archive} DEPENDS ${objects_to_archive}) - install(FILES "${output_dir}/libatomic.a" + install(FILES "${output_dir}/${libname}.a" DESTINATION ${install_dir}) - add_custom_target(aix-libatomic - DEPENDS "${output_dir}/libatomic.a") + add_custom_target(aix-${libname} + DEPENDS "${output_dir}/${libname}.a") endif() - add_dependencies(${LIB_PARENT_TARGET} aix-libatomic) + add_dependencies(${LIB_PARENT_TARGET} aix-${libname}) endmacro() diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -803,7 +803,7 @@ # archive, i.e., libatomic.a. Once cmake adds support of such usage for AIX, # this ad-hoc part can be removed. if(${CMAKE_SYSTEM_NAME} MATCHES "AIX") - archive_aix_libatomic(clang_rt.atomic + archive_aix_libatomic(clang_rt.atomic libatomic ARCHS ${BUILTIN_SUPPORTED_ARCH} PARENT_TARGET builtins-standalone-atomic) endif()