binutils Newspaper
OCTOBER 6, 2026
avr — Proposed

AVR: Support .gnu_attribute to encode the size of [long] double

Adds .gnu_attribute support to binutils for AVR to encode double/long double sizes, enabling ABI compatibility checks.

This patch introduces support for .gnu_attribute tags (Tag_GNU_AVR_BITS_DOUBLE and Tag_GNU_AVR_BITS_LONG_DOUBLE) in binutils for the AVR architecture. This allows the compiler to encode the size of double and long double (32 or 64 bits) into object files. The linker can then use these attributes to detect and reject attempts to link object files with incompatible floating-point ABI settings, ensuring ABI consistency.

In the Thread 1 participant
  1. Georg-Johann Lay <avr@gjlay.de> proposer

    Adds new .gnu_attribute tags for AVR to encode double/long double sizes, enabling linker checks for ABI compatibility.

    “AVR GCC allows to chose the size of double and long double at compile time by means of -m[long-]double={32|64}. As these options select a different ABI, Binutils should complain when an attempt is being made to link incompatible object files. This patch adds .gnu_attribute 8 (Tag_GNU_AVR_BITS_DOUBLE) .gnu_attribute 12 (Tag_GNU_AVR_BITS_LONG_DOUBLE) and some simple test cases. A tag val…”

In Details

This change adds AVR-specific ELF .gnu_attribute support to binutils. The goal is to ensure link-time compatibility when the AVR GCC toolchain allows user selection of double and long double precision (32/64 bits), which implies different ABIs. Binutils will now record these choices in object files and enforce compatibility during linking.

For Context
.gnu_attribute
An ELF section that stores arbitrary metadata about the object file, often used by toolchains to convey information relevant to compilation, linking, or runtime behavior.
ABI
Application Binary Interface. Defines how compiled code interacts with the operating system and hardware, including function calling conventions and data type representations. Mismatched ABIs can lead to link errors or runtime crashes.
Tag_GNU_AVR_BITS_DOUBLE
A specific .gnu_attribute tag used to indicate the bit size of the 'double' floating-point type for AVR targets.
Tag_GNU_AVR_BITS_LONG_DOUBLE
A specific .gnu_attribute tag used to indicate the bit size of the 'long double' floating-point type for AVR targets.
Filed Under: avrelfattributesabilinker