https://gcc.gnu.org/g:b474553983c54b7c71ca3b4b4c22869e24395892
commit r17-1959-gb474553983c54b7c71ca3b4b4c22869e24395892 Author: Olivier Hainque <[email protected]> Date: Sun Jun 14 08:18:35 2026 +0000 ada: Add missing interrupt state guards in __gnat_install_handler for Android For non tasking programs, the Android ports currently fail to account for pragma Interrupt_State on various signals. gcc/ada/ChangeLog: * init.c (__gnat_install_handler, __ANDROID__): Guard calls to sigaction with a test for a possible 's' (System) interrupt state. Diff: --- gcc/ada/init.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 551d4b1a94c7..31a8f7811788 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -2943,12 +2943,21 @@ __gnat_install_handler (void) act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; sigemptyset (&act.sa_mask); - sigaction (SIGABRT, &act, NULL); - sigaction (SIGFPE, &act, NULL); - sigaction (SIGILL, &act, NULL); - sigaction (SIGBUS, &act, NULL); + if (__gnat_get_interrupt_state (SIGABRT) != 's') + sigaction (SIGABRT, &act, NULL); + + if (__gnat_get_interrupt_state (SIGFPE) != 's') + sigaction (SIGFPE, &act, NULL); + + if (__gnat_get_interrupt_state (SIGILL) != 's') + sigaction (SIGILL, &act, NULL); + + if (__gnat_get_interrupt_state (SIGBUS) != 's') + sigaction (SIGBUS, &act, NULL); + act.sa_flags |= SA_ONSTACK; - sigaction (SIGSEGV, &act, NULL); + if (__gnat_get_interrupt_state (SIGSEGV) != 's') + sigaction (SIGSEGV, &act, NULL); __gnat_handler_installed = 1; }
