From 9989a43983116c05aca5c3b5fc30191524b73b94 Mon Sep 17 00:00:00 2001 From: Patrick Bernardi Date: Wed, 14 Nov 2018 11:42:43 +0000 Subject: [PATCH] [Ada] Update signal constants for GNU/Linux Add the signal SIGSYS and mark the glibc reserved real-time signals (32-34) as reserved rather than not maskable. 2018-11-14 Patrick Bernardi gcc/ada/ * libgnarl/a-intnam__linux.ads: Add SIGSYS. * libgnarl/s-linux__alpha.ads, libgnarl/s-linux__android.ads, libgnarl/s-linux__hppa.ads, libgnarl/s-linux__mips.ads, libgnarl/s-linux__riscv.ads, libgnarl/s-linux__sparc.ads, libgnarl/s-linux__x32.ads: Rename SIGLTHRRES, SIGLTHRCAN and SIGLTHRDBG to SIG32, SIG33 and SIG34 as their names are implementation specific. * libgnarl/s-osinte__linux.ads, libgnarl/s-linux.ads: Add SIGSYS. Move SIG32, SIG33 and SIG34 from the unmasked list to the reserved list. gcc/testsuite/ * gnat.dg/rt_signals.adb: New testcase. From-SVN: r266136 --- gcc/ada/ChangeLog | 13 +++++++ gcc/ada/libgnarl/a-intnam__linux.ads | 3 ++ gcc/ada/libgnarl/s-linux.ads | 31 ++++++++------- gcc/ada/libgnarl/s-linux__alpha.ads | 6 +-- gcc/ada/libgnarl/s-linux__android.ads | 6 +-- gcc/ada/libgnarl/s-linux__hppa.ads | 6 +-- gcc/ada/libgnarl/s-linux__mips.ads | 6 +-- gcc/ada/libgnarl/s-linux__riscv.ads | 7 ++-- gcc/ada/libgnarl/s-linux__sparc.ads | 6 +-- gcc/ada/libgnarl/s-linux__x32.ads | 6 +-- gcc/ada/libgnarl/s-osinte__linux.ads | 56 ++++++++++++++------------- gcc/testsuite/ChangeLog | 4 ++ gcc/testsuite/gnat.dg/rt_signals.adb | 14 +++++++ 13 files changed, 101 insertions(+), 63 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/rt_signals.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 776d0d92d7f..14cc1fd3fd7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2018-11-14 Patrick Bernardi + + * libgnarl/a-intnam__linux.ads: Add SIGSYS. + * libgnarl/s-linux__alpha.ads, libgnarl/s-linux__android.ads, + libgnarl/s-linux__hppa.ads, libgnarl/s-linux__mips.ads, + libgnarl/s-linux__riscv.ads, libgnarl/s-linux__sparc.ads, + libgnarl/s-linux__x32.ads: Rename SIGLTHRRES, SIGLTHRCAN and + SIGLTHRDBG to SIG32, SIG33 and SIG34 as their names are + implementation specific. + * libgnarl/s-osinte__linux.ads, libgnarl/s-linux.ads: Add + SIGSYS. Move SIG32, SIG33 and SIG34 from the unmasked list to + the reserved list. + 2018-11-14 Eric Botcazou * exp_aggr.adb (Is_Static_Element): New predicate extracted diff --git a/gcc/ada/libgnarl/a-intnam__linux.ads b/gcc/ada/libgnarl/a-intnam__linux.ads index 7e4b51ae3d5..b9d23ae47a1 100644 --- a/gcc/ada/libgnarl/a-intnam__linux.ads +++ b/gcc/ada/libgnarl/a-intnam__linux.ads @@ -160,4 +160,7 @@ package Ada.Interrupts.Names is SIGPWR : constant Interrupt_ID := System.OS_Interface.SIGPWR; -- Power failure + SIGSYS : constant Interrupt_ID := + System.OS_Interface.SIGSYS; -- bad system call + end Ada.Interrupts.Names; diff --git a/gcc/ada/libgnarl/s-linux.ads b/gcc/ada/libgnarl/s-linux.ads index d86343621ee..5d5776232f4 100644 --- a/gcc/ada/libgnarl/s-linux.ads +++ b/gcc/ada/libgnarl/s-linux.ads @@ -86,34 +86,35 @@ package System.Linux is SIGFPE : constant := 8; -- floating point exception SIGKILL : constant := 9; -- kill (cannot be caught or ignored) SIGBUS : constant := 7; -- bus error + SIGUSR1 : constant := 10; -- user defined signal 1 SIGSEGV : constant := 11; -- segmentation violation + SIGUSR2 : constant := 12; -- user defined signal 2 SIGPIPE : constant := 13; -- write on a pipe with no one to read it SIGALRM : constant := 14; -- alarm clock SIGTERM : constant := 15; -- software termination signal from kill - SIGUSR1 : constant := 10; -- user defined signal 1 - SIGUSR2 : constant := 12; -- user defined signal 2 + SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux) SIGCLD : constant := 17; -- alias for SIGCHLD SIGCHLD : constant := 17; -- child status change - SIGPWR : constant := 30; -- power-fail restart - SIGWINCH : constant := 28; -- window size change - SIGURG : constant := 23; -- urgent condition on IO channel - SIGPOLL : constant := 29; -- pollable event occurred - SIGIO : constant := 29; -- I/O now possible (4.2 BSD) - SIGLOST : constant := 29; -- File lock lost SIGSTOP : constant := 19; -- stop (cannot be caught or ignored) SIGTSTP : constant := 20; -- user stop requested from tty SIGCONT : constant := 18; -- stopped process has been continued SIGTTIN : constant := 21; -- background tty read attempted SIGTTOU : constant := 22; -- background tty write attempted - SIGVTALRM : constant := 26; -- virtual timer expired - SIGPROF : constant := 27; -- profiling timer expired + SIGURG : constant := 23; -- urgent condition on IO channel SIGXCPU : constant := 24; -- CPU time limit exceeded SIGXFSZ : constant := 25; -- filesize limit exceeded - SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) - SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux) - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + SIGVTALRM : constant := 26; -- virtual timer expired + SIGPROF : constant := 27; -- profiling timer expired + SIGWINCH : constant := 28; -- window size change + SIGPOLL : constant := 29; -- pollable event occurred + SIGIO : constant := 29; -- I/O now possible (4.2 BSD) + SIGLOST : constant := 29; -- File lock lost + SIGPWR : constant := 30; -- power-fail restart + SIGSYS : constant := 31; -- bad system call + SIGUNUSED : constant := 31; -- unused signal (mapped to SIGSYS) + SIG32 : constant := 32; -- glibc internal signal + SIG33 : constant := 33; -- glibc internal signal + SIG34 : constant := 34; -- glibc internal signal -- struct_sigaction offsets diff --git a/gcc/ada/libgnarl/s-linux__alpha.ads b/gcc/ada/libgnarl/s-linux__alpha.ads index a5cd830da11..96602ca7dc1 100644 --- a/gcc/ada/libgnarl/s-linux__alpha.ads +++ b/gcc/ada/libgnarl/s-linux__alpha.ads @@ -109,9 +109,9 @@ package System.Linux is SIGUSR1 : constant := 30; -- user defined signal 1 SIGUSR2 : constant := 31; -- user defined signal 2 - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + SIG32 : constant := 32; -- glibc internal signal + SIG33 : constant := 33; -- glibc internal signal + SIG34 : constant := 34; -- glibc internal signal SIGADAABORT : constant := SIGABRT; -- Change this if you want to use another signal for task abort. diff --git a/gcc/ada/libgnarl/s-linux__android.ads b/gcc/ada/libgnarl/s-linux__android.ads index cd9df836b1d..5457d83c077 100644 --- a/gcc/ada/libgnarl/s-linux__android.ads +++ b/gcc/ada/libgnarl/s-linux__android.ads @@ -111,9 +111,9 @@ package System.Linux is SIGXFSZ : constant := 25; -- filesize limit exceeded SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux) - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + SIG32 : constant := 32; -- glibc internal signal + SIG33 : constant := 33; -- glibc internal signal + SIG34 : constant := 34; -- glibc internal signal -- struct_sigaction offsets diff --git a/gcc/ada/libgnarl/s-linux__hppa.ads b/gcc/ada/libgnarl/s-linux__hppa.ads index 59441f580e8..ec5c5736b82 100644 --- a/gcc/ada/libgnarl/s-linux__hppa.ads +++ b/gcc/ada/libgnarl/s-linux__hppa.ads @@ -113,9 +113,9 @@ package System.Linux is SIGXCPU : constant := 33; -- CPU time limit exceeded SIGXFSZ : constant := 34; -- filesize limit exceeded SIGSTKFLT : constant := 36; -- coprocessor stack fault (Linux) - SIGLTHRRES : constant := 37; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 38; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 39; -- GNU/LinuxThreads debugger signal + SIG32 : constant := 37; -- glibc internal signal + SIG33 : constant := 38; -- glibc internal signal + SIG34 : constant := 39; -- glibc internal signal -- struct_sigaction offsets diff --git a/gcc/ada/libgnarl/s-linux__mips.ads b/gcc/ada/libgnarl/s-linux__mips.ads index 3e507e0ec6c..6130b6e935b 100644 --- a/gcc/ada/libgnarl/s-linux__mips.ads +++ b/gcc/ada/libgnarl/s-linux__mips.ads @@ -111,9 +111,9 @@ package System.Linux is SIGXCPU : constant := 30; -- CPU time limit exceeded SIGXFSZ : constant := 31; -- filesize limit exceeded - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + SIG32 : constant := 32; -- glibc internal signal + SIG33 : constant := 33; -- glibc internal signal + SIG34 : constant := 34; -- glibc internal signal -- These don't exist for Linux/MIPS. The constants are present -- so that we can continue to use a-intnam-linux.ads. diff --git a/gcc/ada/libgnarl/s-linux__riscv.ads b/gcc/ada/libgnarl/s-linux__riscv.ads index 74420f39f1b..77543d8a5a2 100644 --- a/gcc/ada/libgnarl/s-linux__riscv.ads +++ b/gcc/ada/libgnarl/s-linux__riscv.ads @@ -110,10 +110,9 @@ package System.Linux is SIGIO : constant := 29; -- I/O now possible (4.2 BSD) SIGPWR : constant := 30; -- power-fail restart SIGSYS : constant := 31; -- bad system call - - SIGLTHRRES : constant := 0; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 0; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 0; -- GNU/LinuxThreads debugger signal + SIG32 : constant := 32; -- glibc internal signal + SIG33 : constant := 33; -- glibc internal signal + SIG34 : constant := 34; -- glibc internal signal -- These don't exist for Linux/RISC-V. The constants are present -- so that we can continue to use a-intnam-linux.ads. diff --git a/gcc/ada/libgnarl/s-linux__sparc.ads b/gcc/ada/libgnarl/s-linux__sparc.ads index 79a88d832bc..3b0a9cb7fe0 100644 --- a/gcc/ada/libgnarl/s-linux__sparc.ads +++ b/gcc/ada/libgnarl/s-linux__sparc.ads @@ -112,9 +112,9 @@ package System.Linux is SIGUSR1 : constant := 30; -- user defined signal 1 SIGUSR2 : constant := 31; -- user defined signal 2 - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + SIG32 : constant := 32; -- glibc internal signal + SIG33 : constant := 33; -- glibc internal signal + SIG34 : constant := 34; -- glibc internal signal SIGUNUSED : constant := 0; SIGSTKFLT : constant := 0; diff --git a/gcc/ada/libgnarl/s-linux__x32.ads b/gcc/ada/libgnarl/s-linux__x32.ads index a831623de22..ea57a604018 100644 --- a/gcc/ada/libgnarl/s-linux__x32.ads +++ b/gcc/ada/libgnarl/s-linux__x32.ads @@ -111,9 +111,9 @@ package System.Linux is SIGXFSZ : constant := 25; -- filesize limit exceeded SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux) - SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal - SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal - SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + SIG32 : constant := 32; -- glibc internal signal + SIG33 : constant := 33; -- glibc internal signal + SIG34 : constant := 34; -- glibc internal signal -- struct_sigaction offsets diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads index 447f9b59624..88d68fa4c04 100644 --- a/gcc/ada/libgnarl/s-osinte__linux.ads +++ b/gcc/ada/libgnarl/s-osinte__linux.ads @@ -30,7 +30,7 @@ -- -- ------------------------------------------------------------------------------ --- This is a GNU/Linux (GNU/LinuxThreads) version of this package +-- This is a GNU/Linux version of this package -- This package encapsulates all direct interfaces to OS services -- that are needed by the tasking run-time (libgnarl). @@ -90,37 +90,38 @@ package System.OS_Interface is SIGTRAP : constant := System.Linux.SIGTRAP; SIGIOT : constant := System.Linux.SIGIOT; SIGABRT : constant := System.Linux.SIGABRT; + SIGBUS : constant := System.Linux.SIGBUS; SIGFPE : constant := System.Linux.SIGFPE; SIGKILL : constant := System.Linux.SIGKILL; - SIGBUS : constant := System.Linux.SIGBUS; + SIGUSR1 : constant := System.Linux.SIGUSR1; SIGSEGV : constant := System.Linux.SIGSEGV; + SIGUSR2 : constant := System.Linux.SIGUSR2; SIGPIPE : constant := System.Linux.SIGPIPE; SIGALRM : constant := System.Linux.SIGALRM; SIGTERM : constant := System.Linux.SIGTERM; - SIGUSR1 : constant := System.Linux.SIGUSR1; - SIGUSR2 : constant := System.Linux.SIGUSR2; + SIGSTKFLT : constant := System.Linux.SIGSTKFLT; SIGCLD : constant := System.Linux.SIGCLD; SIGCHLD : constant := System.Linux.SIGCHLD; - SIGPWR : constant := System.Linux.SIGPWR; - SIGWINCH : constant := System.Linux.SIGWINCH; - SIGURG : constant := System.Linux.SIGURG; - SIGPOLL : constant := System.Linux.SIGPOLL; - SIGIO : constant := System.Linux.SIGIO; - SIGLOST : constant := System.Linux.SIGLOST; + SIGCONT : constant := System.Linux.SIGCONT; SIGSTOP : constant := System.Linux.SIGSTOP; SIGTSTP : constant := System.Linux.SIGTSTP; - SIGCONT : constant := System.Linux.SIGCONT; SIGTTIN : constant := System.Linux.SIGTTIN; SIGTTOU : constant := System.Linux.SIGTTOU; - SIGVTALRM : constant := System.Linux.SIGVTALRM; - SIGPROF : constant := System.Linux.SIGPROF; + SIGURG : constant := System.Linux.SIGURG; SIGXCPU : constant := System.Linux.SIGXCPU; SIGXFSZ : constant := System.Linux.SIGXFSZ; + SIGVTALRM : constant := System.Linux.SIGVTALRM; + SIGPROF : constant := System.Linux.SIGPROF; + SIGWINCH : constant := System.Linux.SIGWINCH; + SIGPOLL : constant := System.Linux.SIGPOLL; + SIGIO : constant := System.Linux.SIGIO; + SIGLOST : constant := System.Linux.SIGLOST; + SIGPWR : constant := System.Linux.SIGPWR; + SIGSYS : constant := System.Linux.SIGSYS; SIGUNUSED : constant := System.Linux.SIGUNUSED; - SIGSTKFLT : constant := System.Linux.SIGSTKFLT; - SIGLTHRRES : constant := System.Linux.SIGLTHRRES; - SIGLTHRCAN : constant := System.Linux.SIGLTHRCAN; - SIGLTHRDBG : constant := System.Linux.SIGLTHRDBG; + SIG32 : constant := System.Linux.SIG32; + SIG33 : constant := System.Linux.SIG33; + SIG34 : constant := System.Linux.SIG34; SIGADAABORT : constant := SIGABRT; -- Change this to use another signal for task abort. SIGTERM might be a @@ -142,16 +143,19 @@ package System.OS_Interface is SIGPROF, -- To avoid confusing the profiler - SIGKILL, SIGSTOP, + SIGKILL, SIGSTOP -- These two signals actually can't be masked (POSIX won't allow it) - - SIGLTHRRES, SIGLTHRCAN, SIGLTHRDBG); - -- These three signals are used by GNU/LinuxThreads starting from glibc - -- 2.1 (future 2.2). - - Reserved : constant Signal_Set := (SIGVTALRM, SIGUNUSED); - -- Not clear why these two signals are reserved. Perhaps they are not - -- supported by this version of GNU/Linux ??? + ); + + Reserved : constant Signal_Set := ( + SIG32, SIG33, SIG34 + -- glibc POSIX threads implementation uses two (NPTL) or three + -- (LinuxThreads) real-time signals for its own use (see SIGNAL(7)). + -- These signals are considered reserved and not unmasked as glibc does + -- not permit these signals to be used by the public signal.h API. + -- While LinuxThreads is mostly likely unused now, SIG34 is still + -- reserved as this behavior is consistent with past GNAT releases. + ); type sigset_t is private; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b7373c9de8f..f8bb63f01d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-11-14 Patrick Bernardi + + * gnat.dg/rt_signals.adb: New testcase. + 2018-11-14 Hristian Kirtchev * gnat.dg/ghost1.adb, gnat.dg/ghost1.ads: New testcase. diff --git a/gcc/testsuite/gnat.dg/rt_signals.adb b/gcc/testsuite/gnat.dg/rt_signals.adb new file mode 100644 index 00000000000..7694a114254 --- /dev/null +++ b/gcc/testsuite/gnat.dg/rt_signals.adb @@ -0,0 +1,14 @@ +-- { dg-do run } + +-- This program used to fail with a runtime built with assertions + +procedure RT_Signals is + task Task_A; + + task body Task_A is + begin + null; + end Task_A; +begin + null; +end RT_Signals; -- 2.30.2