This is an archive of the discontinued LLVM Phabricator instance.

[CMake][AIX] Adjust plugin library externsion used on AIX
ClosedPublic

Authored by Xiangling_L on Feb 8 2021, 10:25 AM.

Details

Summary

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).

Diff Detail

Event Timeline

Xiangling_L created this revision.Feb 8 2021, 10:25 AM
Xiangling_L requested review of this revision.Feb 8 2021, 10:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 8 2021, 10:25 AM
hubert.reinterpretcast edited the summary of this revision. (Show Details)Feb 8 2021, 3:06 PM
llvm/cmake/modules/HandleLLVMOptions.cmake
154–161

Update comment to encompass the block.

llvm/unittests/Support/DynamicLibrary/CMakeLists.txt
26
stevewan added inline comments.Feb 18 2021, 8:21 AM
llvm/cmake/modules/HandleLLVMOptions.cmake
156–158

My experiment (i.e., cmake --system-information) with cmake3.15.7 on an AIX7.2 machine shown that CMAKE_SHARED_LIBRARY_SUFFIX expanded to .so, am I missing part of the story?

Also, is CMAKE_SHARED_MODULE_SUFFIX a viable option here?

Xiangling_L added inline comments.Feb 18 2021, 10:40 AM
llvm/cmake/modules/HandleLLVMOptions.cmake
156–158

Yes, before cmake 3.16.0, they use .so as shared library suffix due to consistency with other platforms.

156–158

Yes, before 3.16.0 cmake implements shared library as .so on AIX due to consistency with other platforms. [https://gitlab.kitware.com/cmake/cmake/-/issues/19494] This issue explains more about why cmake is implementing shared library as .a archive library since cmake 3.16.0. In brief, typically in AIX system shared libraries are archive files. This makes it easier to provide updates to the system libraries with minimum impact to the applications.

So we'd like to take advantage of this cmake updates in this patch.

Regading CMAKE_SHARED_MODULE_SUFFIX, I think it's a viable option. It's better than hardcoding .so. Thanks.

Xiangling_L marked 2 inline comments as done.

Fix the regression on Linux;

Xiangling_L marked an inline comment as done.

minor: adjusted the comment;

daltenty accepted this revision.Mar 3 2021, 10:13 AM

LGTM, thanks!

This revision is now accepted and ready to land.Mar 3 2021, 10:13 AM
thakis added a subscriber: thakis.Mar 4 2021, 8:37 AM

what does LTDL_SHLIB_EXT expand to on aix?

thakis added a comment.Mar 4 2021, 8:39 AM

Or, asked differently, is it intentional that llvm/tools/bugpoint/ToolRunner.cpp still uses LTDL_SHLIB_EXT?

what does LTDL_SHLIB_EXT expand to on aix?

It depends on the cmake version you use. If <3.16.0, it's ".so" shared objects. If >= 3.16.0, it's ".a" archive file

Or, asked differently, is it intentional that llvm/tools/bugpoint/ToolRunner.cpp still uses LTDL_SHLIB_EXT?

We haven't encountered issues with this so far. And my understanding of MakeSharedObject is more like making a shared library, so LTDL_SHLIB_EXT is a good fit here for AIX.