public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-409] [Ada] Only use alternate stack when needed Date: Fri, 13 May 2022 08:09:27 +0000 (GMT) [thread overview] Message-ID: <20220513080927.E7DEC3858C2D@sourceware.org> (raw) https://gcc.gnu.org/g:78e26388edb20bc827a8c0504010621f01204af2 commit r13-409-g78e26388edb20bc827a8c0504010621f01204af2 Author: Arnaud Charlet <charlet@adacore.com> Date: Fri Feb 25 04:39:57 2022 -0500 [Ada] Only use alternate stack when needed If we're not going to install a signal handler for SIGSEGV then we do not need an alternate stack to handle this signal (and e.g. stack overflows). gcc/ada/ * libgnarl/s-taprop__linux.adb (Initialize): Do not use an alternate stack if no handler for SEGV is installed. Diff: --- gcc/ada/libgnarl/s-taprop__linux.adb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb index 4ff784f0ea7..42a95ea8de0 100644 --- a/gcc/ada/libgnarl/s-taprop__linux.adb +++ b/gcc/ada/libgnarl/s-taprop__linux.adb @@ -96,7 +96,7 @@ package body System.Task_Primitives.Operations is Foreign_Task_Elaborated : aliased Boolean := True; -- Used to identified fake tasks (i.e., non-Ada Threads) - Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0; + Use_Alternate_Stack : Boolean := Alternate_Stack_Size /= 0; -- Whether to use an alternate signal stack for stack overflows Abort_Handler_Installed : Boolean := False; @@ -1375,9 +1375,9 @@ package body System.Task_Primitives.Operations is function State (Int : System.Interrupt_Management.Interrupt_ID) return Character; pragma Import (C, State, "__gnat_get_interrupt_state"); - -- Get interrupt state. Defined in a-init.c - -- The input argument is the interrupt number, - -- and the result is one of the following: + -- Get interrupt state. Defined in init.c. + -- The input argument is the interrupt number, and the result is one of + -- the following: Default : constant Character := 's'; -- 'n' this interrupt not set by any Interrupt_State pragma @@ -1409,6 +1409,12 @@ package body System.Task_Primitives.Operations is Specific.Initialize (Environment_Task); + -- Do not use an alternate stack if no handler for SEGV is installed + + if State (SIGSEGV) = Default then + Use_Alternate_Stack := False; + end if; + if Use_Alternate_Stack then Environment_Task.Common.Task_Alternate_Stack := Alternate_Stack'Address;
reply other threads:[~2022-05-13 8:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220513080927.E7DEC3858C2D@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).