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

Georg-Johann Lay avr@gjlay.de
Fri Aug 21 13:55:14 GMT 2026


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-attr-double.diff
Type: text/x-patch
Size: 12114 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260821/d49c81cb/attachment.bin>


More information about the Binutils mailing list