AVR: Support GNU attribute for vtable address spaces
Adds support for a GNU attribute to specify AVR vtable address spaces, improving ABI compatibility.
This commit introduces support for .gnu_attribute 4 (Tag_GNU_AVR_VTABLE_AS) for AVR targets. This allows C++ virtual tables to be placed in specific address spaces, which is crucial for upcoming support in G++ for ISO/IEC TR 18037 ‘Embedded C’ named address spaces. The new attribute helps detect ABI violations by tagging object files with information about the vtable address space used.
In Details
This change adds support for Tag_GNU_AVR_VTABLE_AS, a new GNU attribute, to the AVR toolchain. This attribute allows the compiler (via GCC's TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA hook) and linker to manage C++ virtual tables in non-default address spaces, such as __flash variants, instead of the generic RAM. This is essential for ABI compatibility with future G++ features handling ISO/IEC TR 18037 named address spaces. The attribute defines several values (NONE, RAM, FLASH variants, FLASHX) and specifies compatibility rules between them.
- AVR
- A family of microcontrollers manufactured by Atmel (now Microchip Technology). The binutils AVR backend supports these processors.
- .gnu_attribute
- An ELF section used to convey target-specific or ABI-specific information about an object file. Tag_GNU_AVR_VTABLE_AS is a new tag within this section.
- VTABLE_AS
- Abbreviation for Virtual Table Address Space. This refers to the memory region where C++ virtual function tables are stored.
- ABI
- Application Binary Interface. Defines how compiled code for a program should be run, including function calling conventions, data type representation, and ABI-specific extensions like address spaces.
- ISO/IEC TR 18037
- A technical report that extends the C programming language to support embedded systems, including features like named address spaces.
- ELF
- Executable and Linkable Format. A standard file format for object files, executables, and shared libraries on many Unix-like systems.