Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static analysis tool to detect ABI breaks in C++ [closed]

It's not very hard to break binary backwards-compatibility of a DSO/shared library with a C++ interface. That said, is there a static analysis tool, which can help detecting such ABI breaks, if it's given two different sets of header files: those of an earlier state of the DSO and those of the current state (and maybe DSOs as well)? Both free and commercial product suggestions are welcome.

If it could also warn about bad practices, e.g. inline functions and defaulted function parameters in DSO interfaces, it would be great.

like image 527
okun Avatar asked Dec 28 '09 15:12

okun


People also ask

How do you detect ABI?

A technician takes your blood pressure in both of your arms using an inflatable cuff, similar to the one used in the doctor's office. The technician also measures the blood pressure in the ankles. The doctor uses these values to compute your ABI.

What is ABI breaking?

For the standard library the primary issues causing potential ABI breakage are those which change the layout of a class or a class template or the changing the behavior of typically inlined functions.

Is C++ ABI stable?

So does C++ have a stable ABI or not? Nope. It's implementation defined.


2 Answers

abi-compliance-checker - a tool for checking backward binary/source-level compatibility of a shared C/C++ library (DSO):

A tool for checking backward binary and source-level compatibility of a C/C++ library. The tool checks header files and shared libraries of old and new versions and analyzes changes in API and ABI (ABI=API+compiler ABI) that may break binary and/or source compatibility: changes in calling stack, v-table changes, removed symbols, renamed fields, etc.

enter image description here

icheck - C interface ABI/API checker:

A tool for statically checking C interfaces for API and ABI changes. All changes to type declarations that can cause ABI changes should be detected, along with most API changes. icheck is intended for use with libraries, as a method of preventing ABI drift.

shlib-compat - ABI compatibility checker for shared libraries with symbol versioning:

shlib-compat uses dwarf debugging symbols to recreate and compare definitions of exported symbols, including function arguments and structural types.

Also you might be interested in the linux upstream tracker and linux abi tracker services. They are both powered by the abi-compliance-checker tool.

like image 185
linuxbuild Avatar answered Oct 10 '22 05:10

linuxbuild


I assume that you are familiar with this tutorial: Binary Compatibility Issues with C++, if not read it!

I've heard about this tool: http://ispras.linuxbase.org/index.php/ABI_compliance_checker, however never tested or used one, so have no opinion.

Also this may interest you: Creating Library with backward compatible ABI that uses Boost

like image 23
Artyom Avatar answered Oct 10 '22 07:10

Artyom