From eb3730cf89950bdae6f86409558c52a8bab62df6 Mon Sep 17 00:00:00 2001 From: Kai Luo Date: Mon, 28 Feb 2022 02:27:26 +0000 Subject: [PATCH] [AIX][cmake][NFC] Customize name of output atomic library Let `archive-aix-libatomic` accept additional argument to customize name of output atomic library. Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D120534 --- .../cmake/Modules/CompilerRTAIXUtils.cmake | 16 ++++++++-------- compiler-rt/lib/builtins/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake index b35ff2b86568..0e131d0ba74c 100644 --- a/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake @@ -24,7 +24,7 @@ function(get_aix_libatomic_type type) endif() endfunction() -macro(archive_aix_libatomic name) +macro(archive_aix_libatomic name libname) cmake_parse_arguments(LIB "" "" @@ -33,7 +33,7 @@ macro(archive_aix_libatomic name) 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 @@ macro(archive_aix_libatomic name) 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 index ea5ad9cdb864..d9c317e2a1e4 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -803,7 +803,7 @@ if(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC) # 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()