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

Georg-Johann Lay avr@gjlay.de
Wed Sep 2 17:19:51 GMT 2026


Approved here: 
https://gcc.gnu.org/pipermail/gcc-patches/2026-September/729765.html

Am 21.08.26 um 15:55 schrieb Georg-Johann Lay via Binutils:
> 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 value of 0 is compatible with all other tag values.
> Two non-zero tag values are compatible iff they are the same.
> 
> Ok for trunk?
> 
> Johann
> 
> -- 
> 
>      PR ld/34557
> include/
>      * elf/avr.h (Tag_GNU_AVR_BITS_DOUBLE = 8)
>      (Tag_GNU_AVR_BITS_LONG_DOUBLE = 12): Define new enum values.
> bfd/
>      * elf32-avr.c (avr_elf_merge_obj_attributes): Support
>      Tag_GNU_AVR_BITS_DOUBLE, Tag_GNU_AVR_BITS_LONG_DOUBLE.
> binutils/
>      * readelf.c (display_avr_gnu_attribute): Support
>      Tag_GNU_AVR_BITS_DOUBLE, Tag_GNU_AVR_BITS_LONG_DOUBLE.
> gas/
>      * doc/as.texi (AVR Attributes): Document
>      Tag_GNU_AVR_BITS_DOUBLE, Tag_GNU_AVR_BITS_LONG_DOUBLE.
> ld/
>      * testsuite/ld-avr/attr-gnu-8-0.s: New file.
>      * testsuite/ld-avr/attr-gnu-8-32.s: New file.
>      * testsuite/ld-avr/attr-gnu-8-64.s: New file.
>      * testsuite/ld-avr/attr-gnu-8-32.d: New test.
>      * testsuite/ld-avr/attr-gnu-8-32_0.d: New test.
>      * testsuite/ld-avr/attr-gnu-8-32_64.d: New test.
>      * testsuite/ld-avr/attr-gnu-8_12.d: New test.
>      * testsuite/ld-avr/attr-gnu-12-0.s: New file.
>      * testsuite/ld-avr/attr-gnu-12-64.s: New file.
>      * testsuite/ld-avr/attr-gnu-12-32.s: New file.
>      * testsuite/ld-avr/attr-gnu-12-32.d: New test.
>      * testsuite/ld-avr/attr-gnu-12-32_0.d: New test.
>      * testsuite/ld-avr/attr-gnu-12-32_64.d: New test.



More information about the Binutils mailing list