[PATCH] D103824: [AIX] Build libLTO as MODULE rather than SHARED

David Tenty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 09:26:56 PDT 2021


daltenty created this revision.
Herald added subscribers: ormris, steven_wu, hiraditya, inglorion, mgorny.
daltenty requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103824

Files:
  llvm/tools/lto/CMakeLists.txt


Index: llvm/tools/lto/CMakeLists.txt
===================================================================
--- llvm/tools/lto/CMakeLists.txt
+++ llvm/tools/lto/CMakeLists.txt
@@ -21,7 +21,15 @@
 
 set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
 
-add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0" AND 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103824.350328.patch
Type: text/x-patch
Size: 754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210607/a27fe9af/attachment.bin>


More information about the llvm-commits mailing list