AVR: Linker supports .gnu_attribute for double/long double sizes.
AVR linker now supports .gnu_attribute to encode double/long double sizes, preventing linking of incompatible object files.
This change adds support for the .gnu_attribute tags Tag_GNU_AVR_BITS_DOUBLE and Tag_GNU_AVR_BITS_LONG_DOUBLE in the AVR toolchain. This allows the linker to detect and report errors when attempting to link object files compiled with different sizes for double or long double, ensuring ABI compatibility.
In Details
The AVR architecture allows compile-time selection of double-precision floating-point sizes using -m[long-]double={32|64}. This commit introduces support for ELF .gnu_attribute tags (8 and 12) to encode these choices. The BFD linker's avr_elf_merge_obj_attributes function now merges these attributes, and readelf can display them, preventing linking of object files with incompatible floating-point ABIs.
- .gnu_attribute
- An ELF section used for storing platform-specific or ABI-related information about an object file. Toolchains use these attributes to convey important compatibility or feature information.
- ABI
- Application Binary Interface. Defines how low-level details of a program are handled, including function calling conventions, data type sizes, and memory layout. Incompatible ABIs between object files prevent them from being linked together correctly.
- Tag_GNU_AVR_BITS_DOUBLE
- A specific GNU attribute tag used in ELF files for the AVR architecture to encode the size of the
doublefloating-point type. - Tag_GNU_AVR_BITS_LONG_DOUBLE
- A specific GNU attribute tag used in ELF files for the AVR architecture to encode the size of the
long doublefloating-point type.