This is an archive of the discontinued LLVM Phabricator instance.

cmake: Allow shared libraries to customize the soname using LLVM_ABI_REVISION
Needs ReviewPublic

Authored by tstellar on Jul 7 2021, 2:41 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

The LLVM_ABI_REVISION variable is intended to be used for release
candidates which introduce an ABI change to a shared library. This
variable can be specified per library, so there is not one global value
for all of LLVM.

For example, if we LLVM X.0.0-rc2 introduces an ABI change for a library
compared with LLVM X.0.0-rc1, then the LLVM_ABI_REVISION number for
library will be incremented by 1.

In the main branch, LLVM_ABI_REVISION should always be 0, it is only
meant to be used in the release branch.

Diff Detail

Event Timeline

tstellar created this revision.Jul 7 2021, 2:41 PM
tstellar requested review of this revision.Jul 7 2021, 2:41 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 7 2021, 2:41 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dim added a subscriber: dim.Jul 21 2021, 9:21 AM
dim added inline comments.
clang/tools/clang-shlib/CMakeLists.txt
5

Is this actually needed? This CMakeLists.txt calls add_clang_library() in clang/cmake/modules/AddClang.cmake, which calls add_llvm_library() in llvm/cmake/modules/AddLLVM.cmake, which calls the confusingly named llvm_add_library() in the same file. That last function is already updated below to set LLVM_ABI_REVISION to 0 is it is unset.

llvm/tools/llvm-shlib/CMakeLists.txt
9

Similar here, this CMakeLists.txt calls add_llvm_library which already sets the LLVM_ABI_REVISION to 0.

78

I think this is also handled via add_llvm_library/llvm_add_library?

serge-sans-paille added inline comments.
clang/tools/clang-shlib/CMakeLists.txt
2

This comment is a bit misleading: should it be for each RC *or* for each RC that implies an ABI change? And what about the (very rare) minor version release, like 11.1.0? My understanding is that they implie an SONAME bump, maybe that should be stated somewhere?

I think it would be great to have that ABI policy documented somewhere in the official doc, and not only as a cmake comment, as every project linking with clang or llvm is impacted.

llvm/cmake/modules/AddLLVM.cmake
595

Nit: strange indent.