From: Jerome Lambourg Date: Thu, 11 Jan 2018 08:53:52 +0000 (+0000) Subject: [Ada] QNX: various runtime fixes for file I/O, timers, timezone X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9e8030617cb310758929ee622cc8bff2372bb55;p=gcc.git [Ada] QNX: various runtime fixes for file I/O, timers, timezone 2018-01-11 Jerome Lambourg gcc/ada/ * libgnat/g-soliop__qnx.ads: New. * adaint.c, adaint.h, cstreams.c, s-oscons-tmplt.c, sysdep.c: Update for QNX. From-SVN: r256512 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index eaad418a5cb..98cff55c255 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-01-11 Jerome Lambourg + + * libgnat/g-soliop__qnx.ads: New. + * adaint.c, adaint.h, cstreams.c, s-oscons-tmplt.c, sysdep.c: Update + for QNX. + 2018-01-11 Bob Duff * par-ch9.adb (P_Protected_Operation_Declaration_Opt): Give an error if diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 19fe957c408..3b0aea92c05 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2017, Free Software Foundation, Inc. * + * Copyright (C) 1992-2018, 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- * @@ -81,6 +81,10 @@ #define __BSD_VISIBLE 1 #endif +#if defined (__QNX__) +#define _LARGEFILE64_SOURCE 1 +#endif + #ifdef IN_RTS #include "tconfig.h" #include "tsystem.h" @@ -773,7 +777,7 @@ __gnat_rmdir (char *path) } #if defined (_WIN32) || defined (__linux__) || defined (__sun__) \ - || defined (__FreeBSD__) || defined(__DragonFly__) + || defined (__FreeBSD__) || defined(__DragonFly__) || defined (__QNX__) #define HAS_TARGET_WCHAR_T #endif @@ -2346,7 +2350,7 @@ __gnat_number_of_cpus (void) #if defined (__linux__) || defined (__sun__) || defined (_AIX) \ || defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ - || defined (__DragonFly__) || defined (__NetBSD__) + || defined (__DragonFly__) || defined (__NetBSD__) || defined (__QNX__) cores = (int) sysconf (_SC_NPROCESSORS_ONLN); #elif defined (__hpux__) diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h index 028ffbf2979..0d12f7e9020 100644 --- a/gcc/ada/adaint.h +++ b/gcc/ada/adaint.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2017, Free Software Foundation, Inc. * + * Copyright (C) 1992-2018, 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- * @@ -51,7 +51,7 @@ extern "C" { determine at compile time what support the system offers for large files. For now we just list the platforms we have manually tested. */ -#if defined (__GLIBC__) || defined (__sun__) +#if defined (__GLIBC__) || defined (__sun__) || defined (__QNX__) #define GNAT_FOPEN fopen64 #define GNAT_OPEN open64 #define GNAT_STAT stat64 diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c index e4e614744b3..cdcb531e2b3 100644 --- a/gcc/ada/cstreams.c +++ b/gcc/ada/cstreams.c @@ -6,7 +6,7 @@ * * * Auxiliary C functions for Interfaces.C.Streams * * * - * Copyright (C) 1992-2017, Free Software Foundation, Inc. * + * Copyright (C) 1992-2018, 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- * @@ -198,6 +198,19 @@ __gnat_full_name (char *nam, char *buffer) getcwd approach instead. */ realpath (nam, buffer); +#elif defined (__QNX__) + + int length; + + if (__gnat_is_absolute_path (nam, strlen (nam))) + realpath (nam, buffer); + else + { + length = __gnat_max_path_len; + __gnat_get_current_dir (buffer, &length); + strncat (buffer, nam, __gnat_max_path_len - length - 1); + } + #elif defined (__vxworks) /* On VxWorks systems, an absolute path can be represented (depending on diff --git a/gcc/ada/libgnat/g-soliop__qnx.ads b/gcc/ada/libgnat/g-soliop__qnx.ads new file mode 100644 index 00000000000..2904a58edf5 --- /dev/null +++ b/gcc/ada/libgnat/g-soliop__qnx.ads @@ -0,0 +1,43 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- G N A T . S O C K E T S . L I N K E R _ O P T I O N S -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2001-2018, 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 -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package is used to provide target specific linker_options for the +-- support of sockets as required by the package GNAT.Sockets. + +-- This is an empty version for default use where no additional libraries +-- are required. On some targets a target specific version of this unit +-- ensures linking with required libraries for proper sockets operation. + +-- This package should not be directly with'ed by an application program + +package GNAT.Sockets.Linker_Options is + pragma Linker_Options ("-lsocket"); +end GNAT.Sockets.Linker_Options; diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index 95eadfc8854..4d224509caa 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -7,7 +7,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2000-2017, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2018, 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- -- @@ -1443,7 +1443,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock") #if defined(__linux__) || defined(__FreeBSD__) \ || (defined(_AIX) && defined(_AIXVERSION_530)) \ - || defined(__DragonFly__) + || defined(__DragonFly__) || defined(__QNX__) /** On these platforms use system provided monotonic clock instead of ** the default CLOCK_REALTIME. We then need to set up cond var attributes ** appropriately (see thread.c). diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 698c8ca04f7..98b3901cb16 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2017, Free Software Foundation, Inc. * + * Copyright (C) 1992-2018, 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- * @@ -317,7 +317,8 @@ __gnat_ttyname (int filedes) || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \ || (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \ || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ - || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) + || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \ + || defined (__QNX__) # ifdef __MINGW32__ # if OLD_MINGW @@ -369,7 +370,8 @@ getc_immediate_common (FILE *stream, || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ - || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) + || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \ + || defined (__QNX__) char c; int nread; int good_one = 0; @@ -389,7 +391,8 @@ getc_immediate_common (FILE *stream, || defined (__MACHTEN__) || defined (__hpux__) \ || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ - || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) + || defined (__GLIBC__) || defined (__APPLE__) || defined (__DragonFly__) \ + || defined (__QNX__) eof_ch = termios_rec.c_cc[VEOF]; /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for @@ -826,7 +829,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED, #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \ || defined (__GLIBC__) || defined (__DragonFly__) || defined (__OpenBSD__) \ - || defined (__DJGPP__) + || defined (__DJGPP__) || defined (__QNX__) { localtime_r (timer, &tp); *off = tp.tm_gmtoff;