[cfe-dev] RFC: Only change libclang.so SONAME when the ABI changes

Tom Stellard via cfe-dev cfe-dev at lists.llvm.org
Mon Jun 28 16:00:59 PDT 2021


On 6/26/21 11:39 PM, Fāng-ruì Sòng wrote:
> On Sat, Jun 26, 2021 at 3:29 AM Dimitry Andric via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
>>
>> On 26 Jun 2021, at 06:04, Tom Stellard via cfe-dev <cfe-dev at lists.llvm.org> wrote:
>>>
>>> I would like to propose that we only change the SONAME of libclang.so
>>> (this is the library that contains the C API for clang) when the ABI changes.
>>> Currently, we change the SONAME whenever we bump the major version of LLVM,
>>> but the C API tends to not change that often.
>>>
>>> This change will allow operating system maintainers to update the version
>>> of libclang.so in their operating system without forcing rebuilds of
>>> all programs that depend on it.
>>>
>>> The steps for implementing this change would be:
>>>
>>> - Hard-code the SONAME for libclang.so to libclang.so.13 (which is the current
>>> SONAME).
>>> - Hard-code the symbol versions to LLVM_13 (which is the current symbol version)
>>>   for all existing symbols.
>>> - Add a test case that checks if a new symbol has been added and ensures it has
>>>   the correct symbol version.
>>> - Add a buildbot that uses abi-compliance-checker[1] to ensure that ABI/API does
>>>   not change unexpectedly.
>>> - The next time the ABI of libclang.so is changed, the SOANME will be updated to
>>>   libclang.so.$LLVM_MAJOR_VERSION.
>>>
>>> What do you think?
> 
> Is there an estimate how many packages use libclang.so ?
> 

In Fedora there are 12 packages that use libclang.so.

> Symbol versioning seems fine for Linux glibc and FreeBSD.
> 
>> This sounds like a good plan in general (not only for libclang :), but
>> how strict is this ABI check? Does *any* change (even like adding a new
>> function) trigger an ABI check error?
>>
>> E.g., what are the criteria for bumping the version?
>>
>> -Dimitry
> 
> Sounds fine for libclang.so. (For C++ libLLVM-13git.so and
> libclang-cpp.so, the ABI is changing very frequently, so I don't see
> we could avoid DT_SONAME bump.)
> 

Right, it only makes sense to do for a C library.

-Tom



More information about the cfe-dev mailing list