From: Joel Sherrill Date: Wed, 13 Feb 2008 19:04:53 +0000 (+0000) Subject: re PR ada/35143 (Serious regression on ACATS results since 4.2.3) X-Git-Tag: releases/gcc-4.3.0~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a333ca04f20c16c42aa15c004a26ebbc9fad02c;p=thirdparty%2Fgcc.git re PR ada/35143 (Serious regression on ACATS results since 4.2.3) 2008-02-11 Joel Sherrill PR ada/35143 * env.c: Add __rtems__ to if defined. * s-osinte-rtems.adb: Add To_Target_Priority. Fix formatting. * s-osinte-rtems.ads: Add To_Target_Priority prototype and PTHREAD_SCOPE_PROCESS/PTHREAD_SCOPE_SYSTEM constants. Add pragma Convention as required. * gsocket.h: Make compile in and out of RTS. * Makefile.in: Add system-rtems.ads. Build DEC extensions. Use g-soccon-rtems.ads. * g-soccon-rtems.ads, system-rtems.ads: New files. From-SVN: r132294 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c8914b23cf30..404c262cdbd4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2008-02-11 Joel Sherrill + + PR ada/35143 + * env.c: Add __rtems__ to if defined. + * s-osinte-rtems.adb: Add To_Target_Priority. Fix formatting. + * s-osinte-rtems.ads: Add To_Target_Priority prototype and + PTHREAD_SCOPE_PROCESS/PTHREAD_SCOPE_SYSTEM constants. Add + pragma Convention as required. + * gsocket.h: Make compile in and out of RTS. + * Makefile.in: Add system-rtems.ads. Build DEC extensions. + Use g-soccon-rtems.ads. + * g-soccon-rtems.ads, system-rtems.ads: New files. + 2008-02-06 Kaveh R. Ghazi PR other/35107 diff --git a/gcc/ada/Makefile.in b/gcc/ada/Makefile.in index 3dd5298be989..286992676907 100644 --- a/gcc/ada/Makefile.in +++ b/gcc/ada/Makefile.in @@ -1,5 +1,5 @@ # Makefile for GNU Ada Compiler (GNAT). -# Copyright (C) 1994-2007 Free Software Foundation, Inc. +# Copyright (C) 1994-2008 Free Software Foundation, Inc. #This file is part of GCC. @@ -1136,6 +1136,7 @@ endif ifeq ($(strip $(filter-out rtems%,$(osys))),) LIBGNAT_TARGET_PAIRS = \ + system.ads #endif -#if !(defined (VMS) || defined (__MINGW32__) || defined(__rtems__)) +/* + * RTEMS has these .h files but not until you have built RTEMS. When + * IN_RTS, you only have the .h files in the newlib C library. + * Because this file is also included from gen-soccon.c which is built + * to run on RTEMS (not IN_RTS), we must distinguish between IN_RTS + * and using this file to compile gen-soccon. + */ +#if !(defined (VMS) || defined (__MINGW32__) || \ + (defined(__rtems__) && defined(IN_RTS))) #include #include #include diff --git a/gcc/ada/s-osinte-rtems.adb b/gcc/ada/s-osinte-rtems.adb index 0a8e68199449..494947cbd7f2 100644 --- a/gcc/ada/s-osinte-rtems.adb +++ b/gcc/ada/s-osinte-rtems.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1991-2002 Florida State University -- +-- Copyright (C) 1991-2008 Florida State University -- -- -- -- 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- -- @@ -57,6 +57,17 @@ package body System.OS_Interface is 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 -- ----------------- @@ -70,7 +81,10 @@ package body System.OS_Interface is -- If F has negative value due to round-up, adjust for positive F value - if F < 0.0 then S := S - 1; F := F + 1.0; end if; + 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; @@ -89,7 +103,10 @@ package body System.OS_Interface is -- 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; + if F < 0.0 then + S := S - 1; + F := F + 1.0; + end if; return struct_timeval' (tv_sec => S, diff --git a/gcc/ada/s-osinte-rtems.ads b/gcc/ada/s-osinte-rtems.ads index 561e8973ef37..268eb43ac216 100644 --- a/gcc/ada/s-osinte-rtems.ads +++ b/gcc/ada/s-osinte-rtems.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1997-2003 Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2008 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- -- @@ -194,6 +194,10 @@ package System.OS_Interface is SCHED_RR : constant := 2; SCHED_OTHER : constant := 0; + function To_Target_Priority + (Prio : System.Any_Priority) return Interfaces.C.int; + -- Maps System.Any_Priority to a POSIX priority + ------------- -- Process -- ------------- @@ -222,6 +226,7 @@ package System.OS_Interface is type Thread_Body is access function (arg : System.Address) return System.Address; + pragma Convention (C, Thread_Body); type pthread_t is private; subtype Thread_Id is pthread_t; @@ -237,6 +242,9 @@ package System.OS_Interface is PTHREAD_CREATE_DETACHED : constant := 0; + PTHREAD_SCOPE_PROCESS : constant := 0; + PTHREAD_SCOPE_SYSTEM : constant := 1; + ----------- -- Stack -- ----------- @@ -460,6 +468,7 @@ package System.OS_Interface is 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; diff --git a/gcc/ada/system-rtems.ads b/gcc/ada/system-rtems.ads new file mode 100644 index 000000000000..95338f52d12e --- /dev/null +++ b/gcc/ada/system-rtems.ads @@ -0,0 +1,168 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- S Y S T E M -- +-- -- +-- S p e c -- +-- (Compiler Version) -- +-- -- +-- Copyright (C) 1992-2008 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 2, 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. See the GNU General Public License -- +-- for more details. You should have received a copy of the GNU General -- +-- Public License distributed with GNAT; see file COPYING. If not, write -- +-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- +-- Boston, MA 02110-1301, USA. -- +-- -- +-- As a special exception, if other files instantiate generics from this -- +-- unit, or you link this unit with other files to produce an executable, -- +-- this unit does not by itself cause the resulting executable to be -- +-- covered by the GNU General Public License. This exception does not -- +-- however invalidate any other reasons why the executable file might be -- +-- covered by the GNU Public License. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This version of System is a RTEMS version that is used in building +-- the compiler. This is based as closely as possible on the generic +-- version with the following exceptions: +-- + priority definitions + +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 := Integer'Last; + + 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.01; + + -- Storage-related Declarations + + type Address is private; + Null_Address : constant Address; + + Storage_Unit : constant := Standard'Storage_Unit; + Word_Size : constant := Standard'Word_Size; + Memory_Size : constant := 2 ** Standard'Address_Size; + + -- 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 := + Bit_Order'Val (Standard'Default_Bit_Order); + pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning + + -- Priority-related Declarations (RM D.1) + + -- RTEMS POSIX threads support 256 priority levels with 255 being + -- logically the most important. Levels 0 and 255 are reserved. + -- + -- 255 is reserved for RTEMS system tasks + -- 247 - 254 correspond to hardware interrupt levels 0 .. 7 + -- 246 is a catchall default "interrupt" priority for signals, + -- allowing higher priority than normal tasks, but lower than + -- hardware priority levels. Protected Object ceilings can + -- override these values. + -- 245 is used by the Interrupt_Manager task + -- 0 is reserved for the RTEMS IDLE task and really should not + -- be accessible from Ada but GNAT initializes + -- Current_Priority to 0 so it must be valid + + Max_Priority : constant Positive := 244; + Max_Interrupt_Priority : constant Positive := 254; + + subtype Any_Priority is Integer range 0 .. 254; + subtype Priority is Any_Priority range 0 .. 244; + subtype Interrupt_Priority is Any_Priority range 245 .. 254; + + Default_Priority : constant Priority := 122; + +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 := False; + 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 := False; + Support_64_Bit_Divides : constant Boolean := True; + Support_Aggregates : constant Boolean := True; + Support_Composite_Assign : constant Boolean := True; + Support_Composite_Compare : constant Boolean := True; + Support_Long_Shifts : constant Boolean := True; + Suppress_Standard_Library : constant Boolean := False; + Use_Ada_Main_Program_Name : constant Boolean := False; + ZCX_By_Default : constant Boolean := False; + GCC_ZCX_Support : constant Boolean := True; + + -- One would think you did not have to define this but + -- it is used in the run-time. + OpenVMS : constant Boolean := False; + +end System;