Search code examples
c++cabi

What is the extended option in abi-compliance-checker used for?


abi-compliance-checker is a perl program that can check ABI of libraries on linux (https://lvc.github.io/abi-compliance-checker/)

The tool has a -extended option, and here is what the manual says about it:

If your library A is supposed to be used by other library B and you want to control the ABI of B, then you should enable this option. The tool will check for changes in all data types, even if they are not used by any function in the library A. Such data types are not part of the A library ABI, but may be a part of the ABI of the B library. The short scheme is: app C (broken) -> lib B (broken ABI) -> lib A (stable ABI)

Even after trying checking ABI with and without the option, I still don't really understand the meaning option and how it changes the results I get.

Here is a snippet of the results I have without the option:

Test Results
Total Header Files  177
Total Libraries 1
Total Symbols / Types   96 / 57
Compatibility   100%

Added Symbols  1 
demangle.h, libtoolbox.so.16.0.0.27
namespace mdw
demangle ( std::__cxx11::string const& iMangledString )

Problems with Symbols, Low Severity  1 
BufferMgr.h
namespace toolbox
[+] kDefaultMaxBufferSize [data]  1 

And here are the results with the option activated:

Test Results
Total Header Files  177
Total Symbols / Types   158 / 375
Compatibility   99.8%

Added Symbols  2 
demangle.h
namespace mdw
demangle ( std::__cxx11::string const& iMangledString )

StaticInit.h
namespace toolbox
_SymbolDefinedInStaticInitOnly_StaticInit ( )

Removed Symbols  1 
StaticInit.h
namespace toolbox
_SymbolDefinedInStaticInitOnly ( )

Problems with Symbols, Low Severity  1 
BufferMgr.h
namespace toolbox
[+] kDefaultMaxBufferSize [data]  1 

Is anyone able to explain what this option means, and what the differences in the output mean from an ABI standpoint?


Solution

  • By default the tool checks data types that are used (as parameter, return value or field of parameter or return value, etc.) by exported symbols of the analyzed binary. Unused data types are not checked by default. In -extended mode the tool will check all data types including unused.

    In your example I see that the number of checked symbols is different in the extended mode, but it should be the same according to the description of the option. Detection of added/removed _SymbolDefinedInStaticInitOnly* looks like a regression bug in the tool for me.

    For now, the -extended option enables the -headers-only option implicitly, that enables analysis of all inline symbols in headers. I think we should not enable -headers-only option in this case.

    Looks like -extended option doesn't work as expected for now. We need to fix it.