ABI

How C array sizes become part of the binary interface of a library

How C array sizes become part of the binary interface of a library

Most C compilers allow accessing an array declared extern, which has indeterminate bounds, like this:

extern int external_array[];

int
array_get (long int index)
{
  return external_array[index];
}

The definition of external_array could reside in a different translation unit and look like this:

int external_array[3] = { 1, 2, 3 };

The question is what happens if this separate definition is changed to this:

int external_array[4] = { 1, 2, 3, 4 };

Or this:

int external_array[2] = { 1, 2 };

Does either change preserve the binary interface (assuming that there is a mechanism that allows the application to determine the size of the array at run time)?

Curiously, the answer is that on many architectures, increasing the array size breaks binary interface (ABI) compatibility. Decreasing the array size may also cause compatibility problems. We’ll look more closely at ABI compatibility in this article and explain how to avoid problems.

Continue reading “How C array sizes become part of the binary interface of a library”

Share
Changes made to the Libabigail ABI change analysis framework in 2018

Changes made to the Libabigail ABI change analysis framework in 2018

This article is for people interested in the long-term maintenance of software systems that expose application binary interfaces (a.k.a. ABIs) to other systems. That long-term maintenance involves detecting and analyzing inevitable changes in the ABIs and assessing whether these changes allow the maintained systems to stay compatible with the components with which they interact.

In this article, I describe what happened to the ABI change analysis framework that I worked on during 2018: the Abigail library (Libabigail) and its associated set of tools. The goal is not to list the myriad changes that happened throughout releases 1.2, 1.3, 1.4, and 1.5 that occurred during that year, but I will walk you through the main changes that happened and put them in perspective.

Continue reading “Changes made to the Libabigail ABI change analysis framework in 2018”

Share
Analyzing Changes to the Binary Interface Between the Linux Kernel and its Modules

Analyzing Changes to the Binary Interface Between the Linux Kernel and its Modules

This article is for people interested in long-term Linux kernel maintenance. It introduces you to tools that can help keep the binary interfaces between the kernel and its loadable modules stable during the entire lifetime of a supposedly stable kernel, while the code is modified. As these tools are essentially analysis tools, they can be used not only by kernel developers, but also by quality assurance engineers and advanced kernel users (system programmers).

Upstream in-tree kernel modules: the ideal situation

In the canonical development model of the Linux kernel, the source code of all dynamically loaded modules is hosted alongside the source code of the core kernel. In this model, whenever the core kernel changes the interface it exposes to its modules, the compilers detects that the interface changed, making it easy to adjust the code of the modules accordingly.

Continue reading “Analyzing Changes to the Binary Interface Between the Linux Kernel and its Modules”

Share

GCC 5 in Fedora

gnu logoFedora 22 will ship with GCC 5, which brings a whole host of enhancements, among which is a new default C++ ABI. In this article, we’ll cover how that ABI transition will work in Fedora.

Background – what’s an ABI, why is it changing, and what does this mean for developers?

Put simply, binary compatibility means applications that are compiled on a combination of an operating system and a particular hardware architecture will load and run similarly across different instances of the operating environment. Application binaries consist of executable files and Dynamic Shared Objects (DSOs – the formal name for shared libraries), and the level of compatibility is defined by a specific application binary interface (ABI).

Continue reading “GCC 5 in Fedora”

Share

Comparing ABIs for Compatibility with libabigail – Part 2

In the first article of this series of two, we ran abidiff to compare the ABIs of the libstdc++.so shared libraries from RHEL 6.5 and RHEL 7.  In this article, we are going to analyze the resulting ABI change report that was emitted.

circles

Analyzing the results

The report starts with a header that summarizes the ABI differences:

Functions changes summary: 0 Removed, 10 Changed (1260 filtered out), 112 Added functions
Variables changes summary: 0 Removed, 3 Changed (72 filtered out), 97 Added variables

From the:

Functions changes summary: 0 Removed,

and:

Variables changes summary: 0 Removed,

Continue reading “Comparing ABIs for Compatibility with libabigail – Part 2”

Share
Comparing ABIs for Compatibility with libabigail – Part 1

Comparing ABIs for Compatibility with libabigail – Part 1

Introduction:  The challenges around ABI compatibility

Ensuring the forward compatibility of application binary interfaces (ABIs) exposed by native shared libraries has been a kind of black art for quite some time, due to many factors.

circles

The scope of the term ABI is quite broad, even when it is restricted to shared software libraries. It encompasses low level concepts like the binary format, the processor instructions set used in the binary, the calling convention of the operating system on a given processor architecture, as well as higher level considerations like the layout and size of the data types used by the entry points of the library.

Continue reading “Comparing ABIs for Compatibility with libabigail – Part 1”

Share