AVR object files tagged with C++ virtual table address space.
AVR object files now indicate the address space used for C++ virtual tables.
This patch adds the .gnu_attribute 4 (Tag_GNU_AVR_VTABLE_AS) tag to AVR object files, indicating the address space used for C++ virtual tables. This tag will be valuable for future extensions that might support vtables in non-generic address spaces. The compiler identifies vtable usage by tracking indirect calls to vtable entries and checking for vtable declarations in the varpool.
In Details
This commit introduces .gnu_attribute Tag_GNU_AVR_VTABLE_AS to AVR object files. A new GIMPLE pass (avr_pass_has) detects indirect calls to vtable entries, and avr_file_end checks the varpool for vtable declarations. This information, currently supporting Val_GNU_AVR_VTABLE_NONE and Val_GNU_AVR_VTABLE_RAM, tags object files for future compiler/assembler extensions that may place vtables in custom address spaces.
- .gnu_attribute
- A section in an object file that contains GNU-specific attributes or metadata about the object. These attributes can convey information about the target architecture, compilation flags, or other characteristics.
- AVR
- A family of microcontrollers manufactured by Atmel (now Microchip Technology). GCC supports targeting these microcontrollers.
- vtables
- Virtual Method Tables. Data structures used in C++ for implementing dynamic dispatch, allowing objects to call the correct virtual function at runtime.
- address space
- A range of memory addresses that a processor can access. Embedded systems like AVR can have multiple address spaces (e.g., RAM, Flash, I/O registers).
- GIMPLE
- Generic Intermediate Representation for Many Expressions. A three-address intermediate representation used within GCC for performing optimizations.
- indirect call
- A function call where the target function's address is determined at runtime, typically by looking it up in a table (like a vtable) or reading it from a variable.