https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116056
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Georg-Johann Lay <g...@gcc.gnu.org>: https://gcc.gnu.org/g:0f1de0c4ce6eb237128d8f6439c2434aded1f51a commit r15-2367-g0f1de0c4ce6eb237128d8f6439c2434aded1f51a Author: Georg-Johann Lay <a...@gjlay.de> Date: Wed Jul 24 08:37:43 2024 +0200 AVR target 116056 - Support attribute signal(n), interrupt(n) and noblock. This patch adds support for arguments to the signal and interrupt function attributes. It allows to specify the ISR by means of the associated IRQ number, in extension to the current attributes that require to specify the ISR name like "__vector_1" as (assembly) name for the function. The new feature is more convenient, e.g. when the ISR is implemented by a class method or in a namespace. There is no requirement that the ISR is externally visible. The syntax is like: __attribute__((signal(1, 2, ...), signal(3, 4, ...))) [static] void isr_function (void) { // Code } Moreover, this patch adds support for the "noblock" function attribute to let an ISR start with a SEI instruction. Attribute "signal" together with "noblock" behaves like "interrupt" but without imposing a specific function name or visibility like "interrupt" does. PR target/116056 gcc/ * config/avr/avr.h (machine_function) <is_noblock>: New field. * config/avr/avr-c.cc (avr_cpu_cpp_builtins) <__HAVE_SIGNAL_N__>: New built-in macro. * config/avr/avr.cc (avr_declare_function_name): New function. (avr_attribute_table) <noblock>: New function attribute>. <signal, interrupt>: Allow any number of args. (avr_insert_attributes): Check validity of "signal" and "interrupt" arguments. (avr_foreach_function_attribute, avr_interrupt_signal_function) (avr_isr_number, avr_asm_isr_alias, avr_handle_isr_attribute) (avr_noblock_function_p): New static functions. (avr_interrupt_function): New from avr_interrupt_function_p. Adjust callers. (avr_signal_function): New from avr_signal_function_p. Adjust callers. (avr_set_current_function): Only diagnose non-__vector ISR names when "signal" or "interrupt" attribute has no args. Set cfun->machine->is_noblock. Warn about "noblock" in non-ISR functions. (struct avr_fun_cookie): New. (avr_expand_prologue, avr_asm_function_end_prologue): Handle "noblock". * config/avr/elf.h (ASM_DECLARE_FUNCTION_NAME): New define. * config/avr/avr-protos.h (avr_declare_function_name): New proto. * doc/extend.texi (AVR Function Attributes): Document signal(num) and interrupt(num). * doc/invoke.texi (AVR Built-in Macros) <__HAVE_SIGNAL_N__>: Document. gcc/testsuite/ * gcc.target/avr/torture/signal_n-1.c: New test. * gcc.target/avr/torture/signal_n-2.c: New test. * gcc.target/avr/torture/signal_n-3.c: New test. * gcc.target/avr/torture/signal_n-4.cpp: New test.