diff options
author | marino <marino@pkgsrc.org> | 2015-06-14 19:46:51 +0000 |
---|---|---|
committer | marino <marino@pkgsrc.org> | 2015-06-14 19:46:51 +0000 |
commit | 08df4cb84831c94ccf04580646e8916e6af1b428 (patch) | |
tree | d5c0b5645380312b73204f56684bd626fdc0abb6 /lang | |
parent | ee0f50e6a7b6e6e85b0b4ae1d7e8320adf803142 (diff) | |
download | pkgsrc-08df4cb84831c94ccf04580646e8916e6af1b428.tar.gz |
lang/gcc-aux: various fixes, remove NLS option
This update is a by-product of working on new package, gcc5-aux, and
applying those concepts here. Several changes were made, including:
- Version date was not updated when version changed from 4.9.0 => 4.9.2
(revbump occurred instead). Remove revbump and fix date
- Remove DragonFly-i386 from permitted platforms. This platform will be
completely unsupported when DragonFly 4.2 is released (very soon)
- Remove references to OpenBSD and MirBSD. Support was never activated
due to technical issues and likely will not happen.
- Reindent (cosmetic)
- It is seemingly impossible to work around NetBSD's binary compatibility
scheme (e.g. __socket30, __nanosleep50). These weak symbols are simply
ignored by Ada's pragma Import and no c-tricks seem to avoid conflicts.
(Why can't NetBSD use symbol versioning???) Anyway, having NetBSD-
specific copies of source files to handle a couple of symbol differences
is simply not sustainable, so move to a new scheme where these are
replaced on the fly. By the way, this problem basically means that I
cannot fix GNAT upstream, even if I found somebody to sponsor getting
the NUMEROUS non-ada patches upstream. GCC devs would laugh at me if I
describe why I want to introduce so many new but similar files to
support NetBSD. So it's very likely never going to happen.
- Disable libitm and libcilkrts by default. They are out of scope and not
worth building / fixing.
- Apparently NLS support doesn't build on NetBSD 6.1? Nobody reported
this to me, but there are linking issues. I'm just removing the option
(which was on by default) until further notice. Having NLS support on
by default was questionable anyway.
- Remove exetim mods, this was wrong (for all BSD platforms)
- Android support leaked in, but it's not used here
- The diff-ada file dropped about 150k in size, and could have been more
had the android osinte file been masked too.
Diffstat (limited to 'lang')
-rw-r--r-- | lang/gcc-aux/Makefile | 93 | ||||
-rw-r--r-- | lang/gcc-aux/Makefile.version | 4 | ||||
-rw-r--r-- | lang/gcc-aux/distinfo | 5 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-ada | 4860 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-core | 168 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-cxx | 15 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-fortran | 4 | ||||
-rw-r--r-- | lang/gcc-aux/options.mk | 9 |
8 files changed, 198 insertions, 4960 deletions
diff --git a/lang/gcc-aux/Makefile b/lang/gcc-aux/Makefile index 39da6151c14..3cce40a8346 100644 --- a/lang/gcc-aux/Makefile +++ b/lang/gcc-aux/Makefile @@ -1,9 +1,8 @@ -# $NetBSD: Makefile,v 1.23 2015/06/12 10:50:15 wiz Exp $ +# $NetBSD: Makefile,v 1.24 2015/06/14 19:46:51 marino Exp $ # PKGNAME= gcc-aux-${SNAPSHOT} DISTNAME= gcc-${GCC_VERSION} -PKGREVISION= 5 CATEGORIES= lang MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/} DISTFILES= ${DISTNAME}.tar.bz2 @@ -25,7 +24,7 @@ APPLY_DIFFS= core ada cxx # Requires bootstrap compiler, which is only available for on selected systems # Disable SunOS for now until multilib version can be built and tested. -ONLY_FOR_PLATFORM= DragonFly-*-* \ +ONLY_FOR_PLATFORM= DragonFly-*-x86_64 \ FreeBSD-*-i386 \ FreeBSD-*-x86_64 \ NetBSD-[5-9]*-i386 \ @@ -33,8 +32,6 @@ ONLY_FOR_PLATFORM= DragonFly-*-* \ SunOS-5.1[1-9]*-i386 \ SunOS-5.1[1-9]*-x86_64 -#ONLY_FOR_PLATFORM+= OpenBSD-*-amd64 MirBSD-*-amd64 - GARCH= ${MACHINE_ARCH:S/amd64/x86_64/} BLD_TARGET= ${GARCH}-aux-${LOWER_OPSYS}${OS_VERSION} OS_LABEL4VERS= [${OPSYS}${GARCH:M*64:S/amd_//:S/x86_//}] @@ -55,22 +52,38 @@ BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.freebsd.100B.tar.bz2 .endif .if ${OPSYS} == NetBSD -.if !empty(OS_VERSION:M6.99.*) - NSUFF= 7.0_DEV -.elif !empty(OS_VERSION:M7.99.*) - NSUFF= 8.0_DEV -.else - NSUFF= ${OS_VERSION} -.endif -.if ${GARCH} == i386 - NELF= elf -.endif +. if !empty(OS_VERSION:M6.99.*) +NSUFF= 7.0_DEV +. elif !empty(OS_VERSION:M7.99.*) +NSUFF= 8.0_DEV +. else +NSUFF= ${OS_VERSION} +. endif +. if ${GARCH} == i386 +NELF= elf +. endif XLDF= -lm -.if empty(OS_VERSION:M7.99.*) +. if empty(OS_VERSION:M7.99.*) MODERN_BINUTILS= yes -.endif +. endif BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.netbsd.614.tar.bz2 BLD_TARGET= ${MACHINE_ARCH}-aux-netbsd${NELF}${NSUFF} +. if ${OS_VERSION:R} == 5 +CORRECTIONS= g-socthi-bsd.adb +CRXN= C5 +. else +CORRECTIONS= g-socthi-bsd.adb g-socthi.ads \ + s-osinte-netbsd.ads s-osprim-posix.adb +CRXN= C6 +. endif +C5_g-socthi-bsd.adb= Syscall_Socket/__socket30 +C6_g-socthi-bsd.adb= Syscall_Socket/__socket30 +C6_g-socthi.ads= C_Select/__select50 +C6_s-osinte-netbsd.ads= nanosleep/__nanosleep50 \ + clock_getres/__clock_getres50 \ + clock_gettime/__clock_gettime50 +C6_s-osprim-posix.adb= nanosleep/__nanosleep50 \ + gettimeofday/__gettimeofday50 .endif .if ${OPSYS} == SunOS @@ -87,16 +100,6 @@ MODERN_BINUTILS= yes NATIVE_LINKER!= which ld .endif -.if ${OPSYS} == OpenBSD || ${OPSYS} == MirBSD -OPENMIR= yes -MODERN_BINUTILS= yes -EXTRA_CONFARGS+= --disable-libstdcxx-pch -EXTRA_CONFARGS+= --disable-tls -EXTRA_CONFARGS+= --enable-cpp -EXTRA_CONFARGS+= --enable-wchar_t -BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.openbsd.55.tar.bz2 -.endif - .if defined(MODERN_BINUTILS) BUILDLINK_DEPMETHOD.binutils= full .include "../../devel/binutils/buildlink3.mk" @@ -165,7 +168,6 @@ DISTFILES= \ ada-bootstrap.x86_64.freebsd.84.tar.bz2 \ ada-bootstrap.x86_64.freebsd.100B.tar.bz2 \ ada-bootstrap.x86_64.netbsd.614.tar.bz2 \ - ada-bootstrap.x86_64.openbsd.55.tar.bz2 \ ada-bootstrap.x86_64.solaris.511.tar.bz2 .endif @@ -192,6 +194,8 @@ CONFIGURE_ARGS+= --enable-checking=release CONFIGURE_ARGS+= --disable-libmudflap CONFIGURE_ARGS+= --disable-libgomp CONFIGURE_ARGS+= --disable-libssp +CONFIGURE_ARGS+= --disable-libcilkrts +CONFIGURE_ARGS+= --disable-libitm CONFIGURE_ARGS+= ${EXTRA_CONFARGS} # Automatic package list generation @@ -220,31 +224,26 @@ post-extract: -pe 's|se_NO|no_NO|g;' \ -pe 's|es_MX|es_ES|g;' \ -pe 's|ru_RU.UTF8|ru_RU.UTF-8|g' ${LOCALE22FIX}) +.if ${OPSYS} == NetBSD +. for sysfile in ${CORRECTIONS} +. for pair in ${${CRXN}_${sysfile}} + ${PERL5} -pi -e 's|C, ${pair:H}, ".*"|C, ${pair:H}, "${pair:T}"|' \ + ${WRKSRC}/gcc/ada/${sysfile} +. endfor +. endfor +. if ${CRXN} == C5 + ${PERL5} -pi -e 's|new int64_t|new int|' \ + ${WRKSRC}/gcc/ada/s-osinte-netbsd.ads + ${PERL5} -pi -e 's|new Long_Integer|new Integer|' \ + ${WRKSRC}/gcc/ada/s-osprim-posix.adb +. endif +.endif .if defined(STATIC_BUILD) || !empty(PKG_OPTIONS:Mbootstrap) . if ${OPSYS} != SunOS # Ensure GNAT tools are built statically ${PERL5} -pi -e 's/^GCC_LINK_FLAGS=.*/GCC_LINK_FLAGS=-static/' \ ${WRKSRC}/gcc/ada/gcc-interface/Makefile.in . endif -.else -. if defined(OPENMIR) - # OpenBSD has no system libraries ending in ".so" so the pkgsrc linker - # fails to link things like "-lutil -lm". Work around this oddity. - ${MKDIR} ${SYSLIBDIR} -. for sl in c m z util pthread - ${LN} -s `ls /usr/lib/lib${sl}.so* | head -1` ${SYSLIBDIR}/lib${sl}.so -. endfor - ${PERL5} -i.bak -pe 's|\$$\(MISCLIB\)|-L${SYSLIBDIR} \$$(MISCLIB)|g;' \ - -pe 's|\$$\(THREADSLIB\)|-L${SYSLIBDIR} \$$(THREADSLIB)|g' \ - ${WRKSRC}/gcc/ada/gcc-interface/Makefile.in - ${PERL5} -i.bak -pe 's|-lm|-L${SYSLIBDIR} -lm|g' \ - ${WRKSRC}/libquadmath/Makefile.in \ - ${WRKSRC}/libgfortran/Makefile.in - ${PERL5} -i.bak -pe 's|-lpthread|-L${SYSLIBDIR} -lpthread|g;' \ - -pe 's|\@XCFLAGS\@|-L${SYSLIBDIR} \@XCFLAGS\@|g;' \ - ${WRKSRC}/libcilkrts/Makefile.in \ - ${WRKSRC}/libitm/Makefile.in -. endif .endif .if !exists(${LOCALBASE}/gcc-aux/bin/ada) && ${OPSYS} == SunOS # In case /usr/pkg/bin/gas doesn't exist, establish fallback diff --git a/lang/gcc-aux/Makefile.version b/lang/gcc-aux/Makefile.version index da0959bfb83..c7e3cd4a23d 100644 --- a/lang/gcc-aux/Makefile.version +++ b/lang/gcc-aux/Makefile.version @@ -1,7 +1,7 @@ -# $NetBSD: Makefile.version,v 1.2 2014/12/07 10:45:32 ryoon Exp $ +# $NetBSD: Makefile.version,v 1.3 2015/06/14 19:46:51 marino Exp $ # -SNAPSHOT= 20140422 +SNAPSHOT= 20141023 GCC_BRANCH= 4.9 GCC_POINT= 2 GCC_VERSION= ${GCC_BRANCH}.${GCC_POINT} diff --git a/lang/gcc-aux/distinfo b/lang/gcc-aux/distinfo index 27dfbbcb297..c45c4b37299 100644 --- a/lang/gcc-aux/distinfo +++ b/lang/gcc-aux/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.9 2014/12/07 10:45:32 ryoon Exp $ +$NetBSD: distinfo,v 1.10 2015/06/14 19:46:51 marino Exp $ SHA1 (ada-bootstrap.i386.dragonfly.36A.tar.bz2) = 7e0725889ae752e6a9fdbac5b1d2ef0e3f62822e RMD160 (ada-bootstrap.i386.dragonfly.36A.tar.bz2) = f62c00515588804ce69368507822f30380d7e48d @@ -24,9 +24,6 @@ Size (ada-bootstrap.x86_64.freebsd.84.tar.bz2) = 40227668 bytes SHA1 (ada-bootstrap.x86_64.netbsd.614.tar.bz2) = 683f58e6e394a508a52ec1dc5f3d9ca2869d5252 RMD160 (ada-bootstrap.x86_64.netbsd.614.tar.bz2) = 4574857089e82fb80725161cc8b625ce75f6810e Size (ada-bootstrap.x86_64.netbsd.614.tar.bz2) = 39348972 bytes -SHA1 (ada-bootstrap.x86_64.openbsd.55.tar.bz2) = 18ee97939bd95e70cfc5773eb4cfb075f22e50e6 -RMD160 (ada-bootstrap.x86_64.openbsd.55.tar.bz2) = 8563f665f52e13ae4a379ae71a183bb01470fb78 -Size (ada-bootstrap.x86_64.openbsd.55.tar.bz2) = 38753186 bytes SHA1 (ada-bootstrap.x86_64.solaris.511.tar.bz2) = abb16c1582e2a6ffe37df4afd96d04c44f2eea7b RMD160 (ada-bootstrap.x86_64.solaris.511.tar.bz2) = 41677e2fd0cb02c89f200fb97b112ad3be7f19cd Size (ada-bootstrap.x86_64.solaris.511.tar.bz2) = 60110383 bytes diff --git a/lang/gcc-aux/files/diff-ada b/lang/gcc-aux/files/diff-ada index 4b22475cd16..06fcc7c514c 100644 --- a/lang/gcc-aux/files/diff-ada +++ b/lang/gcc-aux/files/diff-ada @@ -1,28 +1,3 @@ ---- gcc/ada/a-exetim-posix.adb.orig -+++ gcc/ada/a-exetim-posix.adb -@@ -105,11 +105,11 @@ - -- Time is equal to Duration (although it is a private type) and - -- CPU_Time is equal to Time. - -- function clock_gettime -+ function clock_gettime_int - (clock_id : Interfaces.C.int; - tp : access timespec) - return int; -- pragma Import (C, clock_gettime, "clock_gettime"); -+ pragma Import (C, clock_gettime_int, "clock_gettime"); - -- Function from the POSIX.1b Realtime Extensions library - - begin -@@ -117,7 +117,7 @@ - raise Program_Error; - end if; - -- Result := clock_gettime -+ Result := clock_gettime_int - (clock_id => CLOCK_THREAD_CPUTIME_ID, tp => TS'Unchecked_Access); - pragma Assert (Result = 0); - --- /dev/null +++ gcc/ada/a-intnam-dragonfly.ads @@ -0,0 +1,136 @@ @@ -304,156 +279,42 @@ + System.OS_Interface.SIGPWR; -- power fail/restart + +end Ada.Interrupts.Names; ---- /dev/null -+++ gcc/ada/a-intnam-openbsd.ads -@@ -0,0 +1,136 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- A D A . I N T E R R U P T S . N A M E S -- -+-- -- -+-- S p e c -- -+-- -- -+-- Copyright (C) 1991-2011, 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. -- -+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This is the OpenBSD THREADS version of this package -+ -+with System.OS_Interface; -+ -+package Ada.Interrupts.Names is -+ -+ -- All identifiers in this unit are implementation defined -+ -+ pragma Implementation_Defined; -+ -+ -- Beware that the mapping of names to signals may be many-to-one. There -+ -- may be aliases. Also, for all signal names that are not supported on -+ -- the current system the value of the corresponding constant will be zero. -+ -+ SIGHUP : constant Interrupt_ID := -+ System.OS_Interface.SIGHUP; -- hangup -+ -+ SIGINT : constant Interrupt_ID := -+ System.OS_Interface.SIGINT; -- interrupt (rubout) -+ -+ SIGQUIT : constant Interrupt_ID := -+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS) -+ -+ SIGILL : constant Interrupt_ID := -+ System.OS_Interface.SIGILL; -- illegal instruction (not reset) -+ -+ SIGTRAP : constant Interrupt_ID := -+ System.OS_Interface.SIGTRAP; -- trace trap (not reset) -+ -+ SIGIOT : constant Interrupt_ID := -+ System.OS_Interface.SIGIOT; -- IOT instruction -+ -+ SIGABRT : constant Interrupt_ID := -- used by abort, -+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future -+ -+ SIGFPE : constant Interrupt_ID := -+ System.OS_Interface.SIGFPE; -- floating point exception -+ -+ SIGKILL : constant Interrupt_ID := -+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored) -+ -+ SIGBUS : constant Interrupt_ID := -+ System.OS_Interface.SIGBUS; -- bus error -+ -+ SIGSEGV : constant Interrupt_ID := -+ System.OS_Interface.SIGSEGV; -- segmentation violation -+ -+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with -+ System.OS_Interface.SIGPIPE; -- no one to read it -+ -+ SIGALRM : constant Interrupt_ID := -+ System.OS_Interface.SIGALRM; -- alarm clock -+ -+ SIGTERM : constant Interrupt_ID := -+ System.OS_Interface.SIGTERM; -- software termination signal from kill -+ -+ SIGURG : constant Interrupt_ID := -+ System.OS_Interface.SIGURG; -- urgent condition on IO channel -+ -+ SIGSTOP : constant Interrupt_ID := -+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored) -+ -+ SIGTSTP : constant Interrupt_ID := -+ System.OS_Interface.SIGTSTP; -- user stop requested from tty -+ -+ SIGCONT : constant Interrupt_ID := -+ System.OS_Interface.SIGCONT; -- stopped process has been continued -+ -+ SIGCHLD : constant Interrupt_ID := -+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD -+ -+ SIGCLD : constant Interrupt_ID := -+ System.OS_Interface.SIGCLD; -- child status change -+ -+ SIGTTIN : constant Interrupt_ID := -+ System.OS_Interface.SIGTTIN; -- background tty read attempted -+ -+ SIGTTOU : constant Interrupt_ID := -+ System.OS_Interface.SIGTTOU; -- background tty write attempted -+ -+ SIGIO : constant Interrupt_ID := -- input/output possible, -+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris) -+ -+ SIGXCPU : constant Interrupt_ID := -+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded -+ -+ SIGXFSZ : constant Interrupt_ID := -+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded -+ -+ SIGVTALRM : constant Interrupt_ID := -+ System.OS_Interface.SIGVTALRM; -- virtual timer expired -+ -+ SIGPROF : constant Interrupt_ID := -+ System.OS_Interface.SIGPROF; -- profiling timer expired -+ -+ SIGWINCH : constant Interrupt_ID := -+ System.OS_Interface.SIGWINCH; -- window size change -+ -+ SIGUSR1 : constant Interrupt_ID := -+ System.OS_Interface.SIGUSR1; -- user defined signal 1 -+ -+ SIGUSR2 : constant Interrupt_ID := -+ System.OS_Interface.SIGUSR2; -- user defined signal 2 -+ -+end Ada.Interrupts.Names; --- gcc/ada/adaint.c.orig +++ gcc/ada/adaint.c -@@ -1144,6 +1144,7 @@ - strcpy (path, "GNAT-XXXXXX"); +@@ -577,8 +577,8 @@ + GNAT_STRUCT_STAT stat_result; + int fd; + +- sprintf (full_path, "%s%c%s", dir, DIR_SEPARATOR, file); +- sprintf (temp_file, "%s%cTMP-%ld-%ld", ++ snprintf (full_path, 256, "%s%c%s", dir, DIR_SEPARATOR, file); ++ snprintf (temp_file, 256, "%s%cTMP-%ld-%ld", + dir, DIR_SEPARATOR, (long)getpid(), (long)getppid ()); + + /* Create the temporary file and write the process number. */ +@@ -745,7 +745,8 @@ + strcpy (encoding, "encoding=utf8"); + *e_length = strlen (encoding); + #else +- strcpy (os_name, filename); ++ /* o_length is initialized with max os_name size (2x filename size) */ ++ strncpy (os_name, filename, *o_length); + *o_length = strlen (filename); + *e_length = 0; + #endif +@@ -1141,9 +1142,10 @@ + int fd; + int o_fmode = O_BINARY; + +- strcpy (path, "GNAT-XXXXXX"); ++ strncpy (path, "GNAT-XXXXXX", 12); #if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \ + || defined (__DragonFly__) \ || defined (linux) || defined(__GLIBC__)) && !defined (__vxworks) return mkstemp (path); #elif defined (__Lynx__) -@@ -1310,7 +1311,49 @@ +@@ -1310,7 +1312,49 @@ free (pname); } @@ -471,9 +332,9 @@ + char *datadir = getenv ("ANDROID_DATA"); + + if (datadir == NULL) -+ strcpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX"); ++ strncpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX", L_tmpnam); + else -+ sprintf (tmp_filename, "%s/local/tmp/gnat-XXXXXX", datadir); ++ snprintf (tmp_filename, L_tmpnam, "%s/local/tmp/gnat-XXXXXX", datadir); + + testfd = mkstemp (tmp_filename); + if (testfd != -1) @@ -485,9 +346,9 @@ + char *sdcard = getenv ("EXTERNAL_STORAGE"); + + if (sdcard == NULL) -+ strcpy (tmp_filename, "/sdcard/gnat-XXXXXX"); ++ strncpy (tmp_filename, "/sdcard/gnat-XXXXXX", L_tmpnam); + else -+ sprintf (tmp_filename, "%s/gnat-XXXXXX", sdcard); ++ snprintf (tmp_filename, L_tmpnam, "%s/gnat-XXXXXX", sdcard); + + testfd = mkstemp (tmp_filename); + if (testfd != -1) @@ -503,7 +364,19 @@ || defined (__OpenBSD__) || defined(__GLIBC__) #define MAX_SAFE_PATH 1000 char *tmpdir = getenv ("TMPDIR"); -@@ -2562,7 +2605,9 @@ +@@ -1318,9 +1362,9 @@ + /* If tmpdir is longer than MAX_SAFE_PATH, revert to default value to avoid + a buffer overflow. */ + if (tmpdir == NULL || strlen (tmpdir) > MAX_SAFE_PATH) +- strcpy (tmp_filename, "/tmp/gnat-XXXXXX"); ++ strncpy (tmp_filename, "/tmp/gnat-XXXXXX", L_tmpnam); + else +- sprintf (tmp_filename, "%s/gnat-XXXXXX", tmpdir); ++ snprintf (tmp_filename, L_tmpnam, "%s/gnat-XXXXXX", tmpdir); + + close (mkstemp(tmp_filename)); + #elif defined (__vxworks) && !(defined (__RTP__) || defined (VTHREADS)) +@@ -2562,7 +2606,9 @@ { int cores = 1; @@ -514,7 +387,7 @@ cores = (int) sysconf (_SC_NPROCESSORS_ONLN); #elif defined (__hpux__) -@@ -3608,35 +3653,6 @@ +@@ -3608,35 +3654,6 @@ } #endif @@ -1008,629 +881,6 @@ + +end GNAT.Sockets.Thin; --- /dev/null -+++ gcc/ada/g-socthi-netbsd.adb -@@ -0,0 +1,358 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT COMPILER COMPONENTS -- -+-- -- -+-- G N A T . S O C K E T S . T H I N -- -+-- -- -+-- B o d y -- -+-- -- -+-- Copyright (C) 2001-2013, AdaCore -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNAT was originally developed by the GNAT team at New York University. -- -+-- Extensive contributions were provided by Ada Core Technologies Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This package provides a target dependent thin interface to the sockets -+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package -+-- should not be directly with'ed by an applications program. -+ -+-- This is the NetBSD version which uses fcntl rather than ioctl -+-- The constant SCON.Thread_Blocking_IO is always true (for all platforms, not -+-- just *BSD), so this binding is significantly simpler than the standard -+-- one it replaces. -+-- NetBSD uses binary compatibility functions that are forcing the use of -+-- their own files rather than sharing the *BSD versions. -+ -+with GNAT.OS_Lib; use GNAT.OS_Lib; -+ -+with Interfaces.C; use Interfaces.C; -+ -+package body GNAT.Sockets.Thin is -+ -+ function Syscall_Accept -+ (S : C.int; -+ Addr : System.Address; -+ Addrlen : not null access C.int) return C.int; -+ pragma Import (C, Syscall_Accept, "accept"); -+ -- The accept() function accepts a connection on a socket. An incoming -+ -- connection is acknowledged and associated with an immediately created -+ -- socket. The original socket is returned to the listening state. -+ -+ function Syscall_Connect -+ (S : C.int; -+ Name : System.Address; -+ Namelen : C.int) return C.int; -+ pragma Import (C, Syscall_Connect, "connect"); -+ -- The connect() system call initiates a connection on a socket. If the -+ -- parameter S is of type SOCK_DGRAM then connect() permanently specifies -+ -- the peer to which datagrams are to be sent. If S is type SOCK_STREAM -+ -- then connect() attempts to make a connection with another socket, which -+ -- is identified by the parameter Name. -+ -+ function Syscall_Recv -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int) return C.int; -+ pragma Import (C, Syscall_Recv, "recv"); -+ -- The recv() function receives a message from a socket. The call can be -+ -- used on a connection mode socket or a bound, connectionless socket. If -+ -- no messages are available at the socket, the recv() call waits for a -+ -- message to arrive unless the socket is non-blocking. If a socket is -+ -- non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK. -+ -+ function Syscall_Recvfrom -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int; -+ From : System.Address; -+ Fromlen : not null access C.int) return C.int; -+ pragma Import (C, Syscall_Recvfrom, "recvfrom"); -+ -- The recvfrom() system call receives a message from a socket and captures -+ -- the address from which the data was sent. It can be used to receive -+ -- data on an unconnected socket as well. If no messages are available, -+ -- the call waits for a message to arrive on blocking sockets. For -+ -- non-blocking sockets without messages, -1 is returned and ERRNO is set -+ -- to EAGAIN or EWOULDBLOCK. -+ -+ function Syscall_Recvmsg -+ (S : C.int; -+ Msg : System.Address; -+ Flags : C.int) return System.CRTL.ssize_t; -+ pragma Import (C, Syscall_Recvmsg, "recvmsg"); -+ -- The recvmsg call receives a message from a socket, and can be used to -+ -- receive data on an unconnected socket as well. If no messages are -+ -- available, the call waits for a message to arrive on blocking sockets. -+ -- For non-blocking sockets without messages, -1 is returned and ERRNO is -+ -- set to EAGAIN or EWOULDBLOCK. -+ -+ function Syscall_Sendmsg -+ (S : C.int; -+ Msg : System.Address; -+ Flags : C.int) return System.CRTL.ssize_t; -+ pragma Import (C, Syscall_Sendmsg, "sendmsg"); -+ -- The sendmsg() function sends a message to a socket, and can be used with -+ -- unconnected sockets as well (the msg is ignored in this case). The -+ -- function returns the number of bytes sent when successful, otherwise it -+ -- returns -1 and ERRNO is set (many possible values). -+ -+ function Syscall_Sendto -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int; -+ To : System.Address; -+ Tolen : C.int) return C.int; -+ pragma Import (C, Syscall_Sendto, "sendto"); -+ -- The sendto() function only works for connected sockets and it initiates -+ -- the transmission of a message. A successful call returns the numbers of -+ -- bytes sent, and a failure returns a -1 and ERRNO is set. -+ -+ function Syscall_Socket -+ (Domain : C.int; -+ Typ : C.int; -+ Protocol : C.int) return C.int; -+ pragma Import (C, Syscall_Socket, "__socket30"); -+ -- The socket() function is used to create an unbound socket and returns a -+ -- file descriptor that can be used with other socket functions. Upon -+ -- failure, a -1 is returned and ERRNO is set. -+ -+ procedure Disable_SIGPIPE (S : C.int); -+ pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe"); -+ -+ procedure Disable_All_SIGPIPEs; -+ pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes"); -+ -- Sets the process to ignore all SIGPIPE signals on platforms that -+ -- don't support Disable_SIGPIPE for particular streams. -+ -+ function C_Fcntl -+ (Fd : C.int; -+ Cmd : C.int; -+ Val : C.int) return C.int; -+ pragma Import (C, C_Fcntl, "fcntl"); -+ -- The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support -+ -- setting a socket in non-blocking mode. fcntl must be used instead. -+ -+ -------------- -+ -- C_Accept -- -+ -------------- -+ -+ function C_Accept -+ (S : C.int; -+ Addr : System.Address; -+ Addrlen : not null access C.int) return C.int -+ is -+ R : constant C.int := Syscall_Accept (S, Addr, Addrlen); -+ begin -+ -+ Disable_SIGPIPE (R); -+ return R; -+ end C_Accept; -+ -+ --------------- -+ -- C_Connect -- -+ --------------- -+ -+ function C_Connect -+ (S : C.int; -+ Name : System.Address; -+ Namelen : C.int) return C.int -+ is -+ begin -+ return Syscall_Connect (S, Name, Namelen); -+ end C_Connect; -+ -+ ------------------ -+ -- Socket_Ioctl -- -+ ------------------ -+ -+ function Socket_Ioctl -+ (S : C.int; -+ Req : SOSC.IOCTL_Req_T; -+ Arg : access C.int) return C.int -+ is -+ begin -+ if Req = SOSC.FIONBIO then -+ declare -+ use Interfaces; -+ flags : constant Unsigned_32 := -+ Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0)); -+ nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.O_NDELAY); -+ enabled : constant Boolean := Arg.all = 1; -+ newval : C.int := C.int (flags); -+ begin -+ if enabled then -+ newval := C.int (flags or nonblock); -+ elsif (flags and nonblock) > 0 then -+ newval := C.int (flags - nonblock); -+ end if; -+ return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval); -+ end; -+ end if; -+ -+ return C_Ioctl (S, Req, Arg); -+ end Socket_Ioctl; -+ -+ ------------ -+ -- C_Recv -- -+ ------------ -+ -+ function C_Recv -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int) return C.int -+ is -+ begin -+ return Syscall_Recv (S, Msg, Len, Flags); -+ end C_Recv; -+ -+ ---------------- -+ -- C_Recvfrom -- -+ ---------------- -+ -+ function C_Recvfrom -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int; -+ From : System.Address; -+ Fromlen : not null access C.int) return C.int -+ is -+ begin -+ return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen); -+ end C_Recvfrom; -+ -+ --------------- -+ -- C_Recvmsg -- -+ --------------- -+ -+ function C_Recvmsg -+ (S : C.int; -+ Msg : System.Address; -+ Flags : C.int) return System.CRTL.ssize_t -+ is -+ begin -+ return Syscall_Recvmsg (S, Msg, Flags); -+ end C_Recvmsg; -+ -+ --------------- -+ -- C_Sendmsg -- -+ --------------- -+ -+ function C_Sendmsg -+ (S : C.int; -+ Msg : System.Address; -+ Flags : C.int) return System.CRTL.ssize_t -+ is -+ begin -+ return Syscall_Sendmsg (S, Msg, Flags); -+ end C_Sendmsg; -+ -+ -------------- -+ -- C_Sendto -- -+ -------------- -+ -+ function C_Sendto -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int; -+ To : System.Address; -+ Tolen : C.int) return C.int -+ is -+ begin -+ return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen); -+ end C_Sendto; -+ -+ -------------- -+ -- C_Socket -- -+ -------------- -+ -+ function C_Socket -+ (Domain : C.int; -+ Typ : C.int; -+ Protocol : C.int) return C.int -+ is -+ R : constant C.int := Syscall_Socket (Domain, Typ, Protocol); -+ begin -+ Disable_SIGPIPE (R); -+ return R; -+ end C_Socket; -+ -+ -------------- -+ -- Finalize -- -+ -------------- -+ -+ procedure Finalize is -+ begin -+ null; -+ end Finalize; -+ -+ ------------------------- -+ -- Host_Error_Messages -- -+ ------------------------- -+ -+ package body Host_Error_Messages is separate; -+ -+ ---------------- -+ -- Initialize -- -+ ---------------- -+ -+ procedure Initialize is -+ begin -+ Disable_All_SIGPIPEs; -+ end Initialize; -+ -+ -------------------- -+ -- Signalling_Fds -- -+ -------------------- -+ -+ package body Signalling_Fds is -+ -+ -- In this default implementation, we use a C version of these -+ -- subprograms provided by socket.c. -+ -+ function C_Create (Fds : not null access Fd_Pair) return C.int; -+ function C_Read (Rsig : C.int) return C.int; -+ function C_Write (Wsig : C.int) return C.int; -+ procedure C_Close (Sig : C.int); -+ -+ pragma Import (C, C_Create, "__gnat_create_signalling_fds"); -+ pragma Import (C, C_Read, "__gnat_read_signalling_fd"); -+ pragma Import (C, C_Write, "__gnat_write_signalling_fd"); -+ pragma Import (C, C_Close, "__gnat_close_signalling_fd"); -+ -+ function Create -+ (Fds : not null access Fd_Pair) return C.int renames C_Create; -+ function Read (Rsig : C.int) return C.int renames C_Read; -+ function Write (Wsig : C.int) return C.int renames C_Write; -+ procedure Close (Sig : C.int) renames C_Close; -+ -+ end Signalling_Fds; -+ -+ -------------------------- -+ -- Socket_Error_Message -- -+ -------------------------- -+ -+ function Socket_Error_Message (Errno : Integer) return String is separate; -+ -+end GNAT.Sockets.Thin; ---- /dev/null -+++ gcc/ada/g-socthi-netbsd6.ads -@@ -0,0 +1,259 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT COMPILER COMPONENTS -- -+-- -- -+-- G N A T . S O C K E T S . T H I N -- -+-- -- -+-- S p e c -- -+-- -- -+-- Copyright (C) 2001-2013, AdaCore -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNAT was originally developed by the GNAT team at New York University. -- -+-- Extensive contributions were provided by Ada Core Technologies Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This package provides a target dependent thin interface to the sockets -+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package -+-- should not be directly with'ed by an applications program. -+ -+-- This is the NetBSD 6+ version -+ -+with Interfaces.C; -+ -+with GNAT.OS_Lib; -+with GNAT.Sockets.Thin_Common; -+ -+with System; -+with System.CRTL; -+ -+package GNAT.Sockets.Thin is -+ -+ -- This package is intended for hosts implementing BSD sockets with a -+ -- standard interface. It will be used as a default for all the platforms -+ -- that do not have a specific version of this file. -+ -+ use Thin_Common; -+ -+ package C renames Interfaces.C; -+ -+ use type System.CRTL.ssize_t; -+ -+ function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -+ -- Returns last socket error number -+ -+ function Socket_Error_Message (Errno : Integer) return String; -+ -- Returns the error message string for the error number Errno. If Errno is -+ -- not known, returns "Unknown system error". -+ -+ function Host_Errno return Integer; -+ pragma Import (C, Host_Errno, "__gnat_get_h_errno"); -+ -- Returns last host error number -+ -+ package Host_Error_Messages is -+ -+ function Host_Error_Message (H_Errno : Integer) return String; -+ -- Returns the error message string for the host error number H_Errno. -+ -- If H_Errno is not known, returns "Unknown system error". -+ -+ end Host_Error_Messages; -+ -+ -------------------------------- -+ -- Standard library functions -- -+ -------------------------------- -+ -+ function C_Accept -+ (S : C.int; -+ Addr : System.Address; -+ Addrlen : not null access C.int) return C.int; -+ -+ function C_Bind -+ (S : C.int; -+ Name : System.Address; -+ Namelen : C.int) return C.int; -+ -+ function C_Close -+ (Fd : C.int) return C.int; -+ -+ function C_Connect -+ (S : C.int; -+ Name : System.Address; -+ Namelen : C.int) return C.int; -+ -+ function C_Gethostname -+ (Name : System.Address; -+ Namelen : C.int) return C.int; -+ -+ function C_Getpeername -+ (S : C.int; -+ Name : System.Address; -+ Namelen : not null access C.int) return C.int; -+ -+ function C_Getsockname -+ (S : C.int; -+ Name : System.Address; -+ Namelen : not null access C.int) return C.int; -+ -+ function C_Getsockopt -+ (S : C.int; -+ Level : C.int; -+ Optname : C.int; -+ Optval : System.Address; -+ Optlen : not null access C.int) return C.int; -+ -+ function Socket_Ioctl -+ (S : C.int; -+ Req : SOSC.IOCTL_Req_T; -+ Arg : access C.int) return C.int; -+ -+ function C_Listen -+ (S : C.int; -+ Backlog : C.int) return C.int; -+ -+ function C_Recv -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int) return C.int; -+ -+ function C_Recvfrom -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int; -+ From : System.Address; -+ Fromlen : not null access C.int) return C.int; -+ -+ function C_Recvmsg -+ (S : C.int; -+ Msg : System.Address; -+ Flags : C.int) return System.CRTL.ssize_t; -+ -+ function C_Select -+ (Nfds : C.int; -+ Readfds : access Fd_Set; -+ Writefds : access Fd_Set; -+ Exceptfds : access Fd_Set; -+ Timeout : Timeval_Access) return C.int; -+ -+ function C_Sendmsg -+ (S : C.int; -+ Msg : System.Address; -+ Flags : C.int) return System.CRTL.ssize_t; -+ -+ function C_Sendto -+ (S : C.int; -+ Msg : System.Address; -+ Len : C.int; -+ Flags : C.int; -+ To : System.Address; -+ Tolen : C.int) return C.int; -+ -+ function C_Setsockopt -+ (S : C.int; -+ Level : C.int; -+ Optname : C.int; -+ Optval : System.Address; -+ Optlen : C.int) return C.int; -+ -+ function C_Shutdown -+ (S : C.int; -+ How : C.int) return C.int; -+ -+ function C_Socket -+ (Domain : C.int; -+ Typ : C.int; -+ Protocol : C.int) return C.int; -+ -+ function C_System -+ (Command : System.Address) return C.int; -+ -+ ------------------------------------------------------- -+ -- Signalling file descriptors for selector abortion -- -+ ------------------------------------------------------- -+ -+ package Signalling_Fds is -+ -+ function Create (Fds : not null access Fd_Pair) return C.int; -+ pragma Convention (C, Create); -+ -- Create a pair of connected descriptors suitable for use with C_Select -+ -- (used for signalling in Selector objects). -+ -+ function Read (Rsig : C.int) return C.int; -+ pragma Convention (C, Read); -+ -- Read one byte of data from rsig, the read end of a pair of signalling -+ -- fds created by Create_Signalling_Fds. -+ -+ function Write (Wsig : C.int) return C.int; -+ pragma Convention (C, Write); -+ -- Write one byte of data to wsig, the write end of a pair of signalling -+ -- fds created by Create_Signalling_Fds. -+ -+ procedure Close (Sig : C.int); -+ pragma Convention (C, Close); -+ -- Close one end of a pair of signalling fds (ignoring any error) -+ -+ end Signalling_Fds; -+ -+ ------------------------------------------- -+ -- Nonreentrant network databases access -- -+ ------------------------------------------- -+ -+ -- The following are used only on systems that have nonreentrant -+ -- getXXXbyYYY functions, and do NOT have corresponding getXXXbyYYY_ -+ -- functions. Currently, LynxOS is the only such system. -+ -+ function Nonreentrant_Gethostbyname -+ (Name : C.char_array) return Hostent_Access; -+ -+ function Nonreentrant_Gethostbyaddr -+ (Addr : System.Address; -+ Addr_Len : C.int; -+ Addr_Type : C.int) return Hostent_Access; -+ -+ function Nonreentrant_Getservbyname -+ (Name : C.char_array; -+ Proto : C.char_array) return Servent_Access; -+ -+ function Nonreentrant_Getservbyport -+ (Port : C.int; -+ Proto : C.char_array) return Servent_Access; -+ -+ procedure Initialize; -+ procedure Finalize; -+ -+private -+ pragma Import (C, C_Bind, "bind"); -+ pragma Import (C, C_Close, "close"); -+ pragma Import (C, C_Gethostname, "gethostname"); -+ pragma Import (C, C_Getpeername, "getpeername"); -+ pragma Import (C, C_Getsockname, "getsockname"); -+ pragma Import (C, C_Getsockopt, "getsockopt"); -+ pragma Import (C, C_Listen, "listen"); -+ pragma Import (C, C_Select, "__select50"); -+ pragma Import (C, C_Setsockopt, "setsockopt"); -+ pragma Import (C, C_Shutdown, "shutdown"); -+ pragma Import (C, C_System, "system"); -+ -+ pragma Import (C, Nonreentrant_Gethostbyname, "gethostbyname"); -+ pragma Import (C, Nonreentrant_Gethostbyaddr, "gethostbyaddr"); -+ pragma Import (C, Nonreentrant_Getservbyname, "getservbyname"); -+ pragma Import (C, Nonreentrant_Getservbyport, "getservbyport"); -+ -+end GNAT.Sockets.Thin; ---- /dev/null +++ gcc/ada/g-trasym-bsd.adb @@ -0,0 +1,150 @@ +------------------------------------------------------------------------------ @@ -1816,7 +1066,7 @@ #warning Sockets not supported on these platforms #undef HAVE_SOCKETS -@@ -198,8 +198,19 @@ +@@ -203,8 +203,19 @@ #include <netdb.h> #endif @@ -1838,7 +1088,7 @@ # define HAVE_THREAD_SAFE_GETxxxBYyyy 1 #elif defined (linux) || defined (__GLIBC__) || \ -@@ -231,7 +242,13 @@ +@@ -236,7 +247,13 @@ # endif #endif @@ -1855,7 +1105,7 @@ # define Has_Sockaddr_Len 0 --- gcc/ada/init.c.orig +++ gcc/ada/init.c -@@ -1623,7 +1623,7 @@ +@@ -1628,7 +1628,7 @@ /* FreeBSD Section */ /*******************/ @@ -1864,7 +1114,7 @@ #include <signal.h> #include <sys/ucontext.h> -@@ -1668,7 +1668,7 @@ +@@ -1673,7 +1673,7 @@ } void @@ -1873,7 +1123,7 @@ { struct sigaction act; -@@ -2461,9 +2461,13 @@ +@@ -2466,9 +2466,13 @@ initialization of the FP processor. This version is used under INTERIX and WIN32. */ @@ -1993,6 +1243,19 @@ Gcc_Path : String_Access := null; Non_Empty_Node : constant Project_Node_Id := 1; +--- gcc/ada/s-osinte-android.ads.orig ++++ gcc/ada/s-osinte-android.ads +@@ -595,8 +595,8 @@ + type time_t is new long; + + type timespec is record +- tv_sec : time_t; +- tv_nsec : long; ++ ts_sec : time_t; ++ ts_nsec : long; + end record; + pragma Convention (C, timespec); + --- /dev/null +++ gcc/ada/s-osinte-dragonfly.adb @@ -0,0 +1,116 @@ @@ -2073,7 +1336,7 @@ + + function To_Duration (TS : timespec) return Duration is + begin -+ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; ++ return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9; + end To_Duration; + + ------------------------ @@ -2107,8 +1370,8 @@ + F := F + 1.0; + end if; + -+ return timespec'(tv_sec => S, -+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); ++ return timespec'(ts_sec => S, ++ ts_nsec => long (Long_Long_Integer (F * 10#1#E9))); + end To_Timespec; + +end System.OS_Interface; @@ -2749,8 +2012,8 @@ + type time_t is new long; + + type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; ++ ts_sec : time_t; ++ ts_nsec : long; + end record; + pragma Convention (C, timespec); + @@ -2783,1329 +2046,6 @@ end Get_Stack_Base; ------------------ -@@ -75,7 +75,7 @@ - - function To_Duration (TS : timespec) return Duration is - begin -- return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9; -+ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; - end To_Duration; - - ------------------------ -@@ -108,8 +108,8 @@ - F := F + 1.0; - end if; - -- return timespec'(ts_sec => S, -- ts_nsec => long (Long_Long_Integer (F * 10#1#E9))); -+ return timespec'(tv_sec => S, -+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); - end To_Timespec; - - end System.OS_Interface; ---- /dev/null -+++ gcc/ada/s-osinte-freebsd32.ads -@@ -0,0 +1,648 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ I N T E R F A C E -- -+-- -- -+-- S p e c -- -+-- -- -+-- Copyright (C) 1991-1994, Florida State University -- -+-- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. It is -- -+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -+-- State University (http://www.gnat.com). -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This is the FreeBSD PTHREADS version of this package -+ -+-- This package encapsulates all direct interfaces to OS services -+-- that are needed by the tasking run-time (libgnarl). -+ -+-- 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. -+ -+with Ada.Unchecked_Conversion; -+ -+with Interfaces.C; -+ -+package System.OS_Interface is -+ pragma Preelaborate; -+ -+ pragma Linker_Options ("-pthread"); -+ -+ subtype int is Interfaces.C.int; -+ subtype short is Interfaces.C.short; -+ subtype long is Interfaces.C.long; -+ subtype unsigned is Interfaces.C.unsigned; -+ subtype unsigned_short is Interfaces.C.unsigned_short; -+ subtype unsigned_long is Interfaces.C.unsigned_long; -+ subtype unsigned_char is Interfaces.C.unsigned_char; -+ subtype plain_char is Interfaces.C.plain_char; -+ subtype size_t is Interfaces.C.size_t; -+ -+ ----------- -+ -- Errno -- -+ ----------- -+ -+ function Errno return int; -+ pragma Inline (Errno); -+ -+ EAGAIN : constant := 35; -+ EINTR : constant := 4; -+ EINVAL : constant := 22; -+ ENOMEM : constant := 12; -+ ETIMEDOUT : constant := 60; -+ -+ ------------- -+ -- Signals -- -+ ------------- -+ -+ Max_Interrupt : constant := 31; -+ type Signal is new int range 0 .. Max_Interrupt; -+ for Signal'Size use int'Size; -+ -+ 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 -+ SIGEMT : constant := 7; -- EMT instruction -+ SIGFPE : constant := 8; -- floating point exception -+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored) -+ SIGBUS : constant := 10; -- bus error -+ SIGSEGV : constant := 11; -- segmentation violation -+ SIGSYS : constant := 12; -- bad argument to system call -+ 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 -+ SIGURG : constant := 16; -- urgent condition on IO channel -+ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) -+ SIGTSTP : constant := 18; -- user stop requested from tty -+ SIGCONT : constant := 19; -- stopped process has been continued -+ SIGCLD : constant := 20; -- alias for SIGCHLD -+ SIGCHLD : constant := 20; -- child status change -+ SIGTTIN : constant := 21; -- background tty read attempted -+ SIGTTOU : constant := 22; -- background tty write attempted -+ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias) -+ SIGXCPU : constant := 24; -- CPU time limit exceeded -+ SIGXFSZ : constant := 25; -- filesize limit exceeded -+ SIGVTALRM : constant := 26; -- virtual timer expired -+ SIGPROF : constant := 27; -- profiling timer expired -+ SIGWINCH : constant := 28; -- window size change -+ SIGINFO : constant := 29; -- information request (BSD) -+ SIGUSR1 : constant := 30; -- user defined signal 1 -+ SIGUSR2 : constant := 31; -- user defined signal 2 -+ -+ SIGADAABORT : constant := SIGABRT; -+ -- Change this if you want to use another signal for task abort. -+ -- SIGTERM might be a good one. -+ -+ type Signal_Set is array (Natural range <>) of Signal; -+ -+ -- Interrupts that must be unmasked at all times. FreeBSD -+ -- pthreads will not allow an application to mask out any -+ -- interrupt needed by the threads library. -+ Unmasked : constant Signal_Set := -+ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP); -+ -+ -- FreeBSD will uses SIGPROF for timing. Do not allow a -+ -- handler to attach to this signal. -+ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF); -+ -+ type sigset_t is private; -+ -+ function sigaddset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigaddset, "sigaddset"); -+ -+ function sigdelset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigdelset, "sigdelset"); -+ -+ function sigfillset (set : access sigset_t) return int; -+ pragma Import (C, sigfillset, "sigfillset"); -+ -+ function sigismember -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigismember, "sigismember"); -+ -+ function sigemptyset (set : access sigset_t) return int; -+ pragma Import (C, sigemptyset, "sigemptyset"); -+ -+ -- sigcontext is architecture dependent, so define it private -+ type struct_sigcontext is private; -+ -+ type old_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_mask : sigset_t; -+ sa_flags : int; -+ end record; -+ pragma Convention (C, old_struct_sigaction); -+ -+ type new_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_flags : int; -+ sa_mask : sigset_t; -+ end record; -+ pragma Convention (C, new_struct_sigaction); -+ -+ subtype struct_sigaction is new_struct_sigaction; -+ type struct_sigaction_ptr is access all struct_sigaction; -+ -+ SIG_BLOCK : constant := 1; -+ SIG_UNBLOCK : constant := 2; -+ SIG_SETMASK : constant := 3; -+ -+ SIG_DFL : constant := 0; -+ SIG_IGN : constant := 1; -+ -+ SA_SIGINFO : constant := 16#0040#; -+ SA_ONSTACK : constant := 16#0001#; -+ -+ function sigaction -+ (sig : Signal; -+ act : struct_sigaction_ptr; -+ oact : struct_sigaction_ptr) return int; -+ pragma Import (C, sigaction, "sigaction"); -+ -+ ---------- -+ -- Time -- -+ ---------- -+ -+ Time_Slice_Supported : constant Boolean := True; -+ -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) -+ -+ type timespec is private; -+ -+ function nanosleep (rqtp, rmtp : access timespec) return int; -+ pragma Import (C, nanosleep, "nanosleep"); -+ -+ type clockid_t is new int; -+ -+ function clock_gettime -+ (clock_id : clockid_t; -+ tp : access timespec) -+ return int; -+ pragma Import (C, clock_gettime, "clock_gettime"); -+ -+ function To_Duration (TS : timespec) return Duration; -+ pragma Inline (To_Duration); -+ -+ function To_Timespec (D : Duration) return timespec; -+ pragma Inline (To_Timespec); -+ -+ type struct_timezone is record -+ tz_minuteswest : int; -+ tz_dsttime : int; -+ end record; -+ pragma Convention (C, struct_timezone); -+ -+ procedure usleep (useconds : unsigned_long); -+ pragma Import (C, usleep, "usleep"); -+ -+ ------------------------- -+ -- Priority Scheduling -- -+ ------------------------- -+ -+ SCHED_FIFO : constant := 1; -+ SCHED_OTHER : constant := 2; -+ SCHED_RR : constant := 3; -+ -+ function To_Target_Priority -+ (Prio : System.Any_Priority) return Interfaces.C.int; -+ -- Maps System.Any_Priority to a POSIX priority -+ -+ ------------- -+ -- Process -- -+ ------------- -+ -+ type pid_t is private; -+ -+ function kill (pid : pid_t; sig : Signal) return int; -+ pragma Import (C, kill, "kill"); -+ -+ function getpid return pid_t; -+ pragma Import (C, getpid, "getpid"); -+ -+ --------- -+ -- LWP -- -+ --------- -+ -+ function lwp_self return System.Address; -+ -- lwp_self does not exist on this thread library, revert to pthread_self -+ -- which is the closest approximation (with getpid). This function is -+ -- needed to share 7staprop.adb across POSIX-like targets. -+ pragma Import (C, lwp_self, "pthread_self"); -+ -+ ------------- -+ -- Threads -- -+ ------------- -+ -+ type Thread_Body is access -+ function (arg : System.Address) return System.Address; -+ pragma Convention (C, Thread_Body); -+ -+ function Thread_Body_Access is new -+ Ada.Unchecked_Conversion (System.Address, Thread_Body); -+ -+ type pthread_t is private; -+ subtype Thread_Id is pthread_t; -+ -+ type pthread_mutex_t is limited private; -+ type pthread_cond_t is limited private; -+ type pthread_attr_t is limited private; -+ type pthread_mutexattr_t is limited private; -+ type pthread_condattr_t is limited private; -+ type pthread_key_t is private; -+ -+ PTHREAD_CREATE_DETACHED : constant := 1; -+ PTHREAD_CREATE_JOINABLE : constant := 0; -+ -+ PTHREAD_SCOPE_PROCESS : constant := 0; -+ PTHREAD_SCOPE_SYSTEM : constant := 2; -+ -+ -- Read/Write lock not supported on freebsd. To add support both types -+ -- pthread_rwlock_t and pthread_rwlockattr_t must properly be defined -+ -- with the associated routines pthread_rwlock_[init/destroy] and -+ -- pthread_rwlock_[rdlock/wrlock/unlock]. -+ -+ subtype pthread_rwlock_t is pthread_mutex_t; -+ subtype pthread_rwlockattr_t is pthread_mutexattr_t; -+ -+ ----------- -+ -- Stack -- -+ ----------- -+ -+ type stack_t is record -+ ss_sp : System.Address; -+ ss_size : size_t; -+ ss_flags : int; -+ end record; -+ pragma Convention (C, stack_t); -+ -+ function sigaltstack -+ (ss : not null access stack_t; -+ oss : access stack_t) return int; -+ pragma Import (C, sigaltstack, "sigaltstack"); -+ -+ Alternate_Stack : aliased System.Address; -+ -- This is a dummy definition, never used (Alternate_Stack_Size is null) -+ -+ Alternate_Stack_Size : constant := 0; -+ -- No alternate signal stack is used on this platform -+ -+ Stack_Base_Available : constant Boolean := False; -+ -- Indicates whether the stack base is available on this target. This -+ -- allows us to share s-osinte.adb between all the FSU run time. Note that -+ -- this value can only be true if pthread_t has a complete definition that -+ -- corresponds exactly to the C header files. -+ -+ function Get_Stack_Base (thread : pthread_t) return Address; -+ pragma Inline (Get_Stack_Base); -+ -- returns the stack base of the specified thread. Only call this function -+ -- when Stack_Base_Available is True. -+ -+ function Get_Page_Size return size_t; -+ function Get_Page_Size return Address; -+ pragma Import (C, Get_Page_Size, "getpagesize"); -+ -- Returns the size of a page -+ -+ PROT_NONE : constant := 0; -+ PROT_READ : constant := 1; -+ PROT_WRITE : constant := 2; -+ PROT_EXEC : constant := 4; -+ PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; -+ PROT_ON : constant := PROT_NONE; -+ PROT_OFF : constant := PROT_ALL; -+ -+ function mprotect (addr : Address; len : size_t; prot : int) return int; -+ pragma Import (C, mprotect); -+ -+ --------------------------------------- -+ -- Nonstandard Thread Initialization -- -+ --------------------------------------- -+ -+ -- FSU_THREADS requires pthread_init, which is nonstandard and this should -+ -- be invoked during the elaboration of s-taprop.adb. -+ -+ -- FreeBSD does not require this so we provide an empty Ada body -+ -+ procedure pthread_init; -+ -+ ------------------------- -+ -- POSIX.1c Section 3 -- -+ ------------------------- -+ -+ function sigwait -+ (set : access sigset_t; -+ sig : access Signal) return int; -+ pragma Import (C, sigwait, "sigwait"); -+ -+ function pthread_kill -+ (thread : pthread_t; -+ sig : Signal) return int; -+ pragma Import (C, pthread_kill, "pthread_kill"); -+ -+ function pthread_sigmask -+ (how : int; -+ set : access sigset_t; -+ oset : access sigset_t) return int; -+ pragma Import (C, pthread_sigmask, "pthread_sigmask"); -+ -+ -------------------------- -+ -- POSIX.1c Section 11 -- -+ -------------------------- -+ -+ function pthread_mutexattr_init -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); -+ -+ function pthread_mutexattr_destroy -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); -+ -+ function pthread_mutex_init -+ (mutex : access pthread_mutex_t; -+ attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); -+ -+ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); -+ -+ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); -+ -+ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); -+ -+ function pthread_condattr_init -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); -+ -+ function pthread_condattr_destroy -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); -+ -+ function pthread_cond_init -+ (cond : access pthread_cond_t; -+ attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_cond_init, "pthread_cond_init"); -+ -+ function pthread_cond_destroy (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); -+ -+ function pthread_cond_signal (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); -+ -+ function pthread_cond_wait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); -+ -+ function pthread_cond_timedwait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t; -+ abstime : access timespec) return int; -+ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); -+ -+ Relative_Timed_Wait : constant Boolean := False; -+ -- pthread_cond_timedwait requires an absolute delay time -+ -+ -------------------------- -+ -- POSIX.1c Section 13 -- -+ -------------------------- -+ -+ PTHREAD_PRIO_NONE : constant := 0; -+ PTHREAD_PRIO_PROTECT : constant := 2; -+ PTHREAD_PRIO_INHERIT : constant := 1; -+ -+ function pthread_mutexattr_setprotocol -+ (attr : access pthread_mutexattr_t; -+ protocol : int) return int; -+ pragma Import -+ (C, pthread_mutexattr_setprotocol, "pthread_mutexattr_setprotocol"); -+ -+ function pthread_mutexattr_getprotocol -+ (attr : access pthread_mutexattr_t; -+ protocol : access int) return int; -+ pragma Import -+ (C, pthread_mutexattr_getprotocol, "pthread_mutexattr_getprotocol"); -+ -+ function pthread_mutexattr_setprioceiling -+ (attr : access pthread_mutexattr_t; -+ prioceiling : int) return int; -+ pragma Import -+ (C, pthread_mutexattr_setprioceiling, -+ "pthread_mutexattr_setprioceiling"); -+ -+ function pthread_mutexattr_getprioceiling -+ (attr : access pthread_mutexattr_t; -+ prioceiling : access int) return int; -+ pragma Import -+ (C, pthread_mutexattr_getprioceiling, -+ "pthread_mutexattr_getprioceiling"); -+ -+ type struct_sched_param is record -+ sched_priority : int; -+ end record; -+ pragma Convention (C, struct_sched_param); -+ -+ function pthread_getschedparam -+ (thread : pthread_t; -+ policy : access int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_getschedparam, "pthread_getschedparam"); -+ -+ function pthread_setschedparam -+ (thread : pthread_t; -+ policy : int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); -+ -+ function pthread_attr_setscope -+ (attr : access pthread_attr_t; -+ contentionscope : int) return int; -+ pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); -+ -+ function pthread_attr_getscope -+ (attr : access pthread_attr_t; -+ contentionscope : access int) return int; -+ pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope"); -+ -+ function pthread_attr_setinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : int) return int; -+ pragma Import -+ (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched"); -+ -+ function pthread_attr_getinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : access int) return int; -+ pragma Import -+ (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched"); -+ -+ function pthread_attr_setschedpolicy -+ (attr : access pthread_attr_t; -+ policy : int) return int; -+ pragma Import (C, pthread_attr_setschedpolicy, -+ "pthread_attr_setschedpolicy"); -+ -+ function pthread_attr_getschedpolicy -+ (attr : access pthread_attr_t; -+ policy : access int) return int; -+ pragma Import (C, pthread_attr_getschedpolicy, -+ "pthread_attr_getschedpolicy"); -+ -+ function pthread_attr_setschedparam -+ (attr : access pthread_attr_t; -+ sched_param : int) return int; -+ pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam"); -+ -+ function pthread_attr_getschedparam -+ (attr : access pthread_attr_t; -+ sched_param : access int) return int; -+ pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam"); -+ -+ function sched_yield return int; -+ pragma Import (C, sched_yield, "pthread_yield"); -+ -+ -------------------------- -+ -- P1003.1c Section 16 -- -+ -------------------------- -+ -+ function pthread_attr_init (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_init, "pthread_attr_init"); -+ -+ function pthread_attr_destroy -+ (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); -+ -+ function pthread_attr_setdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : int) return int; -+ pragma Import -+ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); -+ -+ function pthread_attr_getdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : access int) return int; -+ pragma Import -+ (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate"); -+ -+ function pthread_attr_getstacksize -+ (attr : access pthread_attr_t; -+ stacksize : access size_t) return int; -+ pragma Import -+ (C, pthread_attr_getstacksize, "pthread_attr_getstacksize"); -+ -+ function pthread_attr_setstacksize -+ (attr : access pthread_attr_t; -+ stacksize : size_t) return int; -+ pragma Import -+ (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); -+ -+ function pthread_create -+ (thread : access pthread_t; -+ attributes : access pthread_attr_t; -+ start_routine : Thread_Body; -+ arg : System.Address) return int; -+ pragma Import (C, pthread_create, "pthread_create"); -+ -+ function pthread_detach (thread : pthread_t) return int; -+ pragma Import (C, pthread_detach, "pthread_detach"); -+ -+ procedure pthread_exit (status : System.Address); -+ pragma Import (C, pthread_exit, "pthread_exit"); -+ -+ function pthread_self return pthread_t; -+ pragma Import (C, pthread_self, "pthread_self"); -+ -+ -------------------------- -+ -- POSIX.1c Section 17 -- -+ -------------------------- -+ -+ function pthread_setspecific -+ (key : pthread_key_t; -+ value : System.Address) return int; -+ pragma Import (C, pthread_setspecific, "pthread_setspecific"); -+ -+ function pthread_getspecific (key : pthread_key_t) return System.Address; -+ pragma Import (C, pthread_getspecific, "pthread_getspecific"); -+ -+ type destructor_pointer is access procedure (arg : System.Address); -+ pragma Convention (C, destructor_pointer); -+ -+ function pthread_key_create -+ (key : access pthread_key_t; -+ destructor : destructor_pointer) return int; -+ pragma Import (C, pthread_key_create, "pthread_key_create"); -+ -+ ------------------------------------ -+ -- Non-portable Pthread Functions -- -+ ------------------------------------ -+ -+ function pthread_set_name_np -+ (thread : pthread_t; -+ name : System.Address) return int; -+ pragma Import (C, pthread_set_name_np, "pthread_set_name_np"); -+ -+private -+ -+ type sigset_t is array (1 .. 4) of unsigned; -+ -+ -- In FreeBSD the component sa_handler turns out to -+ -- be one a union type, and the selector is a macro: -+ -- #define sa_handler __sigaction_u._handler -+ -- #define sa_sigaction __sigaction_u._sigaction -+ -+ -- Should we add a signal_context type here ??? -+ -- How could it be done independent of the CPU architecture ??? -+ -- sigcontext type is opaque, so it is architecturally neutral. -+ -- It is always passed as an access type, so define it as an empty record -+ -- since the contents are not used anywhere. -+ -+ type struct_sigcontext is null record; -+ pragma Convention (C, struct_sigcontext); -+ -+ type pid_t is new int; -+ -+ type time_t is new int; -+ -+ type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; -+ end record; -+ pragma Convention (C, timespec); -+ -+ type pthread_t is new System.Address; -+ type pthread_attr_t is new System.Address; -+ type pthread_mutex_t is new System.Address; -+ type pthread_mutexattr_t is new System.Address; -+ type pthread_cond_t is new System.Address; -+ type pthread_condattr_t is new System.Address; -+ type pthread_key_t is new int; -+ -+end System.OS_Interface; ---- /dev/null -+++ gcc/ada/s-osinte-freebsd64.ads -@@ -0,0 +1,649 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ I N T E R F A C E -- -+-- -- -+-- S p e c -- -+-- -- -+-- Copyright (C) 1991-1994, Florida State University -- -+-- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. It is -- -+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -+-- State University (http://www.gnat.com). -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This is the FreeBSD PTHREADS version of this package -+ -+-- This package encapsulates all direct interfaces to OS services -+-- that are needed by the tasking run-time (libgnarl). -+ -+-- 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. -+ -+with Ada.Unchecked_Conversion; -+ -+with Interfaces.C; -+ -+package System.OS_Interface is -+ pragma Preelaborate; -+ -+ pragma Linker_Options ("-pthread"); -+ -+ subtype int is Interfaces.C.int; -+ subtype short is Interfaces.C.short; -+ subtype long is Interfaces.C.long; -+ subtype unsigned is Interfaces.C.unsigned; -+ subtype unsigned_short is Interfaces.C.unsigned_short; -+ subtype unsigned_long is Interfaces.C.unsigned_long; -+ subtype unsigned_char is Interfaces.C.unsigned_char; -+ subtype plain_char is Interfaces.C.plain_char; -+ subtype size_t is Interfaces.C.size_t; -+ subtype int64_t is Interfaces.Integer_64; -+ -+ ----------- -+ -- Errno -- -+ ----------- -+ -+ function Errno return int; -+ pragma Inline (Errno); -+ -+ EAGAIN : constant := 35; -+ EINTR : constant := 4; -+ EINVAL : constant := 22; -+ ENOMEM : constant := 12; -+ ETIMEDOUT : constant := 60; -+ -+ ------------- -+ -- Signals -- -+ ------------- -+ -+ Max_Interrupt : constant := 31; -+ type Signal is new int range 0 .. Max_Interrupt; -+ for Signal'Size use int'Size; -+ -+ 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 -+ SIGEMT : constant := 7; -- EMT instruction -+ SIGFPE : constant := 8; -- floating point exception -+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored) -+ SIGBUS : constant := 10; -- bus error -+ SIGSEGV : constant := 11; -- segmentation violation -+ SIGSYS : constant := 12; -- bad argument to system call -+ 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 -+ SIGURG : constant := 16; -- urgent condition on IO channel -+ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) -+ SIGTSTP : constant := 18; -- user stop requested from tty -+ SIGCONT : constant := 19; -- stopped process has been continued -+ SIGCLD : constant := 20; -- alias for SIGCHLD -+ SIGCHLD : constant := 20; -- child status change -+ SIGTTIN : constant := 21; -- background tty read attempted -+ SIGTTOU : constant := 22; -- background tty write attempted -+ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias) -+ SIGXCPU : constant := 24; -- CPU time limit exceeded -+ SIGXFSZ : constant := 25; -- filesize limit exceeded -+ SIGVTALRM : constant := 26; -- virtual timer expired -+ SIGPROF : constant := 27; -- profiling timer expired -+ SIGWINCH : constant := 28; -- window size change -+ SIGINFO : constant := 29; -- information request (BSD) -+ SIGUSR1 : constant := 30; -- user defined signal 1 -+ SIGUSR2 : constant := 31; -- user defined signal 2 -+ -+ SIGADAABORT : constant := SIGABRT; -+ -- Change this if you want to use another signal for task abort. -+ -- SIGTERM might be a good one. -+ -+ type Signal_Set is array (Natural range <>) of Signal; -+ -+ -- Interrupts that must be unmasked at all times. FreeBSD -+ -- pthreads will not allow an application to mask out any -+ -- interrupt needed by the threads library. -+ Unmasked : constant Signal_Set := -+ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP); -+ -+ -- FreeBSD will uses SIGPROF for timing. Do not allow a -+ -- handler to attach to this signal. -+ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF); -+ -+ type sigset_t is private; -+ -+ function sigaddset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigaddset, "sigaddset"); -+ -+ function sigdelset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigdelset, "sigdelset"); -+ -+ function sigfillset (set : access sigset_t) return int; -+ pragma Import (C, sigfillset, "sigfillset"); -+ -+ function sigismember -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigismember, "sigismember"); -+ -+ function sigemptyset (set : access sigset_t) return int; -+ pragma Import (C, sigemptyset, "sigemptyset"); -+ -+ -- sigcontext is architecture dependent, so define it private -+ type struct_sigcontext is private; -+ -+ type old_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_mask : sigset_t; -+ sa_flags : int; -+ end record; -+ pragma Convention (C, old_struct_sigaction); -+ -+ type new_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_flags : int; -+ sa_mask : sigset_t; -+ end record; -+ pragma Convention (C, new_struct_sigaction); -+ -+ subtype struct_sigaction is new_struct_sigaction; -+ type struct_sigaction_ptr is access all struct_sigaction; -+ -+ SIG_BLOCK : constant := 1; -+ SIG_UNBLOCK : constant := 2; -+ SIG_SETMASK : constant := 3; -+ -+ SIG_DFL : constant := 0; -+ SIG_IGN : constant := 1; -+ -+ SA_SIGINFO : constant := 16#0040#; -+ SA_ONSTACK : constant := 16#0001#; -+ -+ function sigaction -+ (sig : Signal; -+ act : struct_sigaction_ptr; -+ oact : struct_sigaction_ptr) return int; -+ pragma Import (C, sigaction, "sigaction"); -+ -+ ---------- -+ -- Time -- -+ ---------- -+ -+ Time_Slice_Supported : constant Boolean := True; -+ -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) -+ -+ type timespec is private; -+ -+ function nanosleep (rqtp, rmtp : access timespec) return int; -+ pragma Import (C, nanosleep, "nanosleep"); -+ -+ type clockid_t is new int; -+ -+ function clock_gettime -+ (clock_id : clockid_t; -+ tp : access timespec) -+ return int; -+ pragma Import (C, clock_gettime, "clock_gettime"); -+ -+ function To_Duration (TS : timespec) return Duration; -+ pragma Inline (To_Duration); -+ -+ function To_Timespec (D : Duration) return timespec; -+ pragma Inline (To_Timespec); -+ -+ type struct_timezone is record -+ tz_minuteswest : int; -+ tz_dsttime : int; -+ end record; -+ pragma Convention (C, struct_timezone); -+ -+ procedure usleep (useconds : unsigned_long); -+ pragma Import (C, usleep, "usleep"); -+ -+ ------------------------- -+ -- Priority Scheduling -- -+ ------------------------- -+ -+ SCHED_FIFO : constant := 1; -+ SCHED_OTHER : constant := 2; -+ SCHED_RR : constant := 3; -+ -+ function To_Target_Priority -+ (Prio : System.Any_Priority) return Interfaces.C.int; -+ -- Maps System.Any_Priority to a POSIX priority -+ -+ ------------- -+ -- Process -- -+ ------------- -+ -+ type pid_t is private; -+ -+ function kill (pid : pid_t; sig : Signal) return int; -+ pragma Import (C, kill, "kill"); -+ -+ function getpid return pid_t; -+ pragma Import (C, getpid, "getpid"); -+ -+ --------- -+ -- LWP -- -+ --------- -+ -+ function lwp_self return System.Address; -+ -- lwp_self does not exist on this thread library, revert to pthread_self -+ -- which is the closest approximation (with getpid). This function is -+ -- needed to share 7staprop.adb across POSIX-like targets. -+ pragma Import (C, lwp_self, "pthread_self"); -+ -+ ------------- -+ -- Threads -- -+ ------------- -+ -+ type Thread_Body is access -+ function (arg : System.Address) return System.Address; -+ pragma Convention (C, Thread_Body); -+ -+ function Thread_Body_Access is new -+ Ada.Unchecked_Conversion (System.Address, Thread_Body); -+ -+ type pthread_t is private; -+ subtype Thread_Id is pthread_t; -+ -+ type pthread_mutex_t is limited private; -+ type pthread_cond_t is limited private; -+ type pthread_attr_t is limited private; -+ type pthread_mutexattr_t is limited private; -+ type pthread_condattr_t is limited private; -+ type pthread_key_t is private; -+ -+ PTHREAD_CREATE_DETACHED : constant := 1; -+ PTHREAD_CREATE_JOINABLE : constant := 0; -+ -+ PTHREAD_SCOPE_PROCESS : constant := 0; -+ PTHREAD_SCOPE_SYSTEM : constant := 2; -+ -+ -- Read/Write lock not supported on freebsd. To add support both types -+ -- pthread_rwlock_t and pthread_rwlockattr_t must properly be defined -+ -- with the associated routines pthread_rwlock_[init/destroy] and -+ -- pthread_rwlock_[rdlock/wrlock/unlock]. -+ -+ subtype pthread_rwlock_t is pthread_mutex_t; -+ subtype pthread_rwlockattr_t is pthread_mutexattr_t; -+ -+ ----------- -+ -- Stack -- -+ ----------- -+ -+ type stack_t is record -+ ss_sp : System.Address; -+ ss_size : size_t; -+ ss_flags : int; -+ end record; -+ pragma Convention (C, stack_t); -+ -+ function sigaltstack -+ (ss : not null access stack_t; -+ oss : access stack_t) return int; -+ pragma Import (C, sigaltstack, "sigaltstack"); -+ -+ Alternate_Stack : aliased System.Address; -+ -- This is a dummy definition, never used (Alternate_Stack_Size is null) -+ -+ Alternate_Stack_Size : constant := 0; -+ -- No alternate signal stack is used on this platform -+ -+ Stack_Base_Available : constant Boolean := False; -+ -- Indicates whether the stack base is available on this target. This -+ -- allows us to share s-osinte.adb between all the FSU run time. Note that -+ -- this value can only be true if pthread_t has a complete definition that -+ -- corresponds exactly to the C header files. -+ -+ function Get_Stack_Base (thread : pthread_t) return Address; -+ pragma Inline (Get_Stack_Base); -+ -- returns the stack base of the specified thread. Only call this function -+ -- when Stack_Base_Available is True. -+ -+ function Get_Page_Size return size_t; -+ function Get_Page_Size return Address; -+ pragma Import (C, Get_Page_Size, "getpagesize"); -+ -- Returns the size of a page -+ -+ PROT_NONE : constant := 0; -+ PROT_READ : constant := 1; -+ PROT_WRITE : constant := 2; -+ PROT_EXEC : constant := 4; -+ PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; -+ PROT_ON : constant := PROT_NONE; -+ PROT_OFF : constant := PROT_ALL; -+ -+ function mprotect (addr : Address; len : size_t; prot : int) return int; -+ pragma Import (C, mprotect); -+ -+ --------------------------------------- -+ -- Nonstandard Thread Initialization -- -+ --------------------------------------- -+ -+ -- FSU_THREADS requires pthread_init, which is nonstandard and this should -+ -- be invoked during the elaboration of s-taprop.adb. -+ -+ -- FreeBSD does not require this so we provide an empty Ada body -+ -+ procedure pthread_init; -+ -+ ------------------------- -+ -- POSIX.1c Section 3 -- -+ ------------------------- -+ -+ function sigwait -+ (set : access sigset_t; -+ sig : access Signal) return int; -+ pragma Import (C, sigwait, "sigwait"); -+ -+ function pthread_kill -+ (thread : pthread_t; -+ sig : Signal) return int; -+ pragma Import (C, pthread_kill, "pthread_kill"); -+ -+ function pthread_sigmask -+ (how : int; -+ set : access sigset_t; -+ oset : access sigset_t) return int; -+ pragma Import (C, pthread_sigmask, "pthread_sigmask"); -+ -+ -------------------------- -+ -- POSIX.1c Section 11 -- -+ -------------------------- -+ -+ function pthread_mutexattr_init -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); -+ -+ function pthread_mutexattr_destroy -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); -+ -+ function pthread_mutex_init -+ (mutex : access pthread_mutex_t; -+ attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); -+ -+ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); -+ -+ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); -+ -+ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); -+ -+ function pthread_condattr_init -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); -+ -+ function pthread_condattr_destroy -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); -+ -+ function pthread_cond_init -+ (cond : access pthread_cond_t; -+ attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_cond_init, "pthread_cond_init"); -+ -+ function pthread_cond_destroy (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); -+ -+ function pthread_cond_signal (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); -+ -+ function pthread_cond_wait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); -+ -+ function pthread_cond_timedwait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t; -+ abstime : access timespec) return int; -+ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); -+ -+ Relative_Timed_Wait : constant Boolean := False; -+ -- pthread_cond_timedwait requires an absolute delay time -+ -+ -------------------------- -+ -- POSIX.1c Section 13 -- -+ -------------------------- -+ -+ PTHREAD_PRIO_NONE : constant := 0; -+ PTHREAD_PRIO_PROTECT : constant := 2; -+ PTHREAD_PRIO_INHERIT : constant := 1; -+ -+ function pthread_mutexattr_setprotocol -+ (attr : access pthread_mutexattr_t; -+ protocol : int) return int; -+ pragma Import -+ (C, pthread_mutexattr_setprotocol, "pthread_mutexattr_setprotocol"); -+ -+ function pthread_mutexattr_getprotocol -+ (attr : access pthread_mutexattr_t; -+ protocol : access int) return int; -+ pragma Import -+ (C, pthread_mutexattr_getprotocol, "pthread_mutexattr_getprotocol"); -+ -+ function pthread_mutexattr_setprioceiling -+ (attr : access pthread_mutexattr_t; -+ prioceiling : int) return int; -+ pragma Import -+ (C, pthread_mutexattr_setprioceiling, -+ "pthread_mutexattr_setprioceiling"); -+ -+ function pthread_mutexattr_getprioceiling -+ (attr : access pthread_mutexattr_t; -+ prioceiling : access int) return int; -+ pragma Import -+ (C, pthread_mutexattr_getprioceiling, -+ "pthread_mutexattr_getprioceiling"); -+ -+ type struct_sched_param is record -+ sched_priority : int; -+ end record; -+ pragma Convention (C, struct_sched_param); -+ -+ function pthread_getschedparam -+ (thread : pthread_t; -+ policy : access int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_getschedparam, "pthread_getschedparam"); -+ -+ function pthread_setschedparam -+ (thread : pthread_t; -+ policy : int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); -+ -+ function pthread_attr_setscope -+ (attr : access pthread_attr_t; -+ contentionscope : int) return int; -+ pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); -+ -+ function pthread_attr_getscope -+ (attr : access pthread_attr_t; -+ contentionscope : access int) return int; -+ pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope"); -+ -+ function pthread_attr_setinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : int) return int; -+ pragma Import -+ (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched"); -+ -+ function pthread_attr_getinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : access int) return int; -+ pragma Import -+ (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched"); -+ -+ function pthread_attr_setschedpolicy -+ (attr : access pthread_attr_t; -+ policy : int) return int; -+ pragma Import (C, pthread_attr_setschedpolicy, -+ "pthread_attr_setschedpolicy"); -+ -+ function pthread_attr_getschedpolicy -+ (attr : access pthread_attr_t; -+ policy : access int) return int; -+ pragma Import (C, pthread_attr_getschedpolicy, -+ "pthread_attr_getschedpolicy"); -+ -+ function pthread_attr_setschedparam -+ (attr : access pthread_attr_t; -+ sched_param : int) return int; -+ pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam"); -+ -+ function pthread_attr_getschedparam -+ (attr : access pthread_attr_t; -+ sched_param : access int) return int; -+ pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam"); -+ -+ function sched_yield return int; -+ pragma Import (C, sched_yield, "pthread_yield"); -+ -+ -------------------------- -+ -- P1003.1c Section 16 -- -+ -------------------------- -+ -+ function pthread_attr_init (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_init, "pthread_attr_init"); -+ -+ function pthread_attr_destroy -+ (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); -+ -+ function pthread_attr_setdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : int) return int; -+ pragma Import -+ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); -+ -+ function pthread_attr_getdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : access int) return int; -+ pragma Import -+ (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate"); -+ -+ function pthread_attr_getstacksize -+ (attr : access pthread_attr_t; -+ stacksize : access size_t) return int; -+ pragma Import -+ (C, pthread_attr_getstacksize, "pthread_attr_getstacksize"); -+ -+ function pthread_attr_setstacksize -+ (attr : access pthread_attr_t; -+ stacksize : size_t) return int; -+ pragma Import -+ (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); -+ -+ function pthread_create -+ (thread : access pthread_t; -+ attributes : access pthread_attr_t; -+ start_routine : Thread_Body; -+ arg : System.Address) return int; -+ pragma Import (C, pthread_create, "pthread_create"); -+ -+ function pthread_detach (thread : pthread_t) return int; -+ pragma Import (C, pthread_detach, "pthread_detach"); -+ -+ procedure pthread_exit (status : System.Address); -+ pragma Import (C, pthread_exit, "pthread_exit"); -+ -+ function pthread_self return pthread_t; -+ pragma Import (C, pthread_self, "pthread_self"); -+ -+ -------------------------- -+ -- POSIX.1c Section 17 -- -+ -------------------------- -+ -+ function pthread_setspecific -+ (key : pthread_key_t; -+ value : System.Address) return int; -+ pragma Import (C, pthread_setspecific, "pthread_setspecific"); -+ -+ function pthread_getspecific (key : pthread_key_t) return System.Address; -+ pragma Import (C, pthread_getspecific, "pthread_getspecific"); -+ -+ type destructor_pointer is access procedure (arg : System.Address); -+ pragma Convention (C, destructor_pointer); -+ -+ function pthread_key_create -+ (key : access pthread_key_t; -+ destructor : destructor_pointer) return int; -+ pragma Import (C, pthread_key_create, "pthread_key_create"); -+ -+ ------------------------------------ -+ -- Non-portable Pthread Functions -- -+ ------------------------------------ -+ -+ function pthread_set_name_np -+ (thread : pthread_t; -+ name : System.Address) return int; -+ pragma Import (C, pthread_set_name_np, "pthread_set_name_np"); -+ -+private -+ -+ type sigset_t is array (1 .. 4) of unsigned; -+ -+ -- In FreeBSD the component sa_handler turns out to -+ -- be one a union type, and the selector is a macro: -+ -- #define sa_handler __sigaction_u._handler -+ -- #define sa_sigaction __sigaction_u._sigaction -+ -+ -- Should we add a signal_context type here ??? -+ -- How could it be done independent of the CPU architecture ??? -+ -- sigcontext type is opaque, so it is architecturally neutral. -+ -- It is always passed as an access type, so define it as an empty record -+ -- since the contents are not used anywhere. -+ -+ type struct_sigcontext is null record; -+ pragma Convention (C, struct_sigcontext); -+ -+ type pid_t is new int; -+ -+ type time_t is new int64_t; -+ -+ type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; -+ end record; -+ pragma Convention (C, timespec); -+ -+ type pthread_t is new System.Address; -+ type pthread_attr_t is new System.Address; -+ type pthread_mutex_t is new System.Address; -+ type pthread_mutexattr_t is new System.Address; -+ type pthread_cond_t is new System.Address; -+ type pthread_condattr_t is new System.Address; -+ type pthread_key_t is new int; -+ -+end System.OS_Interface; --- /dev/null +++ gcc/ada/s-osinte-netbsd.adb @@ -0,0 +1,140 @@ @@ -4210,7 +2150,7 @@ + + function To_Duration (TS : timespec) return Duration is + begin -+ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; ++ return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9; + end To_Duration; + + ------------------------ @@ -4244,14 +2184,14 @@ + F := F + 1.0; + end if; + -+ return timespec'(tv_sec => S, -+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); ++ return timespec'(ts_sec => S, ++ ts_nsec => long (Long_Long_Integer (F * 10#1#E9))); + end To_Timespec; + +end System.OS_Interface; --- /dev/null +++ gcc/ada/s-osinte-netbsd.ads -@@ -0,0 +1,674 @@ +@@ -0,0 +1,677 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- @@ -4286,7 +2226,6 @@ +------------------------------------------------------------------------------ + +-- This is the NetBSD PTHREADS version of this package. -+-- It is based off of the FreeBSD PTHREADS as of 4.2.3. + +-- This package encapsulates all direct interfaces to OS services +-- that are needed by the tasking run-time (libgnarl). @@ -4312,6 +2251,7 @@ + subtype unsigned_char is Interfaces.C.unsigned_char; + subtype plain_char is Interfaces.C.plain_char; + subtype size_t is Interfaces.C.size_t; ++ subtype int64_t is Interfaces.Integer_64; + + ----------- + -- Errno -- @@ -4478,683 +2418,8 @@ + end record; + pragma Convention (C, struct_timezone); + -+ ------------------------- -+ -- Priority Scheduling -- -+ ------------------------- -+ -+ SCHED_FIFO : constant := 1; -+ SCHED_OTHER : constant := 2; -+ SCHED_RR : constant := 3; -+ -+ function To_Target_Priority -+ (Prio : System.Any_Priority) return Interfaces.C.int; -+ -- Maps System.Any_Priority to a POSIX priority -+ -+ ------------- -+ -- Process -- -+ ------------- -+ -+ type pid_t is private; -+ -+ function kill (pid : pid_t; sig : Signal) return int; -+ pragma Import (C, kill, "kill"); -+ -+ function getpid return pid_t; -+ pragma Import (C, getpid, "getpid"); -+ -+ --------- -+ -- LWP -- -+ --------- -+ -+ function lwp_self return System.Address; -+ -- lwp_self does not exist on this thread library, revert to pthread_self -+ -- which is the closest approximation (with getpid). This function is -+ -- needed to share 7staprop.adb across POSIX-like targets. -+ pragma Import (C, lwp_self, "pthread_self"); -+ -+ ------------- -+ -- Threads -- -+ ------------- -+ -+ type Thread_Body is access -+ function (arg : System.Address) return System.Address; -+ pragma Convention (C, Thread_Body); -+ -+ function Thread_Body_Access is new -+ Ada.Unchecked_Conversion (System.Address, Thread_Body); -+ -+ type pthread_t is private; -+ subtype Thread_Id is pthread_t; -+ -+ type pthread_mutex_t is limited private; -+ type pthread_cond_t is limited private; -+ type pthread_attr_t is limited private; -+ type pthread_mutexattr_t is limited private; -+ type pthread_condattr_t is limited private; -+ type pthread_key_t is private; -+ -+ PTHREAD_CREATE_DETACHED : constant := 1; -+ PTHREAD_CREATE_JOINABLE : constant := 0; -+ -+ PTHREAD_SCOPE_PROCESS : constant := 0; -+ PTHREAD_SCOPE_SYSTEM : constant := 2; -+ -+ -- Read/Write lock not supported on OpenBSD. To add support both types -+ -- pthread_rwlock_t and pthread_rwlockattr_t must properly be defined -+ -- with the associated routines pthread_rwlock_[init/destroy] and -+ -- pthread_rwlock_[rdlock/wrlock/unlock]. -+ -+ subtype pthread_rwlock_t is pthread_mutex_t; -+ subtype pthread_rwlockattr_t is pthread_mutexattr_t; -+ -+ ----------- -+ -- Stack -- -+ ----------- -+ -+ type stack_t is record -+ ss_sp : System.Address; -+ ss_size : size_t; -+ ss_flags : int; -+ end record; -+ pragma Convention (C, stack_t); -+ -+ function sigaltstack -+ (ss : not null access stack_t; -+ oss : access stack_t) return int; -+ pragma Import (C, sigaltstack, "sigaltstack"); -+ -+ Alternate_Stack : aliased System.Address; -+ -- This is a dummy definition, never used (Alternate_Stack_Size is null) -+ -+ Alternate_Stack_Size : constant := 0; -+ -- No alternate signal stack is used on this platform -+ -+ Stack_Base_Available : constant Boolean := False; -+ -- Indicates whether the stack base is available on this target. This -+ -- allows us to share s-osinte.adb between all the FSU run time. Note that -+ -- this value can only be true if pthread_t has a complete definition that -+ -- corresponds exactly to the C header files. -+ -+ function Get_Stack_Base (thread : pthread_t) return Address; -+ pragma Inline (Get_Stack_Base); -+ -- returns the stack base of the specified thread. Only call this function -+ -- when Stack_Base_Available is True. -+ -+ function Get_Page_Size return size_t; -+ function Get_Page_Size return Address; -+ pragma Import (C, Get_Page_Size, "getpagesize"); -+ -- Returns the size of a page -+ -+ PROT_NONE : constant := 0; -+ PROT_READ : constant := 1; -+ PROT_WRITE : constant := 2; -+ PROT_EXEC : constant := 4; -+ PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; -+ PROT_ON : constant := PROT_NONE; -+ PROT_OFF : constant := PROT_ALL; -+ -+ function mprotect (addr : Address; len : size_t; prot : int) return int; -+ pragma Import (C, mprotect); -+ -+ --------------------------------------- -+ -- Nonstandard Thread Initialization -- -+ --------------------------------------- -+ -+ -- FSU_THREADS requires pthread_init, which is nonstandard and this should -+ -- be invoked during the elaboration of s-taprop.adb. -+ -+ -- NetBSD does not require this so we provide an empty Ada body -+ -+ procedure pthread_init; -+ -+ ------------------------- -+ -- POSIX.1c Section 3 -- -+ ------------------------- -+ -+ function sigwait -+ (set : access sigset_t; -+ sig : access Signal) return int; -+ pragma Import (C, sigwait, "sigwait"); -+ -+ function pthread_kill -+ (thread : pthread_t; -+ sig : Signal) return int; -+ pragma Import (C, pthread_kill, "pthread_kill"); -+ -+ function pthread_sigmask -+ (how : int; -+ set : access sigset_t; -+ oset : access sigset_t) return int; -+ pragma Import (C, pthread_sigmask, "pthread_sigmask"); -+ -+ -------------------------- -+ -- POSIX.1c Section 11 -- -+ -------------------------- -+ -+ function pthread_mutexattr_init -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); -+ -+ function pthread_mutexattr_destroy -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); -+ -+ function pthread_mutex_init -+ (mutex : access pthread_mutex_t; -+ attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); -+ -+ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); -+ -+ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); -+ -+ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); -+ -+ function pthread_condattr_init -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); -+ -+ function pthread_condattr_destroy -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); -+ -+ function pthread_cond_init -+ (cond : access pthread_cond_t; -+ attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_cond_init, "pthread_cond_init"); -+ -+ function pthread_cond_destroy (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); -+ -+ function pthread_cond_signal (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); -+ -+ function pthread_cond_wait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); -+ -+ function pthread_cond_timedwait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t; -+ abstime : access timespec) return int; -+ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); -+ -+ Relative_Timed_Wait : constant Boolean := False; -+ -- pthread_cond_timedwait requires an absolute delay time -+ -+ -------------------------- -+ -- POSIX.1c Section 13 -- -+ -------------------------- -+ -+ PTHREAD_PRIO_NONE : constant := 0; -+ PTHREAD_PRIO_PROTECT : constant := 2; -+ PTHREAD_PRIO_INHERIT : constant := 1; -+ -+ function pthread_mutexattr_setprotocol -+ (attr : access pthread_mutexattr_t; -+ protocol : int) return int; -+ -+ function pthread_mutexattr_setprioceiling -+ (attr : access pthread_mutexattr_t; -+ prioceiling : int) return int; -+ -+ type struct_sched_param is record -+ sched_priority : int; -+ end record; -+ pragma Convention (C, struct_sched_param); -+ -+ function pthread_getschedparam -+ (thread : pthread_t; -+ policy : access int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_getschedparam, "pthread_getschedparam"); -+ -+ function pthread_setschedparam -+ (thread : pthread_t; -+ policy : int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); -+ -+ function pthread_attr_setscope -+ (attr : access pthread_attr_t; -+ contentionscope : int) return int; -+ pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); -+ -+ function pthread_attr_getscope -+ (attr : access pthread_attr_t; -+ contentionscope : access int) return int; -+ pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope"); -+ -+ function pthread_attr_setinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : int) return int; -+ pragma Import -+ (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched"); -+ -+ function pthread_attr_getinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : access int) return int; -+ pragma Import -+ (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched"); -+ -+ function pthread_attr_setschedpolicy -+ (attr : access pthread_attr_t; -+ policy : int) return int; -+ pragma Import (C, pthread_attr_setschedpolicy, -+ "pthread_attr_setschedpolicy"); -+ -+ function pthread_attr_getschedpolicy -+ (attr : access pthread_attr_t; -+ policy : access int) return int; -+ pragma Import (C, pthread_attr_getschedpolicy, -+ "pthread_attr_getschedpolicy"); -+ -+ function pthread_attr_setschedparam -+ (attr : access pthread_attr_t; -+ sched_param : int) return int; -+ pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam"); -+ -+ function pthread_attr_getschedparam -+ (attr : access pthread_attr_t; -+ sched_param : access int) return int; -+ pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam"); -+ -+ function sched_yield return int; -+ pragma Import (C, sched_yield, "sched_yield"); -+ -+ -------------------------- -+ -- P1003.1c Section 16 -- -+ -------------------------- -+ -+ function pthread_attr_init (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_init, "pthread_attr_init"); -+ -+ function pthread_attr_destroy -+ (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); -+ -+ function pthread_attr_setdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : int) return int; -+ pragma Import -+ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); -+ -+ function pthread_attr_getdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : access int) return int; -+ pragma Import -+ (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate"); -+ -+ function pthread_attr_getstacksize -+ (attr : access pthread_attr_t; -+ stacksize : access size_t) return int; -+ pragma Import -+ (C, pthread_attr_getstacksize, "pthread_attr_getstacksize"); -+ -+ function pthread_attr_setstacksize -+ (attr : access pthread_attr_t; -+ stacksize : size_t) return int; -+ pragma Import -+ (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); -+ -+ function pthread_create -+ (thread : access pthread_t; -+ attributes : access pthread_attr_t; -+ start_routine : Thread_Body; -+ arg : System.Address) return int; -+ pragma Import (C, pthread_create, "pthread_create"); -+ -+ function pthread_detach (thread : pthread_t) return int; -+ pragma Import (C, pthread_detach, "pthread_detach"); -+ -+ procedure pthread_exit (status : System.Address); -+ pragma Import (C, pthread_exit, "pthread_exit"); -+ -+ function pthread_self return pthread_t; -+ pragma Import (C, pthread_self, "pthread_self"); -+ -+ -------------------------- -+ -- POSIX.1c Section 17 -- -+ -------------------------- -+ -+ function pthread_setspecific -+ (key : pthread_key_t; -+ value : System.Address) return int; -+ pragma Import (C, pthread_setspecific, "pthread_setspecific"); -+ -+ function pthread_getspecific (key : pthread_key_t) return System.Address; -+ pragma Import (C, pthread_getspecific, "pthread_getspecific"); -+ -+ type destructor_pointer is access procedure (arg : System.Address); -+ pragma Convention (C, destructor_pointer); -+ -+ function pthread_key_create -+ (key : access pthread_key_t; -+ destructor : destructor_pointer) return int; -+ pragma Import (C, pthread_key_create, "pthread_key_create"); -+ -+ ------------------------------------ -+ -- Non-portable Pthread Functions -- -+ ------------------------------------ -+ -+ function pthread_set_name_np -+ (thread : pthread_t; -+ name : System.Address) return int; -+ pragma Import (C, pthread_set_name_np, "pthread_set_name_np"); -+ -+private -+ -+ type sigset_t is array (1 .. 4) of unsigned; -+ -+ -- In NetBSD the component sa_handler turns out to -+ -- be one a union type, and the selector is a macro: -+ -- #define sa_handler __sigaction_u._handler -+ -- #define sa_sigaction __sigaction_u._sigaction -+ -+ -- Should we add a signal_context type here ??? -+ -- How could it be done independent of the CPU architecture ??? -+ -- sigcontext type is opaque, so it is architecturally neutral. -+ -- It is always passed as an access type, so define it as an empty record -+ -- since the contents are not used anywhere. -+ -+ type struct_sigcontext is null record; -+ pragma Convention (C, struct_sigcontext); -+ -+ type pid_t is new int; -+ -+ type time_t is new int; -+ -+ type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; -+ end record; -+ pragma Convention (C, timespec); -+ -+ type pthread_t is new System.Address; -+ type pthread_attr_t is record -+ Pta_Magic : unsigned; -+ Pta_Flags : int; -+ Pta_Private : System.Address; -+ end record; -+ pragma Convention (C, pthread_attr_t); -+ -+ -- PORT NOTE: The size of pthread_spin_t is defined in -+ -- /src/sys/arch/*/include/types.h -+ type pthread_spin_t is new unsigned_char; -+ -+ type pthread_queue_t is record -+ Pthqh_First : pthread_t; -+ Pthqh_Last : System.Address; -+ end record; -+ pragma Convention (C, pthread_queue_t); -+ -+ type pthread_mutex_t is record -+ Ptm_Majic : unsigned; -+ Ptm_Lock : pthread_spin_t; -+ Ptm_Interlock : pthread_spin_t; -+ Ptm_Owner : pthread_t; -+ Ptm_Block : pthread_queue_t; -+ Ptm_Private : System.Address; -+ end record; -+ pragma Convention (C, pthread_mutex_t); -+ -+ type pthread_mutexattr_t is record -+ Ptma_Majic : unsigned; -+ Ptma_Private : System.Address; -+ end record; -+ pragma Convention (C, pthread_mutexattr_t); -+ -+ type pthread_cond_t is record -+ Ptc_Magic : unsigned; -+ Ptc_Lock : pthread_spin_t; -+ Ptc_Waiters : pthread_queue_t; -+ Ptc_Mutex : pthread_mutex_t; -+ Ptc_Private : System.Address; -+ end record; -+ pragma Convention (C, pthread_cond_t); -+ -+ type pthread_condattr_t is record -+ Ptca_Magic : unsigned; -+ Ptca_Private : System.Address; -+ end record; -+ pragma Convention (C, pthread_condattr_t); -+ -+ type pthread_key_t is new int; -+ -+end System.OS_Interface; ---- /dev/null -+++ gcc/ada/s-osinte-netbsd6.ads -@@ -0,0 +1,675 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ I N T E R F A C E -- -+-- -- -+-- S p e c -- -+-- -- -+-- Copyright (C) 1991-1994, Florida State University -- -+-- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. It is -- -+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -+-- State University (http://www.gnat.com). -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This is the NetBSD 6+ PTHREADS version of this package. -+-- It is based off of the FreeBSD PTHREADS as of 4.2.3. -+ -+-- This package encapsulates all direct interfaces to OS services -+-- that are needed by the tasking run-time (libgnarl). -+ -+-- 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. -+ -+with Ada.Unchecked_Conversion; -+ -+with Interfaces.C; -+ -+package System.OS_Interface is -+ pragma Preelaborate; -+ -+ pragma Linker_Options ("-pthread"); -+ -+ subtype int is Interfaces.C.int; -+ subtype short is Interfaces.C.short; -+ subtype long is Interfaces.C.long; -+ subtype unsigned is Interfaces.C.unsigned; -+ subtype unsigned_short is Interfaces.C.unsigned_short; -+ subtype unsigned_long is Interfaces.C.unsigned_long; -+ subtype unsigned_char is Interfaces.C.unsigned_char; -+ subtype plain_char is Interfaces.C.plain_char; -+ subtype size_t is Interfaces.C.size_t; -+ subtype int64_t is Interfaces.Integer_64; -+ -+ ----------- -+ -- Errno -- -+ ----------- -+ -+ function Errno return int; -+ pragma Inline (Errno); -+ -+ EAGAIN : constant := 35; -+ EINTR : constant := 4; -+ EINVAL : constant := 22; -+ ENOMEM : constant := 12; -+ ETIMEDOUT : constant := 60; -+ -+ ------------- -+ -- Signals -- -+ ------------- -+ -+ Max_Interrupt : constant := 63; -+ type Signal is new int range 0 .. Max_Interrupt; -+ for Signal'Size use int'Size; -+ -+ 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 -+ SIGEMT : constant := 7; -- EMT instruction -+ SIGFPE : constant := 8; -- floating point exception -+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored) -+ SIGBUS : constant := 10; -- bus error -+ SIGSEGV : constant := 11; -- segmentation violation -+ SIGSYS : constant := 12; -- bad argument to system call -+ 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 -+ SIGURG : constant := 16; -- urgent condition on IO channel -+ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) -+ SIGTSTP : constant := 18; -- user stop requested from tty -+ SIGCONT : constant := 19; -- stopped process has been continued -+ SIGCLD : constant := 20; -- alias for SIGCHLD -+ SIGCHLD : constant := 20; -- child status change -+ SIGTTIN : constant := 21; -- background tty read attempted -+ SIGTTOU : constant := 22; -- background tty write attempted -+ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias) -+ SIGXCPU : constant := 24; -- CPU time limit exceeded -+ SIGXFSZ : constant := 25; -- filesize limit exceeded -+ SIGVTALRM : constant := 26; -- virtual timer expired -+ SIGPROF : constant := 27; -- profiling timer expired -+ SIGWINCH : constant := 28; -- window size change -+ SIGINFO : constant := 29; -- information request (BSD) -+ SIGUSR1 : constant := 30; -- user defined signal 1 -+ SIGUSR2 : constant := 31; -- user defined signal 2 -+ SIGPWR : constant := 32; -- power fail/restart (not reset when caught) -+ -+ SIGADAABORT : constant := SIGABRT; -+ -- Change this if you want to use another signal for task abort. -+ -- SIGTERM might be a good one. -+ -+ type Signal_Set is array (Natural range <>) of Signal; -+ -+ -- Interrupts that must be unmasked at all times. NetBSD -+ -- pthreads will not allow an application to mask out any -+ -- interrupt needed by the threads library. -+ Unmasked : constant Signal_Set := -+ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP); -+ -+ -- NetBSD will uses SIGPROF for timing. Do not allow a -+ -- handler to attach to this signal. -+ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF); -+ -+ type sigset_t is private; -+ -+ function sigaddset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigaddset, "__sigaddset14"); -+ -+ function sigdelset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigdelset, "__sigdelset14"); -+ -+ function sigfillset (set : access sigset_t) return int; -+ pragma Import (C, sigfillset, "__sigfillset14"); -+ -+ function sigismember -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigismember, "__sigismember14"); -+ -+ function sigemptyset (set : access sigset_t) return int; -+ pragma Import (C, sigemptyset, "__sigemptyset14"); -+ -+ -- sigcontext is architecture dependent, so define it private -+ type struct_sigcontext is private; -+ -+ type old_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_mask : sigset_t; -+ sa_flags : int; -+ end record; -+ pragma Convention (C, old_struct_sigaction); -+ -+ type new_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_flags : int; -+ sa_mask : sigset_t; -+ end record; -+ pragma Convention (C, new_struct_sigaction); -+ -+ subtype struct_sigaction is new_struct_sigaction; -+ type struct_sigaction_ptr is access all struct_sigaction; -+ -+ SIG_BLOCK : constant := 1; -+ SIG_UNBLOCK : constant := 2; -+ SIG_SETMASK : constant := 3; -+ -+ SIG_DFL : constant := 0; -+ SIG_IGN : constant := 1; -+ SIG_ERR : constant := -1; -+ SIG_HOLD : constant := 3; -+ -+ SA_SIGINFO : constant := 16#0040#; -+ SA_ONSTACK : constant := 16#0001#; -+ -+ function sigaction -+ (sig : Signal; -+ act : struct_sigaction_ptr; -+ oact : struct_sigaction_ptr) return int; -+ pragma Import (C, sigaction, "__sigaction14"); -+ -+ ---------- -+ -- Time -- -+ ---------- -+ -+ Time_Slice_Supported : constant Boolean := True; -+ -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) -+ -+ type timespec is private; -+ -+ function nanosleep (rqtp, rmtp : access timespec) return int; -+ pragma Import (C, nanosleep, "__nanosleep50"); -+ -+ type clockid_t is new int; -+ -+ function clock_gettime -+ (clock_id : clockid_t; -+ tp : access timespec) -+ return int; -+ pragma Import (C, clock_gettime, "__clock_gettime50"); -+ -+ function To_Duration (TS : timespec) return Duration; -+ pragma Inline (To_Duration); -+ -+ function To_Timespec (D : Duration) return timespec; -+ pragma Inline (To_Timespec); -+ -+ type struct_timezone is record -+ tz_minuteswest : int; -+ tz_dsttime : int; -+ end record; -+ pragma Convention (C, struct_timezone); ++ procedure usleep (useconds : unsigned_long); ++ pragma Import (C, usleep, "usleep"); + + ------------------------- + -- Priority Scheduling -- @@ -5217,7 +2482,7 @@ + PTHREAD_SCOPE_PROCESS : constant := 0; + PTHREAD_SCOPE_SYSTEM : constant := 2; + -+ -- Read/Write lock not supported on freebsd. To add support both types ++ -- Read/Write lock not supported on NetBSD. To add support both types + -- pthread_rwlock_t and pthread_rwlockattr_t must properly be defined + -- with the associated routines pthread_rwlock_[init/destroy] and + -- pthread_rwlock_[rdlock/wrlock/unlock]. @@ -5239,7 +2504,7 @@ + function sigaltstack + (ss : not null access stack_t; + oss : access stack_t) return int; -+ pragma Import (C, sigaltstack, "sigaltstack"); ++ pragma Import (C, sigaltstack, "__sigaltstack14"); + + Alternate_Stack : aliased System.Address; + -- This is a dummy definition, never used (Alternate_Stack_Size is null) @@ -5547,8 +2812,8 @@ + type time_t is new int64_t; + + type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; ++ ts_sec : time_t; ++ ts_nsec : long; + end record; + pragma Convention (C, timespec); + @@ -5604,1356 +2869,6 @@ + type pthread_key_t is new int; + +end System.OS_Interface; ---- /dev/null -+++ gcc/ada/s-osinte-openbsd.adb -@@ -0,0 +1,116 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ I N T E R F A C E -- -+-- -- -+-- B o d y -- -+-- -- -+-- Copyright (C) 1991-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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. It is -- -+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -+-- State University (http://www.gnat.com). -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This is the OpenBSD THREADS version of this package -+ -+with Interfaces.C; use Interfaces.C; -+ -+package body System.OS_Interface is -+ -+ ----------- -+ -- Errno -- -+ ----------- -+ -+ function Errno return int is -+ type int_ptr is access all int; -+ -+ function internal_errno return int_ptr; -+ pragma Import (C, internal_errno, "__errno"); -+ -+ begin -+ return (internal_errno.all); -+ end Errno; -+ -+ -------------------- -+ -- Get_Stack_Base -- -+ -------------------- -+ -+ function Get_Stack_Base (thread : pthread_t) return Address is -+ pragma Unreferenced (thread); -+ begin -+ return Null_Address; -+ end Get_Stack_Base; -+ -+ ------------------ -+ -- pthread_init -- -+ ------------------ -+ -+ procedure pthread_init is -+ begin -+ null; -+ end pthread_init; -+ -+ ----------------- -+ -- To_Duration -- -+ ----------------- -+ -+ function To_Duration (TS : timespec) return Duration is -+ begin -+ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; -+ end To_Duration; -+ -+ ------------------------ -+ -- To_Target_Priority -- -+ ------------------------ -+ -+ function To_Target_Priority -+ (Prio : System.Any_Priority) return Interfaces.C.int -+ is -+ begin -+ return Interfaces.C.int (Prio); -+ end To_Target_Priority; -+ -+ ----------------- -+ -- To_Timespec -- -+ ----------------- -+ -+ function To_Timespec (D : Duration) return timespec is -+ S : time_t; -+ F : Duration; -+ -+ begin -+ S := time_t (Long_Long_Integer (D)); -+ F := D - Duration (S); -+ -+ -- If F has negative value due to a round-up, adjust for positive F -+ -- value. -+ -+ if F < 0.0 then -+ S := S - 1; -+ F := F + 1.0; -+ end if; -+ -+ return timespec'(tv_sec => S, -+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); -+ end To_Timespec; -+ -+end System.OS_Interface; ---- /dev/null -+++ gcc/ada/s-osinte-openbsd.ads -@@ -0,0 +1,648 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ I N T E R F A C E -- -+-- -- -+-- S p e c -- -+-- -- -+-- Copyright (C) 1991-1994, Florida State University -- -+-- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. It is -- -+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -+-- State University (http://www.gnat.com). -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This is the OpenBSD PTHREADS version of this package -+ -+-- This package encapsulates all direct interfaces to OS services -+-- that are needed by the tasking run-time (libgnarl). -+ -+-- 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. -+ -+with Ada.Unchecked_Conversion; -+ -+with Interfaces.C; -+ -+package System.OS_Interface is -+ pragma Preelaborate; -+ -+ pragma Linker_Options ("-pthread"); -+ -+ subtype int is Interfaces.C.int; -+ subtype short is Interfaces.C.short; -+ subtype long is Interfaces.C.long; -+ subtype unsigned is Interfaces.C.unsigned; -+ subtype unsigned_short is Interfaces.C.unsigned_short; -+ subtype unsigned_long is Interfaces.C.unsigned_long; -+ subtype unsigned_char is Interfaces.C.unsigned_char; -+ subtype plain_char is Interfaces.C.plain_char; -+ subtype size_t is Interfaces.C.size_t; -+ -+ ----------- -+ -- Errno -- -+ ----------- -+ -+ function Errno return int; -+ pragma Inline (Errno); -+ -+ EAGAIN : constant := 35; -+ EINTR : constant := 4; -+ EINVAL : constant := 22; -+ ENOMEM : constant := 12; -+ ETIMEDOUT : constant := 60; -+ -+ ------------- -+ -- Signals -- -+ ------------- -+ -+ Max_Interrupt : constant := 31; -+ type Signal is new int range 0 .. Max_Interrupt; -+ for Signal'Size use int'Size; -+ -+ 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 -+ SIGEMT : constant := 7; -- EMT instruction -+ SIGFPE : constant := 8; -- floating point exception -+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored) -+ SIGBUS : constant := 10; -- bus error -+ SIGSEGV : constant := 11; -- segmentation violation -+ SIGSYS : constant := 12; -- bad argument to system call -+ 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 -+ SIGURG : constant := 16; -- urgent condition on IO channel -+ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) -+ SIGTSTP : constant := 18; -- user stop requested from tty -+ SIGCONT : constant := 19; -- stopped process has been continued -+ SIGCLD : constant := 20; -- alias for SIGCHLD -+ SIGCHLD : constant := 20; -- child status change -+ SIGTTIN : constant := 21; -- background tty read attempted -+ SIGTTOU : constant := 22; -- background tty write attempted -+ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias) -+ SIGXCPU : constant := 24; -- CPU time limit exceeded -+ SIGXFSZ : constant := 25; -- filesize limit exceeded -+ SIGVTALRM : constant := 26; -- virtual timer expired -+ SIGPROF : constant := 27; -- profiling timer expired -+ SIGWINCH : constant := 28; -- window size change -+ SIGINFO : constant := 29; -- information request (BSD) -+ SIGUSR1 : constant := 30; -- user defined signal 1 -+ SIGUSR2 : constant := 31; -- user defined signal 2 -+ -+ SIGADAABORT : constant := SIGABRT; -+ -- Change this if you want to use another signal for task abort. -+ -- SIGTERM might be a good one. -+ -+ type Signal_Set is array (Natural range <>) of Signal; -+ -+ -- Interrupts that must be unmasked at all times. OpenBSD -+ -- pthreads will not allow an application to mask out any -+ -- interrupt needed by the threads library. -+ Unmasked : constant Signal_Set := -+ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP); -+ -+ -- OpenBSD will uses SIGPROF for timing. Do not allow a -+ -- handler to attach to this signal. -+ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF); -+ -+ type sigset_t is private; -+ -+ function sigaddset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigaddset, "sigaddset"); -+ -+ function sigdelset -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigdelset, "sigdelset"); -+ -+ function sigfillset (set : access sigset_t) return int; -+ pragma Import (C, sigfillset, "sigfillset"); -+ -+ function sigismember -+ (set : access sigset_t; -+ sig : Signal) return int; -+ pragma Import (C, sigismember, "sigismember"); -+ -+ function sigemptyset (set : access sigset_t) return int; -+ pragma Import (C, sigemptyset, "sigemptyset"); -+ -+ -- sigcontext is architecture dependent, so define it private -+ type struct_sigcontext is private; -+ -+ type old_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_mask : sigset_t; -+ sa_flags : int; -+ end record; -+ pragma Convention (C, old_struct_sigaction); -+ -+ type new_struct_sigaction is record -+ sa_handler : System.Address; -+ sa_flags : int; -+ sa_mask : sigset_t; -+ end record; -+ pragma Convention (C, new_struct_sigaction); -+ -+ subtype struct_sigaction is new_struct_sigaction; -+ type struct_sigaction_ptr is access all struct_sigaction; -+ -+ SIG_BLOCK : constant := 1; -+ SIG_UNBLOCK : constant := 2; -+ SIG_SETMASK : constant := 3; -+ -+ SIG_DFL : constant := 0; -+ SIG_IGN : constant := 1; -+ -+ SA_SIGINFO : constant := 16#0040#; -+ SA_ONSTACK : constant := 16#0001#; -+ -+ function sigaction -+ (sig : Signal; -+ act : struct_sigaction_ptr; -+ oact : struct_sigaction_ptr) return int; -+ pragma Import (C, sigaction, "sigaction"); -+ -+ ---------- -+ -- Time -- -+ ---------- -+ -+ Time_Slice_Supported : constant Boolean := True; -+ -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) -+ -+ type timespec is private; -+ -+ function nanosleep (rqtp, rmtp : access timespec) return int; -+ pragma Import (C, nanosleep, "nanosleep"); -+ -+ type clockid_t is new int; -+ -+ function clock_gettime -+ (clock_id : clockid_t; -+ tp : access timespec) -+ return int; -+ pragma Import (C, clock_gettime, "clock_gettime"); -+ -+ function To_Duration (TS : timespec) return Duration; -+ pragma Inline (To_Duration); -+ -+ function To_Timespec (D : Duration) return timespec; -+ pragma Inline (To_Timespec); -+ -+ type struct_timezone is record -+ tz_minuteswest : int; -+ tz_dsttime : int; -+ end record; -+ pragma Convention (C, struct_timezone); -+ -+ procedure usleep (useconds : unsigned_long); -+ pragma Import (C, usleep, "usleep"); -+ -+ ------------------------- -+ -- Priority Scheduling -- -+ ------------------------- -+ -+ SCHED_FIFO : constant := 1; -+ SCHED_OTHER : constant := 2; -+ SCHED_RR : constant := 3; -+ -+ function To_Target_Priority -+ (Prio : System.Any_Priority) return Interfaces.C.int; -+ -- Maps System.Any_Priority to a POSIX priority -+ -+ ------------- -+ -- Process -- -+ ------------- -+ -+ type pid_t is private; -+ -+ function kill (pid : pid_t; sig : Signal) return int; -+ pragma Import (C, kill, "kill"); -+ -+ function getpid return pid_t; -+ pragma Import (C, getpid, "getpid"); -+ -+ --------- -+ -- LWP -- -+ --------- -+ -+ function lwp_self return System.Address; -+ -- lwp_self does not exist on this thread library, revert to pthread_self -+ -- which is the closest approximation (with getpid). This function is -+ -- needed to share 7staprop.adb across POSIX-like targets. -+ pragma Import (C, lwp_self, "pthread_self"); -+ -+ ------------- -+ -- Threads -- -+ ------------- -+ -+ type Thread_Body is access -+ function (arg : System.Address) return System.Address; -+ pragma Convention (C, Thread_Body); -+ -+ function Thread_Body_Access is new -+ Ada.Unchecked_Conversion (System.Address, Thread_Body); -+ -+ type pthread_t is private; -+ subtype Thread_Id is pthread_t; -+ -+ type pthread_mutex_t is limited private; -+ type pthread_cond_t is limited private; -+ type pthread_attr_t is limited private; -+ type pthread_mutexattr_t is limited private; -+ type pthread_condattr_t is limited private; -+ type pthread_key_t is private; -+ -+ PTHREAD_CREATE_DETACHED : constant := 1; -+ PTHREAD_CREATE_JOINABLE : constant := 0; -+ -+ PTHREAD_SCOPE_PROCESS : constant := 0; -+ PTHREAD_SCOPE_SYSTEM : constant := 2; -+ -+ -- Read/Write lock not supported on freebsd. To add support both types -+ -- pthread_rwlock_t and pthread_rwlockattr_t must properly be defined -+ -- with the associated routines pthread_rwlock_[init/destroy] and -+ -- pthread_rwlock_[rdlock/wrlock/unlock]. -+ -+ subtype pthread_rwlock_t is pthread_mutex_t; -+ subtype pthread_rwlockattr_t is pthread_mutexattr_t; -+ -+ ----------- -+ -- Stack -- -+ ----------- -+ -+ type stack_t is record -+ ss_sp : System.Address; -+ ss_size : size_t; -+ ss_flags : int; -+ end record; -+ pragma Convention (C, stack_t); -+ -+ function sigaltstack -+ (ss : not null access stack_t; -+ oss : access stack_t) return int; -+ pragma Import (C, sigaltstack, "sigaltstack"); -+ -+ Alternate_Stack : aliased System.Address; -+ -- This is a dummy definition, never used (Alternate_Stack_Size is null) -+ -+ Alternate_Stack_Size : constant := 0; -+ -- No alternate signal stack is used on this platform -+ -+ Stack_Base_Available : constant Boolean := False; -+ -- Indicates whether the stack base is available on this target. This -+ -- allows us to share s-osinte.adb between all the FSU run time. Note that -+ -- this value can only be true if pthread_t has a complete definition that -+ -- corresponds exactly to the C header files. -+ -+ function Get_Stack_Base (thread : pthread_t) return Address; -+ pragma Inline (Get_Stack_Base); -+ -- returns the stack base of the specified thread. Only call this function -+ -- when Stack_Base_Available is True. -+ -+ function Get_Page_Size return size_t; -+ function Get_Page_Size return Address; -+ pragma Import (C, Get_Page_Size, "getpagesize"); -+ -- Returns the size of a page -+ -+ PROT_NONE : constant := 0; -+ PROT_READ : constant := 1; -+ PROT_WRITE : constant := 2; -+ PROT_EXEC : constant := 4; -+ PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; -+ PROT_ON : constant := PROT_NONE; -+ PROT_OFF : constant := PROT_ALL; -+ -+ function mprotect (addr : Address; len : size_t; prot : int) return int; -+ pragma Import (C, mprotect); -+ -+ --------------------------------------- -+ -- Nonstandard Thread Initialization -- -+ --------------------------------------- -+ -+ -- FSU_THREADS requires pthread_init, which is nonstandard and this should -+ -- be invoked during the elaboration of s-taprop.adb. -+ -+ -- OpenBSD does not require this so we provide an empty Ada body -+ -+ procedure pthread_init; -+ -+ ------------------------- -+ -- POSIX.1c Section 3 -- -+ ------------------------- -+ -+ function sigwait -+ (set : access sigset_t; -+ sig : access Signal) return int; -+ pragma Import (C, sigwait, "sigwait"); -+ -+ function pthread_kill -+ (thread : pthread_t; -+ sig : Signal) return int; -+ pragma Import (C, pthread_kill, "pthread_kill"); -+ -+ function pthread_sigmask -+ (how : int; -+ set : access sigset_t; -+ oset : access sigset_t) return int; -+ pragma Import (C, pthread_sigmask, "pthread_sigmask"); -+ -+ -------------------------- -+ -- POSIX.1c Section 11 -- -+ -------------------------- -+ -+ function pthread_mutexattr_init -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); -+ -+ function pthread_mutexattr_destroy -+ (attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); -+ -+ function pthread_mutex_init -+ (mutex : access pthread_mutex_t; -+ attr : access pthread_mutexattr_t) return int; -+ pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); -+ -+ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); -+ -+ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); -+ -+ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); -+ -+ function pthread_condattr_init -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); -+ -+ function pthread_condattr_destroy -+ (attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); -+ -+ function pthread_cond_init -+ (cond : access pthread_cond_t; -+ attr : access pthread_condattr_t) return int; -+ pragma Import (C, pthread_cond_init, "pthread_cond_init"); -+ -+ function pthread_cond_destroy (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); -+ -+ function pthread_cond_signal (cond : access pthread_cond_t) return int; -+ pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); -+ -+ function pthread_cond_wait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t) return int; -+ pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); -+ -+ function pthread_cond_timedwait -+ (cond : access pthread_cond_t; -+ mutex : access pthread_mutex_t; -+ abstime : access timespec) return int; -+ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); -+ -+ Relative_Timed_Wait : constant Boolean := False; -+ -- pthread_cond_timedwait requires an absolute delay time -+ -+ -------------------------- -+ -- POSIX.1c Section 13 -- -+ -------------------------- -+ -+ PTHREAD_PRIO_NONE : constant := 0; -+ PTHREAD_PRIO_PROTECT : constant := 2; -+ PTHREAD_PRIO_INHERIT : constant := 1; -+ -+ function pthread_mutexattr_setprotocol -+ (attr : access pthread_mutexattr_t; -+ protocol : int) return int; -+ pragma Import -+ (C, pthread_mutexattr_setprotocol, "pthread_mutexattr_setprotocol"); -+ -+ function pthread_mutexattr_getprotocol -+ (attr : access pthread_mutexattr_t; -+ protocol : access int) return int; -+ pragma Import -+ (C, pthread_mutexattr_getprotocol, "pthread_mutexattr_getprotocol"); -+ -+ function pthread_mutexattr_setprioceiling -+ (attr : access pthread_mutexattr_t; -+ prioceiling : int) return int; -+ pragma Import -+ (C, pthread_mutexattr_setprioceiling, -+ "pthread_mutexattr_setprioceiling"); -+ -+ function pthread_mutexattr_getprioceiling -+ (attr : access pthread_mutexattr_t; -+ prioceiling : access int) return int; -+ pragma Import -+ (C, pthread_mutexattr_getprioceiling, -+ "pthread_mutexattr_getprioceiling"); -+ -+ type struct_sched_param is record -+ sched_priority : int; -+ end record; -+ pragma Convention (C, struct_sched_param); -+ -+ function pthread_getschedparam -+ (thread : pthread_t; -+ policy : access int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_getschedparam, "pthread_getschedparam"); -+ -+ function pthread_setschedparam -+ (thread : pthread_t; -+ policy : int; -+ param : access struct_sched_param) return int; -+ pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); -+ -+ function pthread_attr_setscope -+ (attr : access pthread_attr_t; -+ contentionscope : int) return int; -+ pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); -+ -+ function pthread_attr_getscope -+ (attr : access pthread_attr_t; -+ contentionscope : access int) return int; -+ pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope"); -+ -+ function pthread_attr_setinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : int) return int; -+ pragma Import -+ (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched"); -+ -+ function pthread_attr_getinheritsched -+ (attr : access pthread_attr_t; -+ inheritsched : access int) return int; -+ pragma Import -+ (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched"); -+ -+ function pthread_attr_setschedpolicy -+ (attr : access pthread_attr_t; -+ policy : int) return int; -+ pragma Import (C, pthread_attr_setschedpolicy, -+ "pthread_attr_setschedpolicy"); -+ -+ function pthread_attr_getschedpolicy -+ (attr : access pthread_attr_t; -+ policy : access int) return int; -+ pragma Import (C, pthread_attr_getschedpolicy, -+ "pthread_attr_getschedpolicy"); -+ -+ function pthread_attr_setschedparam -+ (attr : access pthread_attr_t; -+ sched_param : int) return int; -+ pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam"); -+ -+ function pthread_attr_getschedparam -+ (attr : access pthread_attr_t; -+ sched_param : access int) return int; -+ pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam"); -+ -+ function sched_yield return int; -+ pragma Import (C, sched_yield, "pthread_yield"); -+ -+ -------------------------- -+ -- P1003.1c Section 16 -- -+ -------------------------- -+ -+ function pthread_attr_init (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_init, "pthread_attr_init"); -+ -+ function pthread_attr_destroy -+ (attributes : access pthread_attr_t) return int; -+ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); -+ -+ function pthread_attr_setdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : int) return int; -+ pragma Import -+ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); -+ -+ function pthread_attr_getdetachstate -+ (attr : access pthread_attr_t; -+ detachstate : access int) return int; -+ pragma Import -+ (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate"); -+ -+ function pthread_attr_getstacksize -+ (attr : access pthread_attr_t; -+ stacksize : access size_t) return int; -+ pragma Import -+ (C, pthread_attr_getstacksize, "pthread_attr_getstacksize"); -+ -+ function pthread_attr_setstacksize -+ (attr : access pthread_attr_t; -+ stacksize : size_t) return int; -+ pragma Import -+ (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); -+ -+ function pthread_create -+ (thread : access pthread_t; -+ attributes : access pthread_attr_t; -+ start_routine : Thread_Body; -+ arg : System.Address) return int; -+ pragma Import (C, pthread_create, "pthread_create"); -+ -+ function pthread_detach (thread : pthread_t) return int; -+ pragma Import (C, pthread_detach, "pthread_detach"); -+ -+ procedure pthread_exit (status : System.Address); -+ pragma Import (C, pthread_exit, "pthread_exit"); -+ -+ function pthread_self return pthread_t; -+ pragma Import (C, pthread_self, "pthread_self"); -+ -+ -------------------------- -+ -- POSIX.1c Section 17 -- -+ -------------------------- -+ -+ function pthread_setspecific -+ (key : pthread_key_t; -+ value : System.Address) return int; -+ pragma Import (C, pthread_setspecific, "pthread_setspecific"); -+ -+ function pthread_getspecific (key : pthread_key_t) return System.Address; -+ pragma Import (C, pthread_getspecific, "pthread_getspecific"); -+ -+ type destructor_pointer is access procedure (arg : System.Address); -+ pragma Convention (C, destructor_pointer); -+ -+ function pthread_key_create -+ (key : access pthread_key_t; -+ destructor : destructor_pointer) return int; -+ pragma Import (C, pthread_key_create, "pthread_key_create"); -+ -+ ------------------------------------ -+ -- Non-portable Pthread Functions -- -+ ------------------------------------ -+ -+ function pthread_set_name_np -+ (thread : pthread_t; -+ name : System.Address) return int; -+ pragma Import (C, pthread_set_name_np, "pthread_set_name_np"); -+ -+private -+ -+ type sigset_t is array (1 .. 4) of unsigned; -+ -+ -- In OpenBSD the component sa_handler turns out to -+ -- be one a union type, and the selector is a macro: -+ -- #define sa_handler __sigaction_u._handler -+ -- #define sa_sigaction __sigaction_u._sigaction -+ -+ -- Should we add a signal_context type here ??? -+ -- How could it be done independent of the CPU architecture ??? -+ -- sigcontext type is opaque, so it is architecturally neutral. -+ -- It is always passed as an access type, so define it as an empty record -+ -- since the contents are not used anywhere. -+ -+ type struct_sigcontext is null record; -+ pragma Convention (C, struct_sigcontext); -+ -+ type pid_t is new int; -+ -+ type time_t is new int; -+ -+ type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; -+ end record; -+ pragma Convention (C, timespec); -+ -+ type pthread_t is new System.Address; -+ type pthread_attr_t is new System.Address; -+ type pthread_mutex_t is new System.Address; -+ type pthread_mutexattr_t is new System.Address; -+ type pthread_cond_t is new System.Address; -+ type pthread_condattr_t is new System.Address; -+ type pthread_key_t is new int; -+ -+end System.OS_Interface; ---- /dev/null -+++ gcc/ada/s-osprim-bsd32.adb -@@ -0,0 +1,186 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ P R I M I T I V E S -- -+-- -- -+-- B o d y -- -+-- -- -+-- Copyright (C) 1998-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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. -- -+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- -+-- -- -+-- Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> -- -+------------------------------------------------------------------------------ -+ -+-- This version is for BSD operating systems using 32-bit time types. -+ -+with Interfaces.C; -+ -+package body System.OS_Primitives is -+ -+ -- ??? These definitions are duplicated from System.OS_Interface -+ -- because we don't want to depend on any package. Consider removing -+ -- these declarations in System.OS_Interface and move these ones in -+ -- the spec. -+ -+ subtype int is Interfaces.C.int; -+ subtype long is Interfaces.C.long; -+ -+ type time_t is new int; -+ -+ type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; -+ end record; -+ pragma Convention (C, timespec); -+ -+ type timezone is record -+ tz_minuteswest : int; -+ tz_dsttime : int; -+ end record; -+ pragma Convention (C, timezone); -+ -+ function nanosleep (rqtp, rmtp : access timespec) return int; -+ pragma Import (C, nanosleep, "nanosleep"); -+ -+ ----------- -+ -- Clock -- -+ ----------- -+ -+ function Clock return Duration is -+ type timeval is array (1 .. 2) of Long_Integer; -+ tzresult : aliased timezone; -+ -+ procedure timeval_to_duration -+ (T : not null access timeval; -+ sec : not null access Long_Integer; -+ usec : not null access Long_Integer); -+ pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration"); -+ -+ Micro : constant := 10**6; -+ sec : aliased Long_Integer; -+ usec : aliased Long_Integer; -+ TV : aliased timeval; -+ Result : int; -+ -+ function gettimeofday -+ (Tv : access timeval; -+ Tz : access timezone) return int; -+ pragma Import (C, gettimeofday, "gettimeofday"); -+ -+ pragma Unreferenced (Result); -+ begin -+ -- The return codes for gettimeofday are as follows (from man pages): -+ -- EPERM settimeofday is called by someone other than the superuser -+ -- EINVAL Timezone (or something else) is invalid -+ -- EFAULT One of tv or tz pointed outside accessible address space -+ -+ -- None of these codes signal a potential clock skew, hence the return -+ -- value is never checked. -+ -+ Result := gettimeofday (TV'Access, tzresult'Access); -+ timeval_to_duration (TV'Access, sec'Access, usec'Access); -+ return Duration (sec) + Duration (usec) / Micro; -+ end Clock; -+ -+ --------------------- -+ -- Monotonic_Clock -- -+ --------------------- -+ -+ function Monotonic_Clock return Duration renames Clock; -+ -+ ----------------- -+ -- To_Timespec -- -+ ----------------- -+ -+ function To_Timespec (D : Duration) return timespec; -+ -+ function To_Timespec (D : Duration) return timespec is -+ S : time_t; -+ F : Duration; -+ -+ begin -+ S := time_t (Long_Long_Integer (D)); -+ F := D - Duration (S); -+ -+ -- If F has negative value due to a round-up, adjust for positive F -+ -- value. -+ -+ if F < 0.0 then -+ S := S - 1; -+ F := F + 1.0; -+ end if; -+ -+ return -+ timespec'(tv_sec => S, -+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); -+ end To_Timespec; -+ -+ ----------------- -+ -- Timed_Delay -- -+ ----------------- -+ -+ procedure Timed_Delay -+ (Time : Duration; -+ Mode : Integer) -+ is -+ Request : aliased timespec; -+ Remaind : aliased timespec; -+ Rel_Time : Duration; -+ Abs_Time : Duration; -+ Base_Time : constant Duration := Clock; -+ Check_Time : Duration := Base_Time; -+ -+ Result : int; -+ pragma Unreferenced (Result); -+ -+ begin -+ if Mode = Relative then -+ Rel_Time := Time; -+ Abs_Time := Time + Check_Time; -+ else -+ Rel_Time := Time - Check_Time; -+ Abs_Time := Time; -+ end if; -+ -+ if Rel_Time > 0.0 then -+ loop -+ Request := To_Timespec (Rel_Time); -+ Result := nanosleep (Request'Access, Remaind'Access); -+ Check_Time := Clock; -+ -+ exit when Abs_Time <= Check_Time or else Check_Time < Base_Time; -+ -+ Rel_Time := Abs_Time - Check_Time; -+ end loop; -+ end if; -+ end Timed_Delay; -+ -+ ---------------- -+ -- Initialize -- -+ ---------------- -+ -+ procedure Initialize is -+ begin -+ null; -+ end Initialize; -+ -+end System.OS_Primitives; ---- /dev/null -+++ gcc/ada/s-osprim-bsd64.adb -@@ -0,0 +1,192 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ P R I M I T I V E S -- -+-- -- -+-- B o d y -- -+-- -- -+-- Copyright (C) 1998-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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. -- -+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- -+-- -- -+-- Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> -- -+------------------------------------------------------------------------------ -+ -+-- This version is for BSD operating systems using 64-bit time types. -+ -+with Interfaces.C; -+ -+package body System.OS_Primitives is -+ -+ -- ??? These definitions are duplicated from System.OS_Interface -+ -- because we don't want to depend on any package. Consider removing -+ -- these declarations in System.OS_Interface and move these ones in -+ -- the spec. -+ -+ subtype int is Interfaces.C.int; -+ subtype long is Interfaces.C.long; -+ subtype int64_t is Interfaces.Integer_64; -+ -+ type time_t is new int64_t; -+ -+ type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; -+ end record; -+ pragma Convention (C, timespec); -+ -+ type timezone is record -+ tz_minuteswest : int; -+ tz_dsttime : int; -+ end record; -+ pragma Convention (C, timezone); -+ -+ type timeval is record -+ tv_sec : time_t; -+ tv_usec : long; -- Not for NetBSD! FreeBSD/DragonFly -+ end record; -+ pragma Convention (C, timeval); -+ -+ function nanosleep (rqtp, rmtp : access timespec) return int; -+ pragma Import (C, nanosleep, "nanosleep"); -+ -+ ----------- -+ -- Clock -- -+ ----------- -+ -+ function Clock return Duration is -+ -+ procedure timeval_to_duration -+ (T : not null access timeval; -+ sec : not null access Long_Integer; -+ usec : not null access Long_Integer); -+ pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration"); -+ -+ Micro : constant := 10**6; -+ sec : aliased Long_Integer; -+ usec : aliased Long_Integer; -+ TV : aliased timeval; -+ tzresult : aliased timezone; -+ Result : int; -+ -+ function gettimeofday -+ (Tv : access timeval; -+ Tz : access timezone) return int; -+ pragma Import (C, gettimeofday, "gettimeofday"); -+ -+ pragma Unreferenced (Result); -+ begin -+ -- The return codes for gettimeofday are as follows (from man pages): -+ -- EPERM settimeofday is called by someone other than the superuser -+ -- EINVAL Timezone (or something else) is invalid -+ -- EFAULT One of tv or tz pointed outside accessible address space -+ -+ -- None of these codes signal a potential clock skew, hence the return -+ -- value is never checked. -+ -+ Result := gettimeofday (TV'Access, tzresult'Access); -+ timeval_to_duration (TV'Access, sec'Access, usec'Access); -+ return Duration (sec) + Duration (usec) / Micro; -+ end Clock; -+ -+ --------------------- -+ -- Monotonic_Clock -- -+ --------------------- -+ -+ function Monotonic_Clock return Duration renames Clock; -+ -+ ----------------- -+ -- To_Timespec -- -+ ----------------- -+ -+ function To_Timespec (D : Duration) return timespec; -+ -+ function To_Timespec (D : Duration) return timespec is -+ S : time_t; -+ F : Duration; -+ -+ begin -+ S := time_t (Long_Long_Integer (D)); -+ F := D - Duration (S); -+ -+ -- If F has negative value due to a round-up, adjust for positive F -+ -- value. -+ -+ if F < 0.0 then -+ S := S - 1; -+ F := F + 1.0; -+ end if; -+ -+ return -+ timespec'(tv_sec => S, -+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); -+ end To_Timespec; -+ -+ ----------------- -+ -- Timed_Delay -- -+ ----------------- -+ -+ procedure Timed_Delay -+ (Time : Duration; -+ Mode : Integer) -+ is -+ Request : aliased timespec; -+ Remaind : aliased timespec; -+ Rel_Time : Duration; -+ Abs_Time : Duration; -+ Base_Time : constant Duration := Clock; -+ Check_Time : Duration := Base_Time; -+ -+ Result : int; -+ pragma Unreferenced (Result); -+ -+ begin -+ if Mode = Relative then -+ Rel_Time := Time; -+ Abs_Time := Time + Check_Time; -+ else -+ Rel_Time := Time - Check_Time; -+ Abs_Time := Time; -+ end if; -+ -+ if Rel_Time > 0.0 then -+ loop -+ Request := To_Timespec (Rel_Time); -+ Result := nanosleep (Request'Access, Remaind'Access); -+ Check_Time := Clock; -+ -+ exit when Abs_Time <= Check_Time or else Check_Time < Base_Time; -+ -+ Rel_Time := Abs_Time - Check_Time; -+ end loop; -+ end if; -+ end Timed_Delay; -+ -+ ---------------- -+ -- Initialize -- -+ ---------------- -+ -+ procedure Initialize is -+ begin -+ null; -+ end Initialize; -+ -+end System.OS_Primitives; ---- /dev/null -+++ gcc/ada/s-osprim-bsdn6.adb -@@ -0,0 +1,193 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -+-- -- -+-- S Y S T E M . O S _ P R I M I T I V E S -- -+-- -- -+-- B o d y -- -+-- -- -+-- Copyright (C) 1998-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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNARL was developed by the GNARL team at Florida State University. -- -+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- -+-- -- -+-- Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> -- -+------------------------------------------------------------------------------ -+ -+-- This version is for NetBSD 6.0+ -+-- It switches time type to 64 bits and uses compatibility functions -+ -+with Interfaces.C; -+ -+package body System.OS_Primitives is -+ -+ -- ??? These definitions are duplicated from System.OS_Interface -+ -- because we don't want to depend on any package. Consider removing -+ -- these declarations in System.OS_Interface and move these ones in -+ -- the spec. -+ -+ subtype int is Interfaces.C.int; -+ subtype long is Interfaces.C.long; -+ subtype int64_t is Interfaces.Integer_64; -+ -+ type time_t is new int64_t; -+ -+ type timespec is record -+ tv_sec : time_t; -+ tv_nsec : long; -+ end record; -+ pragma Convention (C, timespec); -+ -+ type timezone is record -+ tz_minuteswest : int; -+ tz_dsttime : int; -+ end record; -+ pragma Convention (C, timezone); -+ -+ type timeval is record -+ tv_sec : time_t; -+ tv_usec : int; -+ end record; -+ pragma Convention (C, timeval); -+ -+ function nanosleep (rqtp, rmtp : access timespec) return int; -+ pragma Import (C, nanosleep, "__nanosleep50"); -+ -+ ----------- -+ -- Clock -- -+ ----------- -+ -+ function Clock return Duration is -+ -+ procedure timeval_to_duration -+ (T : not null access timeval; -+ sec : not null access Long_Integer; -+ usec : not null access Long_Integer); -+ pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration"); -+ -+ Micro : constant := 10**6; -+ sec : aliased Long_Integer; -+ usec : aliased Long_Integer; -+ TV : aliased timeval; -+ tzresult : aliased timezone; -+ Result : int; -+ -+ function gettimeofday -+ (Tv : access timeval; -+ Tz : access timezone) return int; -+ pragma Import (C, gettimeofday, "__gettimeofday50"); -+ -+ pragma Unreferenced (Result); -+ begin -+ -- The return codes for gettimeofday are as follows (from man pages): -+ -- EPERM settimeofday is called by someone other than the superuser -+ -- EINVAL Timezone (or something else) is invalid -+ -- EFAULT One of tv or tz pointed outside accessible address space -+ -+ -- None of these codes signal a potential clock skew, hence the return -+ -- value is never checked. -+ -+ Result := gettimeofday (TV'Access, tzresult'Access); -+ timeval_to_duration (TV'Access, sec'Access, usec'Access); -+ return Duration (sec) + Duration (usec) / Micro; -+ end Clock; -+ -+ --------------------- -+ -- Monotonic_Clock -- -+ --------------------- -+ -+ function Monotonic_Clock return Duration renames Clock; -+ -+ ----------------- -+ -- To_Timespec -- -+ ----------------- -+ -+ function To_Timespec (D : Duration) return timespec; -+ -+ function To_Timespec (D : Duration) return timespec is -+ S : time_t; -+ F : Duration; -+ -+ begin -+ S := time_t (Long_Long_Integer (D)); -+ F := D - Duration (S); -+ -+ -- If F has negative value due to a round-up, adjust for positive F -+ -- value. -+ -+ if F < 0.0 then -+ S := S - 1; -+ F := F + 1.0; -+ end if; -+ -+ return -+ timespec'(tv_sec => S, -+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); -+ end To_Timespec; -+ -+ ----------------- -+ -- Timed_Delay -- -+ ----------------- -+ -+ procedure Timed_Delay -+ (Time : Duration; -+ Mode : Integer) -+ is -+ Request : aliased timespec; -+ Remaind : aliased timespec; -+ Rel_Time : Duration; -+ Abs_Time : Duration; -+ Base_Time : constant Duration := Clock; -+ Check_Time : Duration := Base_Time; -+ -+ Result : int; -+ pragma Unreferenced (Result); -+ -+ begin -+ if Mode = Relative then -+ Rel_Time := Time; -+ Abs_Time := Time + Check_Time; -+ else -+ Rel_Time := Time - Check_Time; -+ Abs_Time := Time; -+ end if; -+ -+ if Rel_Time > 0.0 then -+ loop -+ Request := To_Timespec (Rel_Time); -+ Result := nanosleep (Request'Access, Remaind'Access); -+ Check_Time := Clock; -+ -+ exit when Abs_Time <= Check_Time or else Check_Time < Base_Time; -+ -+ Rel_Time := Abs_Time - Check_Time; -+ end loop; -+ end if; -+ end Timed_Delay; -+ -+ ---------------- -+ -- Initialize -- -+ ---------------- -+ -+ procedure Initialize is -+ begin -+ null; -+ end Initialize; -+ -+end System.OS_Primitives; --- gcc/ada/socket.c.orig +++ gcc/ada/socket.c @@ -65,7 +65,10 @@ @@ -7010,153 +2925,6 @@ localtime_r (timer, &tp); *off = tp.tm_gmtoff; --- /dev/null -+++ gcc/ada/system-dragonfly-x86.ads -@@ -0,0 +1,144 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME COMPONENTS -- -+-- -- -+-- S Y S T E M -- -+-- -- -+-- S p e c -- -+-- (DragonFly BSD/x86 Version) -- -+-- -- -+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- -+-- -- -+-- This specification is derived from the Ada Reference Manual for use with -- -+-- GNAT. The copyright notice above, and the license provisions that follow -- -+-- apply solely to the contents of the part following the private keyword. -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNAT was originally developed by the GNAT team at New York University. -- -+-- Extensive contributions were provided by Ada Core Technologies Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+package System is -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). -+ -+ type Name is (SYSTEM_NAME_GNAT); -+ System_Name : constant Name := SYSTEM_NAME_GNAT; -+ -+ -- System-Dependent Named Numbers -+ -+ Min_Int : constant := Long_Long_Integer'First; -+ Max_Int : constant := Long_Long_Integer'Last; -+ -+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; -+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; -+ -+ Max_Base_Digits : constant := Long_Long_Float'Digits; -+ Max_Digits : constant := Long_Long_Float'Digits; -+ -+ Max_Mantissa : constant := 63; -+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa); -+ -+ Tick : constant := 0.000_001; -+ -+ -- Storage-related Declarations -+ -+ type Address is private; -+ pragma Preelaborable_Initialization (Address); -+ Null_Address : constant Address; -+ -+ Storage_Unit : constant := 8; -+ Word_Size : constant := 32; -+ Memory_Size : constant := 2 ** 32; -+ -+ -- Address comparison -+ -+ function "<" (Left, Right : Address) return Boolean; -+ function "<=" (Left, Right : Address) return Boolean; -+ function ">" (Left, Right : Address) return Boolean; -+ function ">=" (Left, Right : Address) return Boolean; -+ function "=" (Left, Right : Address) return Boolean; -+ -+ pragma Import (Intrinsic, "<"); -+ pragma Import (Intrinsic, "<="); -+ pragma Import (Intrinsic, ">"); -+ pragma Import (Intrinsic, ">="); -+ pragma Import (Intrinsic, "="); -+ -+ -- Other System-Dependent Declarations -+ -+ type Bit_Order is (High_Order_First, Low_Order_First); -+ Default_Bit_Order : constant Bit_Order := Low_Order_First; -+ pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -+ -+ -- Priority-related Declarations (RM D.1) -+ -+ Max_Priority : constant Positive := 30; -+ Max_Interrupt_Priority : constant Positive := 31; -+ -+ subtype Any_Priority is Integer range 0 .. 31; -+ subtype Priority is Any_Priority range 0 .. 30; -+ subtype Interrupt_Priority is Any_Priority range 31 .. 31; -+ -+ Default_Priority : constant Priority := 15; -+ -+private -+ -+ type Address is mod Memory_Size; -+ Null_Address : constant Address := 0; -+ -+ -------------------------------------- -+ -- System Implementation Parameters -- -+ -------------------------------------- -+ -+ -- These parameters provide information about the target that is used -+ -- by the compiler. They are in the private part of System, where they -+ -- can be accessed using the special circuitry in the Targparm unit -+ -- whose source should be consulted for more detailed descriptions -+ -- of the individual switch values. -+ -+ Backend_Divide_Checks : constant Boolean := False; -+ Backend_Overflow_Checks : constant Boolean := True; -+ Command_Line_Args : constant Boolean := True; -+ Configurable_Run_Time : constant Boolean := False; -+ Denorm : constant Boolean := True; -+ Duration_32_Bits : constant Boolean := False; -+ Exit_Status_Supported : constant Boolean := True; -+ Fractional_Fixed_Ops : constant Boolean := False; -+ Frontend_Layout : constant Boolean := False; -+ Machine_Overflows : constant Boolean := False; -+ Machine_Rounds : constant Boolean := True; -+ Preallocated_Stacks : constant Boolean := False; -+ Signed_Zeros : constant Boolean := True; -+ Stack_Check_Default : constant Boolean := False; -+ Stack_Check_Probes : constant Boolean := True; -+ Stack_Check_Limits : constant Boolean := False; -+ Support_Aggregates : constant Boolean := True; -+ Support_Atomic_Primitives : constant Boolean := True; -+ Support_Composite_Assign : constant Boolean := True; -+ Support_Composite_Compare : constant Boolean := True; -+ Support_Long_Shifts : constant Boolean := True; -+ Always_Compatible_Rep : constant Boolean := False; -+ Suppress_Standard_Library : constant Boolean := False; -+ Use_Ada_Main_Program_Name : constant Boolean := False; -+ ZCX_By_Default : constant Boolean := True; -+ -+end System; ---- /dev/null +++ gcc/ada/system-dragonfly-x86_64.ads @@ -0,0 +1,144 @@ +------------------------------------------------------------------------------ @@ -7597,300 +3365,6 @@ + ZCX_By_Default : constant Boolean := True; + +end System; ---- /dev/null -+++ gcc/ada/system-openbsd-x86.ads -@@ -0,0 +1,144 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME COMPONENTS -- -+-- -- -+-- S Y S T E M -- -+-- -- -+-- S p e c -- -+-- (OpenBSD/x86 Version) -- -+-- -- -+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- -- -+-- This specification is derived from the Ada Reference Manual for use with -- -+-- GNAT. The copyright notice above, and the license provisions that follow -- -+-- apply solely to the contents of the part following the private keyword. -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNAT was originally developed by the GNAT team at New York University. -- -+-- Extensive contributions were provided by Ada Core Technologies Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+package System is -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). -+ -+ type Name is (SYSTEM_NAME_GNAT); -+ System_Name : constant Name := SYSTEM_NAME_GNAT; -+ -+ -- System-Dependent Named Numbers -+ -+ Min_Int : constant := Long_Long_Integer'First; -+ Max_Int : constant := Long_Long_Integer'Last; -+ -+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; -+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; -+ -+ Max_Base_Digits : constant := Long_Long_Float'Digits; -+ Max_Digits : constant := Long_Long_Float'Digits; -+ -+ Max_Mantissa : constant := 63; -+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa); -+ -+ Tick : constant := 0.000_001; -+ -+ -- Storage-related Declarations -+ -+ type Address is private; -+ pragma Preelaborable_Initialization (Address); -+ Null_Address : constant Address; -+ -+ Storage_Unit : constant := 8; -+ Word_Size : constant := 32; -+ Memory_Size : constant := 2 ** 32; -+ -+ -- Address comparison -+ -+ function "<" (Left, Right : Address) return Boolean; -+ function "<=" (Left, Right : Address) return Boolean; -+ function ">" (Left, Right : Address) return Boolean; -+ function ">=" (Left, Right : Address) return Boolean; -+ function "=" (Left, Right : Address) return Boolean; -+ -+ pragma Import (Intrinsic, "<"); -+ pragma Import (Intrinsic, "<="); -+ pragma Import (Intrinsic, ">"); -+ pragma Import (Intrinsic, ">="); -+ pragma Import (Intrinsic, "="); -+ -+ -- Other System-Dependent Declarations -+ -+ type Bit_Order is (High_Order_First, Low_Order_First); -+ Default_Bit_Order : constant Bit_Order := Low_Order_First; -+ pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -+ -+ -- Priority-related Declarations (RM D.1) -+ -+ Max_Priority : constant Positive := 30; -+ Max_Interrupt_Priority : constant Positive := 31; -+ -+ subtype Any_Priority is Integer range 0 .. 31; -+ subtype Priority is Any_Priority range 0 .. 30; -+ subtype Interrupt_Priority is Any_Priority range 31 .. 31; -+ -+ Default_Priority : constant Priority := 15; -+ -+private -+ -+ type Address is mod Memory_Size; -+ Null_Address : constant Address := 0; -+ -+ -------------------------------------- -+ -- System Implementation Parameters -- -+ -------------------------------------- -+ -+ -- These parameters provide information about the target that is used -+ -- by the compiler. They are in the private part of System, where they -+ -- can be accessed using the special circuitry in the Targparm unit -+ -- whose source should be consulted for more detailed descriptions -+ -- of the individual switch values. -+ -+ Backend_Divide_Checks : constant Boolean := False; -+ Backend_Overflow_Checks : constant Boolean := True; -+ Command_Line_Args : constant Boolean := True; -+ Configurable_Run_Time : constant Boolean := False; -+ Denorm : constant Boolean := True; -+ Duration_32_Bits : constant Boolean := False; -+ Exit_Status_Supported : constant Boolean := True; -+ Fractional_Fixed_Ops : constant Boolean := False; -+ Frontend_Layout : constant Boolean := False; -+ Machine_Overflows : constant Boolean := False; -+ Machine_Rounds : constant Boolean := True; -+ Preallocated_Stacks : constant Boolean := False; -+ Signed_Zeros : constant Boolean := True; -+ Stack_Check_Default : constant Boolean := False; -+ Stack_Check_Probes : constant Boolean := True; -+ Stack_Check_Limits : constant Boolean := False; -+ Support_Aggregates : constant Boolean := True; -+ Support_Atomic_Primitives : constant Boolean := True; -+ Support_Composite_Assign : constant Boolean := True; -+ Support_Composite_Compare : constant Boolean := True; -+ Support_Long_Shifts : constant Boolean := True; -+ Always_Compatible_Rep : constant Boolean := False; -+ Suppress_Standard_Library : constant Boolean := False; -+ Use_Ada_Main_Program_Name : constant Boolean := False; -+ ZCX_By_Default : constant Boolean := False; -+ -+end System; ---- /dev/null -+++ gcc/ada/system-openbsd-x86_64.ads -@@ -0,0 +1,144 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT RUN-TIME COMPONENTS -- -+-- -- -+-- S Y S T E M -- -+-- -- -+-- S p e c -- -+-- (OpenBSD/x86_64 Version) -- -+-- -- -+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- -- -+-- This specification is derived from the Ada Reference Manual for use with -- -+-- GNAT. The copyright notice above, and the license provisions that follow -- -+-- apply solely to the contents of the part following the private keyword. -- -+-- -- -+-- GNAT 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 3, or (at your option) any later ver- -- -+-- sion. GNAT 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. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNAT was originally developed by the GNAT team at New York University. -- -+-- Extensive contributions were provided by Ada Core Technologies Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+package System is -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). -+ -+ type Name is (SYSTEM_NAME_GNAT); -+ System_Name : constant Name := SYSTEM_NAME_GNAT; -+ -+ -- System-Dependent Named Numbers -+ -+ Min_Int : constant := Long_Long_Integer'First; -+ Max_Int : constant := Long_Long_Integer'Last; -+ -+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; -+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; -+ -+ Max_Base_Digits : constant := Long_Long_Float'Digits; -+ Max_Digits : constant := Long_Long_Float'Digits; -+ -+ Max_Mantissa : constant := 63; -+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa); -+ -+ Tick : constant := 0.000_001; -+ -+ -- Storage-related Declarations -+ -+ type Address is private; -+ pragma Preelaborable_Initialization (Address); -+ Null_Address : constant Address; -+ -+ Storage_Unit : constant := 8; -+ Word_Size : constant := 64; -+ Memory_Size : constant := 2 ** 64; -+ -+ -- Address comparison -+ -+ function "<" (Left, Right : Address) return Boolean; -+ function "<=" (Left, Right : Address) return Boolean; -+ function ">" (Left, Right : Address) return Boolean; -+ function ">=" (Left, Right : Address) return Boolean; -+ function "=" (Left, Right : Address) return Boolean; -+ -+ pragma Import (Intrinsic, "<"); -+ pragma Import (Intrinsic, "<="); -+ pragma Import (Intrinsic, ">"); -+ pragma Import (Intrinsic, ">="); -+ pragma Import (Intrinsic, "="); -+ -+ -- Other System-Dependent Declarations -+ -+ type Bit_Order is (High_Order_First, Low_Order_First); -+ Default_Bit_Order : constant Bit_Order := Low_Order_First; -+ pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -+ -+ -- Priority-related Declarations (RM D.1) -+ -+ Max_Priority : constant Positive := 30; -+ Max_Interrupt_Priority : constant Positive := 31; -+ -+ subtype Any_Priority is Integer range 0 .. 31; -+ subtype Priority is Any_Priority range 0 .. 30; -+ subtype Interrupt_Priority is Any_Priority range 31 .. 31; -+ -+ Default_Priority : constant Priority := 15; -+ -+private -+ -+ type Address is mod Memory_Size; -+ Null_Address : constant Address := 0; -+ -+ -------------------------------------- -+ -- System Implementation Parameters -- -+ -------------------------------------- -+ -+ -- These parameters provide information about the target that is used -+ -- by the compiler. They are in the private part of System, where they -+ -- can be accessed using the special circuitry in the Targparm unit -+ -- whose source should be consulted for more detailed descriptions -+ -- of the individual switch values. -+ -+ Backend_Divide_Checks : constant Boolean := False; -+ Backend_Overflow_Checks : constant Boolean := True; -+ Command_Line_Args : constant Boolean := True; -+ Configurable_Run_Time : constant Boolean := False; -+ Denorm : constant Boolean := True; -+ Duration_32_Bits : constant Boolean := False; -+ Exit_Status_Supported : constant Boolean := True; -+ Fractional_Fixed_Ops : constant Boolean := False; -+ Frontend_Layout : constant Boolean := False; -+ Machine_Overflows : constant Boolean := False; -+ Machine_Rounds : constant Boolean := True; -+ Preallocated_Stacks : constant Boolean := False; -+ Signed_Zeros : constant Boolean := True; -+ Stack_Check_Default : constant Boolean := False; -+ Stack_Check_Probes : constant Boolean := True; -+ Stack_Check_Limits : constant Boolean := False; -+ Support_Aggregates : constant Boolean := True; -+ Support_Atomic_Primitives : constant Boolean := True; -+ Support_Composite_Assign : constant Boolean := True; -+ Support_Composite_Compare : constant Boolean := True; -+ Support_Long_Shifts : constant Boolean := True; -+ Always_Compatible_Rep : constant Boolean := False; -+ Suppress_Standard_Library : constant Boolean := False; -+ Use_Ada_Main_Program_Name : constant Boolean := False; -+ ZCX_By_Default : constant Boolean := False; -+ -+end System; --- gcc/ada/terminals.c.orig +++ gcc/ada/terminals.c @@ -31,8 +31,7 @@ @@ -8166,23 +3640,21 @@ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-android.adb \ s-linux.ads<s-linux-android.ads \ -@@ -1056,13 +1057,9 @@ +@@ -1056,13 +1057,11 @@ system.ads<system-linux-armel.ads \ a-exexpr.adb<a-exexpr-gcc.adb \ s-excmac.ads<s-excmac-arm.ads \ - $(DUMMY_SOCKETS_TARGET_PAIRS) -- -- TOOLS_TARGET_PAIRS = \ -- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ -- indepsw.adb<indepsw-gnu.adb -+ a-exexpr.adb<a-exexpr-gcc.adb \ -+ s-excmac.ads<s-excmac-arm.ads + + TOOLS_TARGET_PAIRS = \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ + indepsw.adb<indepsw-gnu.adb - GNATRTL_SOCKETS_OBJS = EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EXTRA_LIBGNAT_OBJS+=raise-gcc.o sigtramp-armdroid.o EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o -@@ -1076,6 +1073,7 @@ +@@ -1076,6 +1075,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),) LIBGNAT_TARGET_PAIRS_COMMON = \ a-intnam.ads<a-intnam-solaris.ads \ @@ -8190,7 +3662,7 @@ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-solaris.adb \ s-mudido.adb<s-mudido-affinity.adb \ -@@ -1118,6 +1116,8 @@ +@@ -1118,6 +1118,8 @@ TOOLS_TARGET_PAIRS=mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb EH_MECHANISM=-gcc @@ -8199,12 +3671,9 @@ THREADSLIB = -lposix4 -lthread MISCLIB = -lposix4 -lnsl -lsocket SO_OPTS = -Wl,-h, -@@ -1329,12 +1329,17 @@ - # x86 FreeBSD +@@ -1330,8 +1332,11 @@ ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),) LIBGNAT_TARGET_PAIRS = \ -+ a-exetim.adb<a-exetim-posix.adb \ -+ a-exetim.ads<a-exetim-default.ads \ a-intnam.ads<a-intnam-freebsd.ads \ + g-socthi.adb<g-socthi-bsd.adb \ + g-trasym.adb<g-trasym-bsd.adb \ @@ -8212,34 +3681,20 @@ s-intman.adb<s-intman-posix.adb \ + s-mudido.adb<s-mudido-affinity.adb \ s-osinte.adb<s-osinte-freebsd.adb \ -- s-osinte.ads<s-osinte-freebsd.ads \ -- s-osprim.adb<s-osprim-posix.adb \ -+ s-osinte.ads<s-osinte-freebsd32.ads \ -+ s-osprim.adb<s-osprim-bsd32.adb \ - s-taprop.adb<s-taprop-posix.adb \ - s-taspri.ads<s-taspri-posix.ads \ - s-tpopsp.adb<s-tpopsp-posix.adb \ -@@ -1342,11 +1347,12 @@ - $(X86_TARGET_PAIRS) \ - system.ads<system-freebsd-x86.ads - -- TOOLS_TARGET_PAIRS = \ -- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + s-osinte.ads<s-osinte-freebsd.ads \ + s-osprim.adb<s-osprim-posix.adb \ +@@ -1346,6 +1351,8 @@ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb GNATLIB_SHARED = gnatlib-shared-dual + EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c + EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o -+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o EH_MECHANISM=-gcc - THREADSLIB= -lpthread -@@ -1358,12 +1364,17 @@ - # x86-64 FreeBSD +@@ -1359,8 +1366,11 @@ ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),) LIBGNAT_TARGET_PAIRS = \ -+ a-exetim.adb<a-exetim-posix.adb \ -+ a-exetim.ads<a-exetim-default.ads \ a-intnam.ads<a-intnam-freebsd.ads \ + g-socthi.adb<g-socthi-bsd.adb \ + g-trasym.adb<g-trasym-bsd.adb \ @@ -8247,60 +3702,15 @@ s-intman.adb<s-intman-posix.adb \ + s-mudido.adb<s-mudido-affinity.adb \ s-osinte.adb<s-osinte-freebsd.adb \ -- s-osinte.ads<s-osinte-freebsd.ads \ -- s-osprim.adb<s-osprim-posix.adb \ -+ s-osinte.ads<s-osinte-freebsd64.ads \ -+ s-osprim.adb<s-osprim-bsd64.adb \ - s-taprop.adb<s-taprop-posix.adb \ - s-taspri.ads<s-taspri-posix.ads \ - s-tpopsp.adb<s-tpopsp-posix.adb \ -@@ -1371,11 +1382,240 @@ - $(X86_64_TARGET_PAIRS) \ - system.ads<system-freebsd-x86_64.ads - -- TOOLS_TARGET_PAIRS = \ -- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + s-osinte.ads<s-osinte-freebsd.ads \ + s-osprim.adb<s-osprim-posix.adb \ +@@ -1375,6 +1385,181 @@ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb GNATLIB_SHARED = gnatlib-shared-dual + EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c + EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o + EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o -+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o -+ -+ EH_MECHANISM=-gcc -+ THREADSLIB= -lpthread -+ GMEM_LIB = gmemlib -+ LIBRARY_VERSION := $(LIB_VERSION) -+ MISCLIB = -lutil -+endif -+ -+# x86 DragonFly -+ifeq ($(strip $(filter-out %86 dragonfly%,$(target_cpu) $(target_os))),) -+ LIBGNAT_TARGET_PAIRS = \ -+ a-exetim.adb<a-exetim-posix.adb \ -+ a-exetim.ads<a-exetim-default.ads \ -+ a-intnam.ads<a-intnam-dragonfly.ads \ -+ g-socthi.adb<g-socthi-bsd.adb \ -+ g-trasym.adb<g-trasym-bsd.adb \ -+ s-inmaop.adb<s-inmaop-posix.adb \ -+ s-intman.adb<s-intman-posix.adb \ -+ s-mudido.adb<s-mudido-affinity.adb \ -+ s-osinte.adb<s-osinte-dragonfly.adb \ -+ s-osinte.ads<s-osinte-dragonfly.ads \ -+ s-osprim.adb<s-osprim-posix.adb \ -+ s-taprop.adb<s-taprop-posix.adb \ -+ s-taspri.ads<s-taspri-posix.ads \ -+ s-tpopsp.adb<s-tpopsp-posix.adb \ -+ $(ATOMICS_TARGET_PAIRS) \ -+ $(X86_TARGET_PAIRS) \ -+ system.ads<system-dragonfly-x86.ads -+ -+ GNATLIB_SHARED = gnatlib-shared-dual -+ -+ EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c -+ EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o -+ EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o -+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o + + EH_MECHANISM=-gcc + THREADSLIB= -lpthread @@ -8312,8 +3722,6 @@ +# x86_64 DragonFly +ifeq ($(strip $(filter-out x86_64 dragonfly%,$(target_cpu) $(target_os))),) + LIBGNAT_TARGET_PAIRS = \ -+ a-exetim.adb<a-exetim-posix.adb \ -+ a-exetim.ads<a-exetim-default.ads \ + a-intnam.ads<a-intnam-dragonfly.ads \ + g-socthi.adb<g-socthi-bsd.adb \ + g-trasym.adb<g-trasym-bsd.adb \ @@ -8330,12 +3738,13 @@ + $(X86_64_TARGET_PAIRS) \ + system.ads<system-dragonfly-x86_64.ads + ++ TOOLS_TARGET_PAIRS = \ ++ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + GNATLIB_SHARED = gnatlib-shared-dual + + EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c + EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o + EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o -+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o + + EH_MECHANISM=-gcc + THREADSLIB= -lpthread @@ -8347,8 +3756,6 @@ +# x86 OpenBSD +ifeq ($(strip $(filter-out %86 openbsd%,$(target_cpu) $(target_os))),) + LIBGNAT_TARGET_PAIRS = \ -+ a-exetim.adb<a-exetim-posix.adb \ -+ a-exetim.ads<a-exetim-default.ads \ + a-intnam.ads<a-intnam-openbsd.ads \ + g-socthi.adb<g-socthi-bsd.adb \ + g-trasym.adb<g-trasym-bsd.adb \ @@ -8357,7 +3764,7 @@ + s-mudido.adb<s-mudido-affinity.adb \ + s-osinte.adb<s-osinte-openbsd.adb \ + s-osinte.ads<s-osinte-openbsd.ads \ -+ s-osprim.adb<s-osprim-bsd32.adb \ ++ s-osprim.adb<s-osprim-posix.adb \ + s-taprop.adb<s-taprop-posix.adb \ + s-taspri.ads<s-taspri-posix.ads \ + s-tpopsp.adb<s-tpopsp-posix.adb \ @@ -8365,12 +3772,13 @@ + $(X86_TARGET_PAIRS) \ + system.ads<system-openbsd-x86.ads + ++ TOOLS_TARGET_PAIRS = \ ++ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + GNATLIB_SHARED = gnatlib-shared-dual + + EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c + EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o + EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o -+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o + + EH_MECHANISM= + THREADSLIB= -lpthread @@ -8392,7 +3800,7 @@ + s-mudido.adb<s-mudido-affinity.adb \ + s-osinte.adb<s-osinte-openbsd.adb \ + s-osinte.ads<s-osinte-openbsd.ads \ -+ s-osprim.adb<s-osprim-bsd32.adb \ ++ s-osprim.adb<s-osprim-posix.adb \ + s-taprop.adb<s-taprop-posix.adb \ + s-taspri.ads<s-taspri-posix.ads \ + s-tpopsp.adb<s-tpopsp-posix.adb \ @@ -8400,6 +3808,8 @@ + $(X86_64_TARGET_PAIRS) \ + system.ads<system-openbsd-x86_64.ads + ++ TOOLS_TARGET_PAIRS = \ ++ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + GNATLIB_SHARED = gnatlib-shared-dual + + EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c @@ -8414,18 +3824,18 @@ + MISCLIB = -lutil +endif + -+# x86 NetBSD (5+ only) ++# x86 NetBSD +ifeq ($(strip $(filter-out %86 netbsd%,$(target_cpu) $(target_os))),) + LIBGNAT_TARGET_PAIRS = \ -+ a-exetim.adb<a-exetim-posix.adb \ -+ a-exetim.ads<a-exetim-default.ads \ + a-intnam.ads<a-intnam-netbsd.ads \ -+ g-socthi.adb<g-socthi-netbsd.adb \ ++ g-socthi.adb<g-socthi-bsd.adb \ + g-trasym.adb<g-trasym-bsd.adb \ + s-inmaop.adb<s-inmaop-posix.adb \ + s-intman.adb<s-intman-posix.adb \ + s-mudido.adb<s-mudido-affinity.adb \ + s-osinte.adb<s-osinte-netbsd.adb \ ++ s-osinte.ads<s-osinte-netbsd.ads \ ++ s-osprim.adb<s-osprim-posix.adb \ + s-taprop.adb<s-taprop-posix.adb \ + s-taspri.ads<s-taspri-posix.ads \ + s-tpopsp.adb<s-tpopsp-posix.adb \ @@ -8433,23 +3843,13 @@ + $(X86_TARGET_PAIRS) \ + system.ads<system-netbsd-x86.ads + -+ ifeq ($(strip $(filter-out %86 netbsdelf5%,$(target_cpu) $(target_os))),) -+ LIBGNAT_TARGET_PAIRS+= \ -+ s-osinte.ads<s-osinte-netbsd.ads \ -+ s-osprim.adb<s-osprim-bsd32.adb -+ else -+ LIBGNAT_TARGET_PAIRS+= \ -+ g-socthi.ads<g-socthi-netbsd6.ads \ -+ s-osinte.ads<s-osinte-netbsd6.ads \ -+ s-osprim.adb<s-osprim-bsdn6.adb -+ endif -+ ++ TOOLS_TARGET_PAIRS = \ ++ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + GNATLIB_SHARED = gnatlib-shared-dual + + EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c + EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o + EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o -+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o + + EH_MECHANISM=-gcc + THREADSLIB= -lpthread @@ -8458,18 +3858,18 @@ + MISCLIB = -lutil +endif + -+# x86_64 NetBSD (5+ only) ++# x86_64 NetBSD +ifeq ($(strip $(filter-out x86_64 netbsd%,$(target_cpu) $(target_os))),) + LIBGNAT_TARGET_PAIRS = \ -+ a-exetim.adb<a-exetim-posix.adb \ -+ a-exetim.ads<a-exetim-default.ads \ + a-intnam.ads<a-intnam-netbsd.ads \ -+ g-socthi.adb<g-socthi-netbsd.adb \ ++ g-socthi.adb<g-socthi-bsd.adb \ + g-trasym.adb<g-trasym-bsd.adb \ + s-inmaop.adb<s-inmaop-posix.adb \ + s-intman.adb<s-intman-posix.adb \ + s-mudido.adb<s-mudido-affinity.adb \ + s-osinte.adb<s-osinte-netbsd.adb \ ++ s-osinte.ads<s-osinte-netbsd.ads \ ++ s-osprim.adb<s-osprim-posix.adb \ + s-taprop.adb<s-taprop-posix.adb \ + s-taspri.ads<s-taspri-posix.ads \ + s-tpopsp.adb<s-tpopsp-posix.adb \ @@ -8477,26 +3877,30 @@ + $(X86_64_TARGET_PAIRS) \ + system.ads<system-netbsd-x86_64.ads + -+ ifeq ($(strip $(filter-out x86_64 netbsd5%,$(target_cpu) $(target_os))),) -+ LIBGNAT_TARGET_PAIRS+= \ -+ s-osinte.ads<s-osinte-netbsd.ads \ -+ s-osprim.adb<s-osprim-bsd32.adb -+ else -+ LIBGNAT_TARGET_PAIRS+= \ -+ g-socthi.ads<g-socthi-netbsd6.ads \ -+ s-osinte.ads<s-osinte-netbsd6.ads \ -+ s-osprim.adb<s-osprim-bsdn6.adb -+ endif -+ ++ TOOLS_TARGET_PAIRS = \ ++ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb + GNATLIB_SHARED = gnatlib-shared-dual + + EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c + EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o -+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o EH_MECHANISM=-gcc - THREADSLIB= -lpthread +@@ -2513,6 +2698,14 @@ + # Note: dummy target, stamp-tools is mainly handled by gnattools. + + ../stamp-tools: ++ -$(RM) tools/* ++ -$(RMDIR) tools ++ -$(MKDIR) tools ++ -(cd tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .) ++ -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ ++ $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\ ++ $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \ ++ tools/$(word 1,$(subst <, ,$(PAIR)));) + touch ../stamp-tools + + # when compiling the tools, the runtime has to be first on the path so that --- gnattools/configure.ac.orig +++ gnattools/configure.ac @@ -79,11 +79,27 @@ diff --git a/lang/gcc-aux/files/diff-core b/lang/gcc-aux/files/diff-core index e3cc3919f64..3f23e4ec166 100644 --- a/lang/gcc-aux/files/diff-core +++ b/lang/gcc-aux/files/diff-core @@ -327,62 +327,6 @@ + +#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") ---- gcc/config/openbsd-libpthread.h.orig -+++ gcc/config/openbsd-libpthread.h -@@ -18,5 +18,5 @@ - along with GCC; see the file COPYING3. If not see - <http://www.gnu.org/licenses/>. */ - --#define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread} -lc}" -+#define OBSD_LIB_SPEC "%{pthread:-lpthread%{!shared:%{p|pg:_p}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" - ---- gcc/config/openbsd.h.orig -+++ gcc/config/openbsd.h -@@ -108,9 +108,9 @@ - This two-stage defines makes it easy to pick that for targets that - have subspecs. */ - #ifdef CPP_CPU_SPEC --#define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" -+#define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" - #else --#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" -+#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" - #endif - - #undef LIB_SPEC -@@ -143,6 +143,9 @@ - #define LIB_SPEC OBSD_LIB_SPEC - #endif - -+#undef LINK_PIE_SPEC -+#define LINK_PIE_SPEC "%{pie:-pie} %{p|pg|nopie:-nopie} " -+ - #define TARGET_POSIX_IO - - /* All new versions of OpenBSD have C99 functions. We redefine this hook -@@ -285,5 +288,12 @@ - - /* Storage layout. */ - -+/* Silence "unsafe GNU crap" messages */ -+#define NO_UNSAFE_BUILTINS -+ -+/* The system headers on OpenBSD are C++-aware. */ -+#undef NO_IMPLICIT_EXTERN_C -+#define NO_IMPLICIT_EXTERN_C -+ - - #define HAVE_ENABLE_EXECUTE_STACK ---- gcc/config/openbsd.opt.orig -+++ gcc/config/openbsd.opt -@@ -32,4 +32,7 @@ - pthread - Driver - -+rdynamic -+Driver -+ - ; This comment is to ensure we retain the blank line above. --- /dev/null +++ gcc/config/i386/dragonfly.h @@ -0,0 +1,105 @@ @@ -565,46 +509,6 @@ +#if defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif ---- gcc/config/i386/openbsd.h.orig -+++ gcc/config/i386/openbsd.h -@@ -38,10 +38,10 @@ - - /* This must agree with <machine/ansi.h> */ - #undef SIZE_TYPE --#define SIZE_TYPE "unsigned int" -+#define SIZE_TYPE "long unsigned int" - - #undef PTRDIFF_TYPE --#define PTRDIFF_TYPE "int" -+#define PTRDIFF_TYPE "long int" - - #undef WCHAR_TYPE - #define WCHAR_TYPE "int" -@@ -49,6 +49,9 @@ - #undef WCHAR_TYPE_SIZE - #define WCHAR_TYPE_SIZE 32 - -+#undef WINT_TYPE -+#define WINT_TYPE "int" -+ - /* Assembler format: overall framework. */ - - #undef ASM_APP_ON ---- gcc/config/i386/openbsdelf.h.orig -+++ gcc/config/i386/openbsdelf.h -@@ -97,9 +97,12 @@ - %{shared:-shared} %{R*} \ - %{static:-Bstatic} \ - %{!static:-Bdynamic} \ -+ %{rdynamic:-export-dynamic} \ - %{assert*} \ - -dynamic-linker /usr/libexec/ld.so" - -+#define SUBTARGET32_DEFAULT_CPU "i486" -+ - #undef STARTFILE_SPEC - #define STARTFILE_SPEC "\ - %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \ --- gcc/ginclude/stddef.h.orig +++ gcc/ginclude/stddef.h @@ -50,6 +50,11 @@ @@ -1338,60 +1242,6 @@ #endif +#endif } ---- gcc/builtins.c.orig -+++ gcc/builtins.c -@@ -125,9 +125,11 @@ - static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode); - static rtx expand_builtin_mempcpy_args (tree, tree, tree, rtx, - enum machine_mode, int); -+#ifndef NO_UNSAFE_BUILTINS - static rtx expand_builtin_strcpy (tree, rtx); - static rtx expand_builtin_strcpy_args (tree, tree, rtx); - static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode); -+#endif - static rtx expand_builtin_strncpy (tree, rtx); - static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode); - static rtx expand_builtin_memset (tree, rtx, enum machine_mode); -@@ -3370,6 +3372,7 @@ - # define CODE_FOR_movstr CODE_FOR_nothing - #endif - -+#ifndef NO_UNSAFE_BUILTINS - /* Expand into a movstr instruction, if one is available. Return NULL_RTX if - we failed, the caller should emit a normal call, otherwise try to - get the result in TARGET, if convenient. If ENDP is 0 return the -@@ -3521,6 +3524,7 @@ - return expand_movstr (dst, src, target, /*endp=*/2); - } - } -+#endif - - /* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE) - bytes from constant string DATA + OFFSET and return it as target -@@ -6140,9 +6144,11 @@ - break; - - case BUILT_IN_STRCPY: -+#ifndef NO_UNSAFE_BUILTINS - target = expand_builtin_strcpy (exp, target); - if (target) - return target; -+#endif - break; - - case BUILT_IN_STRNCPY: -@@ -6152,9 +6158,11 @@ - break; - - case BUILT_IN_STPCPY: -+#ifndef NO_UNSAFE_BUILTINS - target = expand_builtin_stpcpy (exp, target, mode); - if (target) - return target; -+#endif - break; - - case BUILT_IN_MEMCPY: --- gcc/config.gcc.orig +++ gcc/config.gcc @@ -687,6 +687,26 @@ @@ -1429,7 +1279,7 @@ tmake_file="t-slibgcc" gas=yes gnu_ld=yes -@@ -1352,6 +1373,14 @@ +@@ -1357,6 +1378,14 @@ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h" tmake_file="i386/t-i386elf t-svr4" ;; @@ -1444,7 +1294,7 @@ i[34567]86-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h" ;; -@@ -1359,12 +1388,14 @@ +@@ -1364,12 +1393,14 @@ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h" ;; i[34567]86-*-netbsdelf*) @@ -1461,7 +1311,7 @@ ;; i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123]) tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h" -@@ -1375,6 +1406,7 @@ +@@ -1380,6 +1411,7 @@ use_collect2=yes ;; i[34567]86-*-openbsd*) @@ -1469,7 +1319,7 @@ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h" extra_options="${extra_options} openbsd.opt" -@@ -1382,6 +1414,7 @@ +@@ -1387,6 +1419,7 @@ gnu_ld=yes ;; x86_64-*-openbsd*) @@ -1477,7 +1327,7 @@ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h" extra_options="${extra_options} openbsd.opt" -@@ -2927,6 +2960,12 @@ +@@ -2935,6 +2968,12 @@ arch_without_sse2=yes arch_without_64bit=yes ;; @@ -1490,7 +1340,7 @@ i386-*-*) arch=i386 cpu=i386 -@@ -4109,6 +4148,8 @@ +@@ -4114,6 +4153,8 @@ ;; i[34567]86-*-mingw* | x86_64-*-mingw*) ;; @@ -1501,7 +1351,7 @@ ia64*-*-linux*) --- gcc/configure.orig +++ gcc/configure -@@ -27421,6 +27421,20 @@ +@@ -27477,6 +27477,20 @@ gcc_cv_target_dl_iterate_phdr=no fi ;; @@ -1573,7 +1423,7 @@ insn-preds.c: s-preds; @true tm-preds.h: s-preds-h; @true tm-constrs.h: s-constrs-h; @true -@@ -3217,6 +3228,9 @@ +@@ -3219,6 +3230,9 @@ ( cd $(DESTDIR)$(bindir) && \ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ); \ fi @@ -1697,7 +1547,7 @@ // showed that calling _mm_delay_32() (or doing nothing) was a better --- libitm/configure.tgt.orig +++ libitm/configure.tgt -@@ -138,6 +138,7 @@ +@@ -139,6 +139,7 @@ ;; *-*-gnu* | *-*-k*bsd*-gnu \ diff --git a/lang/gcc-aux/files/diff-cxx b/lang/gcc-aux/files/diff-cxx index 9e709e19055..29ed481a78e 100644 --- a/lang/gcc-aux/files/diff-cxx +++ b/lang/gcc-aux/files/diff-cxx @@ -1049,21 +1049,6 @@ return __high; } ---- libstdc++-v3/config/os/bsd/openbsd/os_defines.h.orig -+++ libstdc++-v3/config/os/bsd/openbsd/os_defines.h -@@ -38,4 +38,12 @@ - #define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC _GLIBCXX_USE_C99_DYNAMIC - #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC _GLIBCXX_USE_C99_DYNAMIC - -+/* max_align_t is defined in ginclude/stddef.h which OpenBSD intentionally -+ excludes. Bringing the definition here fixes the libstdc++ build. */ -+ -+typedef struct { -+ long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); -+ long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); -+} max_align_t; -+ - #endif --- libstdc++-v3/acinclude.m4.orig +++ libstdc++-v3/acinclude.m4 @@ -1989,6 +1989,9 @@ diff --git a/lang/gcc-aux/files/diff-fortran b/lang/gcc-aux/files/diff-fortran index caf531d1909..33699a9b9b0 100644 --- a/lang/gcc-aux/files/diff-fortran +++ b/lang/gcc-aux/files/diff-fortran @@ -1,6 +1,6 @@ --- gcc/fortran/f95-lang.c.orig +++ gcc/fortran/f95-lang.c -@@ -718,10 +718,17 @@ +@@ -742,10 +742,17 @@ gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble, BUILT_IN_CABSL, "cabsl", ATTR_CONST_NOTHROW_LEAF_LIST); @@ -31,7 +31,7 @@ ;; --- libgfortran/configure.orig +++ libgfortran/configure -@@ -26340,7 +26340,7 @@ +@@ -26346,7 +26346,7 @@ fi case "$host" in diff --git a/lang/gcc-aux/options.mk b/lang/gcc-aux/options.mk index 34b79d0560d..427e7ed02b1 100644 --- a/lang/gcc-aux/options.mk +++ b/lang/gcc-aux/options.mk @@ -1,8 +1,11 @@ -# $NetBSD: options.mk,v 1.4 2014/05/13 08:18:04 marino Exp $ +# $NetBSD: options.mk,v 1.5 2015/06/14 19:46:51 marino Exp $ + +# NLS is failing, might be linking with wrong iconv lib. +# Disable option until further notice PKG_OPTIONS_VAR= PKG_OPTIONS.gcc-aux -PKG_SUPPORTED_OPTIONS= fortran objc testsuite nls static bootstrap -PKG_SUGGESTED_OPTIONS= fortran objc nls +PKG_SUPPORTED_OPTIONS= fortran objc testsuite static bootstrap #nls +PKG_SUGGESTED_OPTIONS= fortran objc #nls .include "../../mk/bsd.options.mk" |