1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[CMake][AIX] Adjust plugin library extension used on AIX

As stated in the CMake manual, we are supposed to use MODULE rules to generate
plugin libraries:

"MODULE libraries are plugins that are not linked into other targets but may be
loaded dynamically at runtime using dlopen-like functionality"

Besides, LLVM's plugin infrastructure fits with the AIX treatment of .so
shared objects more than it fits with the AIX treatment of .a library archives
(which may contain shared objects).

Differential revision: https://reviews.llvm.org/D96282
This commit is contained in:
Xiangling Liao 2021-03-04 09:52:04 -05:00
parent d0cee0b290
commit 67363ad920
4 changed files with 14 additions and 7 deletions

View File

@ -152,8 +152,12 @@ endif()
set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
# We use *.dylib rather than *.so on darwin.
set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
# We use *.dylib rather than *.so on darwin, but we stick with *.so on AIX.
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_MODULE_SUFFIX})
else()
set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
if(APPLE)
if(LLVM_ENABLE_LLD AND LLVM_ENABLE_LTO)

View File

@ -317,6 +317,9 @@
/* Define to the extension used for shared libraries, say, ".so". */
#cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}"
/* Define to the extension used for plugin libraries, say, ".so". */
#cmakedefine LLVM_PLUGIN_EXT "${LLVM_PLUGIN_EXT}"
/* Define to the address where bug reports for this package should be sent. */
#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}"

View File

@ -22,7 +22,7 @@ target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
export_executable_symbols(DynamicLibraryTests)
function(dynlib_add_module NAME)
add_library(${NAME} SHARED
add_library(${NAME} MODULE
PipSqueak.cpp
)
set_target_properties(${NAME} PROPERTIES FOLDER "Tests")
@ -34,7 +34,7 @@ function(dynlib_add_module NAME)
set_target_properties(${NAME}
PROPERTIES PREFIX ""
SUFFIX ${LTDL_SHLIB_EXT}
SUFFIX ${LLVM_PLUGIN_EXT}
)
add_dependencies(DynamicLibraryTests ${NAME})
@ -54,8 +54,8 @@ endfunction(dynlib_add_module)
# Revert -Wl,-z,nodelete on this test since it relies on the file
# being unloaded.
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
string(REPLACE "-Wl,-z,nodelete" "" CMAKE_SHARED_LINKER_FLAGS
${CMAKE_SHARED_LINKER_FLAGS})
string(REPLACE "-Wl,-z,nodelete" "" CMAKE_MODULE_LINKER_FLAGS
${CMAKE_MODULE_LINKER_FLAGS})
endif()
dynlib_add_module(PipSqueak)

View File

@ -26,7 +26,7 @@ std::string LibPath(const std::string Name = "PipSqueak") {
void *Ptr = (void*)(intptr_t)TestA;
std::string Path = fs::getMainExecutable(Argv0, Ptr);
llvm::SmallString<256> Buf(path::parent_path(Path));
path::append(Buf, (Name + LTDL_SHLIB_EXT).c_str());
path::append(Buf, (Name + LLVM_PLUGIN_EXT).c_str());
return std::string(Buf.str());
}