[llvm] 75d4f55 - [AIX] Build libLTO as MODULE rather than SHARED

David Tenty via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 09:09:59 PDT 2021


Author: David Tenty
Date: 2021-06-10T12:08:59-04:00
New Revision: 75d4f55d150cd3d38797ec228fc871bed93b8540

URL: https://github.com/llvm/llvm-project/commit/75d4f55d150cd3d38797ec228fc871bed93b8540
DIFF: https://github.com/llvm/llvm-project/commit/75d4f55d150cd3d38797ec228fc871bed93b8540.diff

LOG: [AIX] Build libLTO as MODULE rather than SHARED

On CMake versions greater that >= 3.16 on AIX, shared libraries are
created as archives (which is the normal form for the platform). However
plugins libraries which are passed directly to a executable, like
libLTO to the linker, are usual build as plain `.so`, so this patch
restores this behaviour for libLTO on AIX (and adjust the name if need be
to account for the fact that llvm_add_library likes to force an empty
name prefix on modules), so we end up with the expected libLTO.so

Reviewed By: w2yehia

Differential Revision: https://reviews.llvm.org/D103824

Added: 
    

Modified: 
    llvm/tools/lto/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/tools/lto/CMakeLists.txt b/llvm/tools/lto/CMakeLists.txt
index 2963f97cad887..0af29ad762c55 100644
--- a/llvm/tools/lto/CMakeLists.txt
+++ b/llvm/tools/lto/CMakeLists.txt
@@ -21,8 +21,16 @@ set(SOURCES
 
 set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
 
-add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
-    intrinsics_gen)
+if(CMAKE_SYSTEM_NAME STREQUAL AIX)
+    set(LTO_LIBRARY_TYPE MODULE)
+    set(LTO_LIBRARY_NAME libLTO)
+  else()
+    set(LTO_LIBRARY_TYPE SHARED)
+    set(LTO_LIBRARY_NAME LTO)
+endif()
+
+add_llvm_library(${LTO_LIBRARY_NAME} ${LTO_LIBRARY_TYPE} INSTALL_WITH_TOOLCHAIN
+    ${SOURCES} DEPENDS intrinsics_gen)
 
 install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
   DESTINATION include/llvm-c


        


More information about the llvm-commits mailing list