This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ping][Ada] Add sa_handler_pos to s-linux to handle mipsel-linux
- From: Laurent GUERBY <laurent at guerby dot net>
- To: Arnaud Charlet <charlet at adacore dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 04 May 2009 10:40:47 +0200
- Subject: Re: [PATCH][ping][Ada] Add sa_handler_pos to s-linux to handle mipsel-linux
- References: <1233864797.24883.118.camel@localhost> <1234898487.8927.18.camel@localhost> <1235582887.11347.215.camel@localhost>
Ping.
Laurent
On Wed, 2009-02-25 at 18:28 +0100, Laurent GUERBY wrote:
> Ping.
>
> Laurent
>
> On Tue, 2009-02-17 at 20:21 +0100, Laurent GUERBY wrote:
> > On Thu, 2009-02-05 at 21:13 +0100, Laurent GUERBY wrote:
> > > Hi,
> > >
> > > On mipsel-linux a few ACATS tasking test abort during runtime:
> > >
> > > http://gcc.gnu.org/ml/gcc-testresults/2009-02/msg00069.html
> > >
> > > The struct sigaction has yet a different layout on mipsel-linux as shown
> > > in this extract from /usr/include/bits/sigaction.h:
> > >
> > > /* Structure describing the action to be taken when a signal arrives. */
> > > struct sigaction
> > > {
> > > /* Special flags. */
> > > unsigned int sa_flags;
> > >
> > > /* Signal handler. */
> > > #ifdef __USE_POSIX199309
> > > union
> > > {
> > > /* Used if SA_SIGINFO is not set. */
> > > __sighandler_t sa_handler;
> > > /* Used if SA_SIGINFO is set. */
> > > void (*sa_sigaction) (int, siginfo_t *, void *);
> > > }
> > > __sigaction_handler;
> > > # define sa_handler __sigaction_handler.sa_handler
> > > # define sa_sigaction __sigaction_handler.sa_sigaction
> > > #else
> > > __sighandler_t sa_handler;
> > > #endif
> > > /* Additional set of signals to be blocked. */
> > > __sigset_t sa_mask;
> > >
> > > /* The ABI says here are two unused ints following. */
> > > /* Restore handler. */
> > > void (*sa_restorer) (void);
> > >
> > > #if _MIPS_SZPTR < 64
> > > int sa_resv[1];
> > > #endif
> > > };
> > >
> > > So this needs adding a constant to s-linux to relocate sa_handler in s-osinte-linux
> > > which is no longer the first field on all linux platforms.
> > >
> > > Ok for trunk if testing passes on x86_64-linux and mips-linux?
> > >
> > > After this one, there should be only one FAIL for ACATS on mipsel-linux.
> >
> > Here is the testresult with the (complete below) patch, only one Ada
> > FAIL left as expected:
> >
> > http://gcc.gnu.org/ml/gcc-testresults/2009-02/msg01635.html
> >
> > Ok to commit?
> >
> > Laurent
> >
> > 2009-02-05 Laurent GUERBY <laurent@guerby.net>
> >
> > * s-linux.ads, s-linux-alpha.ads, s-linux-hppa.ads,
> > osinte-linux.ads: Define sa_handler_pos.
> > * s-osinte-linux.ads: Use it.
> > * s-linux-mipsel.ads: New.
> > * gcc-interface/Makefile.in: Use it.
> >
> > Index: gcc/ada/s-linux.ads
> > ===================================================================
> > --- gcc/ada/s-linux.ads (revision 144242)
> > +++ gcc/ada/s-linux.ads (working copy)
> > @@ -95,8 +95,9 @@
> >
> > -- struct_sigaction offsets
> >
> > - sa_mask_pos : constant := Standard'Address_Size / 8;
> > - sa_flags_pos : constant := 128 + sa_mask_pos;
> > + sa_handler_pos : constant := 0;
> > + sa_mask_pos : constant := Standard'Address_Size / 8;
> > + sa_flags_pos : constant := 128 + sa_mask_pos;
> >
> > SA_SIGINFO : constant := 16#04#;
> > SA_ONSTACK : constant := 16#08000000#;
> > Index: gcc/ada/s-osinte-linux.ads
> > ===================================================================
> > --- gcc/ada/s-osinte-linux.ads (revision 144242)
> > +++ gcc/ada/s-osinte-linux.ads (working copy)
> > @@ -510,9 +510,9 @@
> >
> > pragma Warnings (Off);
> > for struct_sigaction use record
> > - sa_handler at 0 range 0 .. Standard'Address_Size - 1;
> > - sa_mask at Linux.sa_mask_pos range 0 .. 1023;
> > - sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1;
> > + sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1;
> > + sa_mask at Linux.sa_mask_pos range 0 .. 1023;
> > + sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1;
> > end record;
> > -- We intentionally leave sa_restorer unspecified and let the compiler
> > -- append it after the last field, so disable corresponding warning.
> > Index: gcc/ada/s-linux-hppa.ads
> > ===================================================================
> > --- gcc/ada/s-linux-hppa.ads (revision 144242)
> > +++ gcc/ada/s-linux-hppa.ads (working copy)
> > @@ -97,8 +97,9 @@
> >
> > -- struct_sigaction offsets
> >
> > - sa_flags_pos : constant := Standard'Address_Size / 8;
> > - sa_mask_pos : constant := sa_flags_pos * 2;
> > + sa_handler_pos : constant := 0;
> > + sa_flags_pos : constant := Standard'Address_Size / 8;
> > + sa_mask_pos : constant := sa_flags_pos * 2;
> >
> > SA_SIGINFO : constant := 16#10#;
> > SA_ONSTACK : constant := 16#01#;
> > Index: gcc/ada/gcc-interface/Makefile.in
> > ===================================================================
> > --- gcc/ada/gcc-interface/Makefile.in (revision 144242)
> > +++ gcc/ada/gcc-interface/Makefile.in (working copy)
> > @@ -1451,7 +1451,7 @@
> > a-intnam.ads<a-intnam-linux.ads \
> > s-inmaop.adb<s-inmaop-posix.adb \
> > s-intman.adb<s-intman-posix.adb \
> > - s-linux.ads<s-linux.ads \
> > + s-linux.ads<s-linux-mipsel.ads \
> > s-osinte.adb<s-osinte-posix.adb \
> > s-osinte.ads<s-osinte-linux.ads \
> > s-osprim.adb<s-osprim-posix.adb \
> > Index: gcc/ada/s-linux-alpha.ads
> > ===================================================================
> > --- gcc/ada/s-linux-alpha.ads (revision 144242)
> > +++ gcc/ada/s-linux-alpha.ads (working copy)
> > @@ -105,8 +105,9 @@
> >
> > -- struct_sigaction offsets
> >
> > - sa_mask_pos : constant := Standard'Address_Size / 8;
> > - sa_flags_pos : constant := 128 + sa_mask_pos;
> > + sa_handler_pos : constant := 0;
> > + sa_mask_pos : constant := Standard'Address_Size / 8;
> > + sa_flags_pos : constant := 128 + sa_mask_pos;
> >
> > SA_SIGINFO : constant := 16#40#;
> > SA_ONSTACK : constant := 16#01#;
> > Index: gcc/ada/s-linux-mipsel.ads
> > ===================================================================
> > --- gcc/ada/s-linux-mipsel.ads (revision 0)
> > +++ gcc/ada/s-linux-mipsel.ads (revision 0)
> > @@ -0,0 +1,120 @@
> > +------------------------------------------------------------------------------
> > +-- --
> > +-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
> > +-- --
> > +-- S Y S T E M . L I N U X --
> > +-- --
> > +-- S p e c --
> > +-- --
> > +-- Copyright (C) 2009, Free Software Foundation, Inc. --
> > +-- --
> > +-- GNARL is free software; you can redistribute it and/or modify it under --
> > +-- terms of the GNU General Public License as published by the Free Soft- --
> > +-- ware Foundation; either version 2, or (at your option) any later ver- --
> > +-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
> > +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
> > +-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
> > +-- for more details. You should have received a copy of the GNU General --
> > +-- Public License distributed with GNARL; see file COPYING. If not, write --
> > +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
> > +-- Boston, MA 02110-1301, USA. --
> > +-- --
> > +-- As a special exception, if other files instantiate generics from this --
> > +-- unit, or you link this unit with other files to produce an executable, --
> > +-- this unit does not by itself cause the resulting executable to be --
> > +-- covered by the GNU General Public License. This exception does not --
> > +-- however invalidate any other reasons why the executable file might be --
> > +-- covered by the GNU Public License. --
> > +-- --
> > +------------------------------------------------------------------------------
> > +
> > +-- This is the mipsel version of this package
> > +
> > +-- This package encapsulates cpu specific differences between implementations
> > +-- of GNU/Linux, in order to share s-osinte-linux.ads.
> > +
> > +-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
> > +-- Preelaborate. This package is designed to be a bottom-level (leaf) package
> > +
> > +package System.Linux is
> > + pragma Preelaborate;
> > +
> > + -----------
> > + -- Errno --
> > + -----------
> > +
> > + EAGAIN : constant := 11;
> > + EINTR : constant := 4;
> > + EINVAL : constant := 22;
> > + ENOMEM : constant := 12;
> > + EPERM : constant := 1;
> > + ETIMEDOUT : constant := 110;
> > +
> > + -------------
> > + -- Signals --
> > + -------------
> > +
> > + SIGHUP : constant := 1; -- hangup
> > + SIGINT : constant := 2; -- interrupt (rubout)
> > + SIGQUIT : constant := 3; -- quit (ASCD FS)
> > + SIGILL : constant := 4; -- illegal instruction (not reset)
> > + SIGTRAP : constant := 5; -- trace trap (not reset)
> > + SIGIOT : constant := 6; -- IOT instruction
> > + SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
> > + SIGFPE : constant := 8; -- floating point exception
> > + SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
> > + SIGBUS : constant := 7; -- bus error
> > + SIGSEGV : constant := 11; -- segmentation violation
> > + 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
> > + 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
> > + 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
> > +
> > + -- struct_sigaction offsets
> > +
> > + sa_handler_pos : constant := Standard'Address_Size / 8;
> > + sa_mask_pos : constant := 2 * Standard'Address_Size / 8;
> > + sa_flags_pos : constant := 0;
> > +
> > + SA_SIGINFO : constant := 16#04#;
> > + SA_ONSTACK : constant := 16#08000000#;
> > +
> > + type struct_pthread_fast_lock is record
> > + status : Long_Integer;
> > + spinlock : Integer;
> > + end record;
> > + pragma Convention (C, struct_pthread_fast_lock);
> > +
> > + type pthread_mutex_t is record
> > + m_reserved : Integer;
> > + m_count : Integer;
> > + m_owner : System.Address;
> > + m_kind : Integer;
> > + m_lock : struct_pthread_fast_lock;
> > + end record;
> > + pragma Convention (C, pthread_mutex_t);
> > +
> > +end System.Linux;
> >
> >
> >