From patchwork Wed Jul 20 15:58:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 105755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0FE97B6F6B for ; Thu, 21 Jul 2011 01:59:20 +1000 (EST) Received: (qmail 17910 invoked by alias); 20 Jul 2011 15:59:17 -0000 Received: (qmail 17900 invoked by uid 22791); 20 Jul 2011 15:59:16 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Jul 2011 15:58:56 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id E16F970D; Wed, 20 Jul 2011 17:58:52 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cGFd6jgdkBdd; Wed, 20 Jul 2011 17:58:50 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 2B66A70C; Wed, 20 Jul 2011 17:58:50 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id p6KFwn0B002274; Wed, 20 Jul 2011 17:58:49 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Arnaud Charlet Subject: Allow IRIX Ada bootstrap with C++ Date: Wed, 20 Jul 2011 17:58:49 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org A bootstrap on IRIX 6.5 only saw a single issue with C++ so far: ada/init.c failed to compile: /vol/gcc/src/hg/trunk/local/gcc/ada/init.c: In function 'void __gnat_install_handler()': /vol/gcc/src/hg/trunk/local/gcc/ada/init.c:862:20: error: invalid conversion from 'void (*)(int, int, sigcontext_t*) {aka void (*)(int, int, sigcontext*)}' to 'void (*)(int)' [-fpermissive] make[3]: *** [ada/init.o] Error 1 There was obviously some confusion here. The __gnat_error_handler comment cites a section of the sigaction(2) man page describing handler arguments with SA_SIGINFO, only to state that this doesn't happen. Apart from that, the section matches neither the IRIX 5.3 nor the 6.5 man pages, which have different argument types. I'm updating the comment and fixing the argument types. I also now need to extract the code from the passed siginfo_t *. With this patch, bootstrap continued. Ok for mainline if it passes? I also wonder why __gnat_error_handler does all this stuff if SA_SIGINFO isn't set and the args never actually passed. Rainer 2011-07-20 Rainer Orth * init.c [sgi] (__gnat_error_handler): Update sigaction(2) citation. Correct argument types. Extract code from reason. (__gnat_install_handler): Assign to act.sa_sigaction. diff --git a/gcc/ada/init.c b/gcc/ada/init.c --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -763,16 +763,31 @@ extern struct Exception_Data _abort_sign connecting that handler, with the effects described in the sigaction man page: - SA_SIGINFO [...] - If cleared and the signal is caught, the first argument is - also the signal number but the second argument is the signal - code identifying the cause of the signal. The third argument - points to a sigcontext_t structure containing the receiving - process's context when the signal was delivered. */ + SA_SIGINFO If set and the signal is caught, sig is passed as the + first argument to the signal-catching function. If the + second argument is not equal to NULL, it points to a + siginfo_t structure containing the reason why the + signal was generated [see siginfo(5)]; the third + argument points to a ucontext_t structure containing + the receiving process's context when the signal was + delivered [see ucontext(5)]. If cleared and the signal + is caught, the first argument is also the signal number + but the second argument is the signal code identifying + the cause of the signal. The third argument points to a + sigcontext_t structure containing the receiving + process's context when the signal was delivered. This + is the default behavior (see signal(5) for more + details). Additionally, when SA_SIGINFO is set for a + signal, multiple occurrences of that signal will be + queued for delivery in FIFO order (see sigqueue(3) for + a more detailed explanation of this concept), if those + occurrences of that signal were generated using + sigqueue(3). */ static void -__gnat_error_handler (int sig, int code, sigcontext_t *sc ATTRIBUTE_UNUSED) +__gnat_error_handler (int sig, siginfo_t *reason, void *uc ATTRIBUTE_UNUSED) { + int code = reason == NULL ? 0 : reason->si_code; struct Exception_Data *exception; const char *msg; @@ -859,7 +874,7 @@ __gnat_install_handler (void) exceptions. Make sure that the handler isn't interrupted by another signal that might cause a scheduling event! */ - act.sa_handler = __gnat_error_handler; + act.sa_sigaction = __gnat_error_handler; act.sa_flags = SA_NODEFER + SA_RESTART; sigfillset (&act.sa_mask); sigemptyset (&act.sa_mask);