aboutsummaryrefslogtreecommitdiff
path: root/lang/gnat/files
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>1999-06-24 11:11:28 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>1999-06-24 11:11:28 +0000
commitcc4e71cb594f3b20034c1183bc4123bc46c2b12a (patch)
tree55b196c54dbe3b7825b7d1ae03d86ff5dae53271 /lang/gnat/files
parent78f3dcd0fab9ffeba056dd01da7646722166b59a (diff)
downloadports-cc4e71cb594f3b20034c1183bc4123bc46c2b12a.tar.gz
ports-cc4e71cb594f3b20034c1183bc4123bc46c2b12a.zip
Notes
Diffstat (limited to 'lang/gnat/files')
-rw-r--r--lang/gnat/files/4fintnam.ads2
-rw-r--r--lang/gnat/files/5fintman.adb69
-rw-r--r--lang/gnat/files/5fosinte.adb75
-rw-r--r--lang/gnat/files/5fosinte.ads254
-rw-r--r--lang/gnat/files/5ftaprop.adb664
-rw-r--r--lang/gnat/files/5ftaspri.ads52
-rw-r--r--lang/gnat/files/freebsdgcc28-patches538
-rw-r--r--lang/gnat/files/patch-aa161
-rw-r--r--lang/gnat/files/patch-ab86
-rw-r--r--lang/gnat/files/patch-ac54
-rw-r--r--lang/gnat/files/patch-ad41
-rw-r--r--lang/gnat/files/patch-ae24
-rw-r--r--lang/gnat/files/patch-af34
13 files changed, 1307 insertions, 747 deletions
diff --git a/lang/gnat/files/4fintnam.ads b/lang/gnat/files/4fintnam.ads
index 29f53e62ae96..eea386d04723 100644
--- a/lang/gnat/files/4fintnam.ads
+++ b/lang/gnat/files/4fintnam.ads
@@ -39,7 +39,7 @@
-- This is only a first approximation.
-- It should be autogenerated by the m4 macro processor.
--- Contributed by Daniel Eischen (deischen@iworks.InterWorks.org)
+-- Contributed by Daniel Eischen (eischen@vigrid.com)
with System.OS_Interface;
-- used for names of interrupts
diff --git a/lang/gnat/files/5fintman.adb b/lang/gnat/files/5fintman.adb
index 9d6eb5e45220..db857ec6c5f2 100644
--- a/lang/gnat/files/5fintman.adb
+++ b/lang/gnat/files/5fintman.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (Version for new GNARL) --
-- --
--- $Revision: 1.1 $ --
+-- $Revision: 1.3 $ --
-- --
-- Copyright (C) 1991,1992,1993,1994,1995,1996 Florida State University --
-- --
@@ -44,7 +44,7 @@
-- This file performs the system-dependent translation between machine
-- exceptions and the Ada exceptions, if any, that should be raised when
-- they occur. This version works for FreeBSD. Contributed by
--- Daniel M. Eischen (deischen@iworks.InterWorks.org).
+-- Daniel M. Eischen (eischen@vigrid.com).
-- PLEASE DO NOT add any dependences on other packages.
-- This package is designed to work with or without tasking support.
@@ -61,16 +61,12 @@
with Interfaces.C;
-- used for int and other types
-with System.Error_Reporting;
--- used for Shutdown
-
with System.OS_Interface;
-- used for various Constants, Signal and types
package body System.Interrupt_Management is
use Interfaces.C;
- use System.Error_Reporting;
use System.OS_Interface;
type Interrupt_List is array (Interrupt_ID range <>) of Interrupt_ID;
@@ -137,7 +133,7 @@ package body System.Interrupt_Management is
when SIGBUS =>
raise Storage_Error;
when others =>
- pragma Assert (Shutdown ("Unexpected signal"));
+ pragma Assert (False);
null;
end case;
end Notify_Exception;
@@ -152,6 +148,10 @@ package body System.Interrupt_Management is
mask : aliased sigset_t;
Result : Interfaces.C.int;
+ Unreserve_All_Interrupts : Interfaces.C.int;
+ pragma Import
+ (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
+
begin
Abort_Task_Interrupt := SIGABRT;
@@ -170,14 +170,17 @@ package body System.Interrupt_Management is
-- In that case, this field should be changed back to 0. ??? (Dong-Ik)
Result := sigemptyset (mask'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---sigemptyset"));
+ pragma Assert (Result = 0);
- for I in Exception_Interrupts'Range loop
- Result := sigaddset (mask'Access, Signal (Exception_Interrupts (I)));
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---sigaddset"));
- end loop;
+ -- ??? For the same reason explained above, we can't mask these
+ -- signals because otherwise we won't be able to catch more than
+ -- one signal.
+
+ -- for I in Exception_Interrupts'Range loop
+ -- Result :=
+ -- sigaddset (mask'Access, Signal (Exception_Interrupts (I)));
+ -- pragma Assert (Result = 0);
+ -- end loop;
act.sa_mask := mask;
@@ -185,28 +188,26 @@ package body System.Interrupt_Management is
Keep_Unmasked (Exception_Interrupts (I)) := True;
Result :=
sigaction
- (Signal (Exception_Interrupts (I)), act'Access,
+ (Signal (Exception_Interrupts (I)), act'Unchecked_Access,
old_act'Unchecked_Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---sigaction"));
+ pragma Assert (Result = 0);
end loop;
- Keep_Unmasked (Abort_Task_Interrupt) := true;
--- Keep_Unmasked (SIGBUS) := true;
+ Keep_Unmasked (Abort_Task_Interrupt) := True;
+ Keep_Unmasked (SIGSTOP) := True;
+ Keep_Unmasked (SIGKILL) := True;
- Keep_Unmasked (SIGSTOP) := true;
- Keep_Unmasked (SIGKILL) := true;
- Keep_Unmasked (SIGINT) := true;
+ -- By keeping SIGINT unmasked, allow the user to do a Ctrl-C, but in the
+ -- same time, disable the ability of handling this signal
+ -- via Ada.Interrupts.
+ -- The pragma Unreserve_All_Interrupts let the user the ability to
+ -- change this behavior.
- -- Keep_Unmasked (SIGEMT) := true;
- -- Keep_Unmasked (SIGCHLD) := true;
- -- Keep_Unmasked (SIGALRM) := true;
- -- ???? The above signals have been found to need to be
- -- kept unmasked on some systems, per Dong-Ik Oh.
- -- I don't know whether the MIT/Provenzano threads
- -- need these or any other signals unmasked at the thread level.
- -- I hope somebody will take
- -- the time to look it up. -- Ted Baker
+ if Unreserve_All_Interrupts = 0 then
+ Keep_Unmasked (SIGINT) := True;
+ else
+ Keep_Unmasked (SIGINT) := False;
+ end if;
-- FreeBSD uses SIGINFO to dump thread status to stdout. If
-- the user really wants to attach his own handler, let him.
@@ -216,9 +217,9 @@ package body System.Interrupt_Management is
-- in order to handle the setitimer/getitimer operations. We
-- could probably allow SIGALARM, but we'll leave it as unmasked
-- for now. FreeBSD pthreads also needs SIGCHLD.
- Keep_Unmasked (SIGCHLD) := true;
- Keep_Unmasked (SIGALRM) := true;
- Keep_Unmasked (SIGVTALRM) := true;
+ Keep_Unmasked (SIGCHLD) := True;
+ Keep_Unmasked (SIGALRM) := True;
+ Keep_Unmasked (SIGVTALRM) := True;
Reserve := Reserve or Keep_Unmasked or Keep_Masked;
diff --git a/lang/gnat/files/5fosinte.adb b/lang/gnat/files/5fosinte.adb
index 12febc4d3ddc..e449cf5bf733 100644
--- a/lang/gnat/files/5fosinte.adb
+++ b/lang/gnat/files/5fosinte.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (Version for new GNARL) --
-- --
--- $Revision: 1.1 $ --
+-- $Revision: 1.2 $ --
-- --
-- Copyright (C) 1991,1992,1993,1994,1995,1996 Florida State University --
-- --
@@ -39,7 +39,7 @@
-- This is only a first approximation.
-- It should be autogenerated by the m4 macro processor.
--- Contributed by Daniel M. Eischen (deischen@iworks.InterWorks.org)
+-- Contributed by Daniel M. Eischen (eischen@vigrid.com)
-- DO NOT EDIT this file.
-- It was automatically generated from another file by the m4 macro processor.
@@ -56,10 +56,10 @@
-- __HAS_SIGCONTEXT = 1
-- __HAS_UCONTEXT = 0
-- __THREADS = POSIX_THREADS
--- __THREAD_VARIANT = ??
+-- __THREAD_VARIANT = MIT-THREADS
-- __HAS_TIMESPEC = 1
-- __HAS_NANOSLEEP = 1
--- __HAS_CLOCK_GETTIME = 0
+-- __HAS_CLOCK_GETTIME = 1
-- __HAS_GETTIMEOFDAY = 1
-- __POSIX_THREAD_PRIO_PROTECT = 0
-- __POSIX_THREAD_PRIO_INHERIT = 0
@@ -86,8 +86,61 @@ package body System.OS_Interface is
return (internal_errno.all);
end Errno;
+ function Get_Stack_Base (thread : pthread_t) return Address is
+ begin
+ return (0);
+ end Get_Stack_Base;
+
+ function pthread_getschedparam
+ (thread : pthread_t;
+ policy : access int;
+ param : access struct_sched_param) return int is
- type sigset_t_ptr is access all sigset_t;
+ function pthread_getprio (thread : pthread_t) return int;
+ pragma Import (C, pthread_getprio, "pthread_getprio");
+
+ Result : int;
+ begin
+ Result := pthread_getprio (thread);
+ if Result >= 0 then
+ -- Only set sched_param if we succeeded. Also ensure
+ -- we return a successful status to the caller.
+ param.sched_priority := Result;
+ Result := 0;
+ end if;
+ return (Result);
+ end pthread_getschedparam;
+
+ function pthread_setschedparam
+ (thread : pthread_t;
+ policy : int;
+ param : access struct_sched_param) return int is
+
+ function pthread_setprio (thread : pthread_t; prio : int) return int;
+ pragma Import (C, pthread_setprio, "pthread_setprio");
+
+ begin
+ return (pthread_setprio (thread, param.sched_priority));
+ end pthread_setschedparam;
+
+ function pthread_attr_setschedpolicy
+ (attr : access pthread_attr_t;
+ policy : int) return int is
+ begin
+ return (0);
+ end pthread_attr_setschedpolicy;
+
+ function pthread_attr_getschedpolicy
+ (attr : access pthread_attr_t;
+ policy : access int) return int is
+ begin
+ return (0);
+ end pthread_attr_getschedpolicy;
+
+ procedure pthread_init is
+ begin
+ null;
+ end pthread_init;
function pthread_sigmask_set
(how : int;
@@ -166,16 +219,4 @@ package body System.OS_Interface is
tv_usec => long (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
- -- FreeBSD Pthreads has pthread_yield and it is imported as
- -- sched_yield in 5fosinte.ads. The FreeBSD pthread_yield does
- -- not have any parameters, so the import may be used directly
- -- without the need for a wrapper as shown below.
--- function sched_yield return int is
--- procedure sched_yield_base (arg : System.Address);
--- pragma Import (C, sched_yield_base, "pthread_yield");
--- begin
--- sched_yield_base (System.Null_Address);
--- return 0;
--- end sched_yield;
-
end System.OS_Interface;
diff --git a/lang/gnat/files/5fosinte.ads b/lang/gnat/files/5fosinte.ads
index b8ecbec463d3..63d773ae554b 100644
--- a/lang/gnat/files/5fosinte.ads
+++ b/lang/gnat/files/5fosinte.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Version for new GNARL) --
-- --
--- $Revision: 1.1 $ --
+-- $Revision: 1.5 $ --
-- --
-- Copyright (C) 1991,92,93,94,95,1996 Free Software Foundation, Inc. --
-- --
@@ -39,7 +39,7 @@
-- This is only a first approximation.
-- It should be autogenerated by the m4 macro processor.
--- Contributed by Daniel Eischen (deischen@iworks.InterWorks.org)
+-- Contributed by Daniel Eischen (eischen@vigrid.com)
-- DO NOT EDIT this file.
-- It was automatically generated from another file by the m4 macro processor.
@@ -87,7 +87,7 @@ with Interfaces.C;
package System.OS_Interface is
pragma Preelaborate;
- pragma Linker_Options ("-lc_r");
+ pragma Linker_Options ("-pthread");
subtype int is Interfaces.C.int;
subtype short is Interfaces.C.short;
@@ -250,7 +250,7 @@ package System.OS_Interface is
function sigaction
(sig : Signal;
- act : access struct_sigaction;
+ act : struct_sigaction_ptr;
oact : struct_sigaction_ptr)
return int;
pragma Import (C, sigaction, "sigaction");
@@ -259,6 +259,9 @@ package System.OS_Interface is
-- Time --
----------
+ Time_Slice_Supported : constant boolean := True;
+ -- Indicates wether time slicing is supported (i.e SCHED_RR is supported)
+
type timespec is private;
function nanosleep (rqtp, rmtp : access timespec) return int;
@@ -297,7 +300,7 @@ package System.OS_Interface is
function gettimeofday
(tv : access struct_timeval;
- tz : access struct_timezone) return int;
+ tz : System.Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
procedure usleep (useconds : unsigned_long);
@@ -309,13 +312,13 @@ package System.OS_Interface is
-- Priority Scheduling --
-------------------------
- MIN_PRIO : constant := 0;
- MAX_PRIO : constant := 126;
+ MIN_PRIO : constant := 0;
+ MAX_PRIO : constant := 126;
+ DEFAULT_PRIO : constant := 64;
- SCHED_RR : constant := 0;
- SCHED_IO : constant := 1;
- SCHED_FIFO : constant := 2;
- SCHED_OTHER : constant := 3;
+ SCHED_FIFO : constant := 1;
+ SCHED_OTHER : constant := 2;
+ SCHED_RR : constant := 3;
-------------
-- Process --
@@ -323,6 +326,8 @@ package System.OS_Interface is
type pid_t is private;
+ Self_PID : constant pid_t;
+
function kill
(pid : pid_t;
sig : Signal)
@@ -351,10 +356,55 @@ package System.OS_Interface is
PTHREAD_CREATE_DETACHED : constant := 1;
PTHREAD_CREATE_JOINABLE : constant := 0;
+ -----------
+ -- Stack --
+ -----------
+
+ Stack_Base_Available : constant boolean := False;
+ -- Indicates wether 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, or 0 if this is not relevant on this
+ -- target
+
+ 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 --
---------------------------
+ type sigset_t_ptr is access all sigset_t;
+
function sigwait
(set : access sigset_t;
sig : access Signal)
@@ -369,8 +419,8 @@ package System.OS_Interface is
function pthread_sigmask
(how : int;
- set : access sigset_t;
- oset : access sigset_t)
+ set : sigset_t_ptr;
+ oset : sigset_t_ptr)
return int;
pragma Import (C, pthread_sigmask, "pthread_sigmask");
@@ -472,44 +522,44 @@ package System.OS_Interface is
----------------------------
-- FreeBSD pthreads does not support these yet.
--- PTHREAD_PRIO_NONE : constant := 0;
--- PTHREAD_PRIO_PROTECT : constant := 2;
--- PTHREAD_PRIO_INHERIT : constant := 1;
+ --
+ -- PTHREAD_PRIO_NONE : constant := 0;
+ -- PTHREAD_PRIO_PROTECT : constant := 2;
+ -- PTHREAD_PRIO_INHERIT : constant := 1;
-- FreeBSD doesn't have pthread_getschedparam or pthread_setschedparam
- -- yet. It has pthread_getprio and pthread_setprio, so we use these
- -- instead.
-
--- type struct_sched_param is record
--- prio : int;
--- no_data : System.Address;
--- 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");
+ -- yet, but we provide the compliant interface and implement them with
+ -- pthread_getprio and pthread_setprio instead.
+
+ type struct_sched_param is record
+ sched_priority : int;
+ end record;
+ pragma Convention (C, struct_sched_param);
+
+ function sched_getparam
+ (pid : pid_t;
+ param : access struct_sched_param)
+ return int;
+ pragma Import (C, sched_getparam, "sched_getparam");
+
+ function sched_setscheduler
+ (pid : pid_t;
+ policy : int;
+ param : access struct_sched_param)
+ return int;
+ pragma Import (C, sched_setscheduler, "sched_setscheduler");
function pthread_getschedparam
- (thread : pthread_t)
+ (thread : pthread_t;
+ policy : access int;
+ param : access struct_sched_param)
return int;
- pragma Import (C, pthread_getschedparam, "pthread_getprio");
function pthread_setschedparam
- (thread : pthread_t;
- priority : int)
+ (thread : pthread_t;
+ policy : int;
+ param : access struct_sched_param)
return int;
- pragma Import (C, pthread_setschedparam, "pthread_setprio");
function pthread_attr_setscope
(attr : access pthread_attr_t;
@@ -541,45 +591,29 @@ package System.OS_Interface is
(attr : access pthread_attr_t;
policy : int)
return int;
- pragma Import
- (C, pthread_attr_setschedpolicy,
- "pthread_attr_setschedpolicy");
+-- 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");
+-- pragma Import (C, pthread_attr_getschedpolicy,
+-- "pthread_attr_getschedpolicy");
-- FreeBSD doesn't have pthread_attr_setschedparm and
- -- pthread_attr_getschedparm yet. It has pthread_attr_setprio and
- -- pthread_attr_getprio instead. It seems we don't need either one
- -- of these, though.
+ -- pthread_attr_getschedparm yet.
-- function pthread_attr_setschedparam
--- (attr : access pthread_attr_t;
--- sched_param : access struct_sched_param)
+-- (attr : access pthread_attr_t;
+-- param : access struct_sched_param)
-- return int;
--- pragma Import (C, pthread_attr_setschedparam,
--- "pthread_attr_setschedparam");
--
-- function pthread_attr_getschedparam
--- (attr : access pthread_attr_t;
--- sched_param : access struct_sched_param)
+-- (attr : access pthread_attr_t;
+-- param : access struct_sched_param)
-- return int;
--- pragma Import (C, pthread_attr_getschedparam,
--- "pthread_attr_getschedparam");
- function pthread_attr_setschedparam
- (attr : access pthread_attr_t;
- priority : int)
- return int;
- pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setprio");
-
- function pthread_attr_getschedparam
- (attr : access pthread_attr_t)
- return int;
- pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getprio");
function sched_yield return int;
pragma Import (C, sched_yield, "pthread_yield");
@@ -598,8 +632,6 @@ package System.OS_Interface is
return int;
pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
-
-
function pthread_attr_setdetachstate
(attr : access pthread_attr_t;
detachstate : int)
@@ -673,6 +705,16 @@ package System.OS_Interface is
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
@@ -692,6 +734,7 @@ private
-- #define sa_sigaction __funcptr._sigaction
type pid_t is new int;
+ Self_PID : constant pid_t := 0;
type time_t is new long;
@@ -710,66 +753,15 @@ private
end record;
pragma Convention (C, struct_timeval);
+ type record_type_1 is null record;
+ pragma Convention (C, record_type_1);
- type enumeral_type_3 is new int;
- type pthread_attr_t is record
- schedparam_policy : enumeral_type_3;
- prio : int;
- suspend : int;
- flags : int;
- arg_attr : System.Address;
- cleanup_attr : System.Address;
- stackaddr_attr : System.Address;
- stacksize_attr : size_t;
- end record;
- pragma Convention (C, pthread_attr_t);
-
- type enumeral_type_2 is new int;
- type pthread_condattr_t is record
- c_type : enumeral_type_2;
- c_flags : long;
- end record;
- pragma Convention (C, pthread_condattr_t);
-
- type enumeral_type_1 is new int;
- type pthread_mutexattr_t is record
- m_type : enumeral_type_1;
- m_flags : long;
- end record;
- pragma Convention (C, pthread_mutexattr_t);
-
- type record_type_3 is null record;
- pragma Convention (C, record_type_3);
- type pthread_t is access record_type_3;
-
- type enumeral_type_4 is new int;
- type pthread_queue_t is record
- q_next : System.Address;
- q_last : System.Address;
- q_data : System.Address;
- end record;
- pragma Convention (C, pthread_queue_t);
- type union_type_1 is new int;
- type pthread_mutex_t is record
- m_type : enumeral_type_4;
- m_queue : pthread_queue_t;
- m_owner : System.Address;
--- m_lock : long;
- m_data : union_type_1;
- m_flags : long;
- end record;
- pragma Convention (C, pthread_mutex_t);
-
- type enumeral_type_5 is new int;
- type pthread_cond_t is record
- c_type : enumeral_type_5;
- c_queue : pthread_queue_t;
--- c_lock : long;
- c_data : System.Address;
- c_flags : long;
- end record;
- pragma Convention (C, pthread_cond_t);
-
- type pthread_key_t is new int;
+ type pthread_t is access record_type_1;
+ type pthread_attr_t is access record_type_1;
+ type pthread_mutex_t is access record_type_1;
+ type pthread_mutexattr_t is access record_type_1;
+ type pthread_cond_t is access record_type_1;
+ type pthread_condattr_t is access record_type_1;
+ type pthread_key_t is new int;
end System.OS_Interface;
diff --git a/lang/gnat/files/5ftaprop.adb b/lang/gnat/files/5ftaprop.adb
index 813c40530c4a..3c94fc5dc6bb 100644
--- a/lang/gnat/files/5ftaprop.adb
+++ b/lang/gnat/files/5ftaprop.adb
@@ -1,15 +1,14 @@
------------------------------------------------------------------------------
-- --
--- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS --
+-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S --
-- --
-- B o d y --
--- (Version for new GNARL) --
-- --
--- $Revision: 1.1 $ --
+-- $Revision: 1.5 $ --
-- --
--- Copyright (C) 1991,1992,1993,1994,1995,1996 Florida State University --
+-- Copyright (C) 1997, 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- --
@@ -36,15 +35,19 @@
------------------------------------------------------------------------------
-- This is the FreeBSD PTHREADS version of this package. Contributed
--- by Daniel M. Eischen (deischen@iworks.InterWorks.org).
+-- by Daniel M. Eischen (eischen@vigrid.com).
+
+pragma Polling (Off);
+-- Turn off polling, we do not want ATC polling to take place during
+-- tasking operations. It causes infinite loops and other problems.
+
+with System.Tasking.Debug;
+-- used for Known_Tasks
with Interfaces.C;
-- used for int
-- size_t
-with System.Error_Reporting;
--- used for Shutdown
-
with System.Interrupt_Management;
-- used for Keep_Unmasked
-- Abort_Task_Interrupt
@@ -65,18 +68,28 @@ with System.Tasking;
-- used for Ada_Task_Control_Block
-- Task_ID
+with System.Tasking.Initialization;
+-- used for Defer/Undefer_Abort
+
+with System.Task_Info;
+-- used for Task_Image_Type
+
+with System.OS_Primitives;
+-- used for Delay_Modes
+
with Unchecked_Conversion;
with Unchecked_Deallocation;
package body System.Task_Primitives.Operations is
+ use System.Tasking.Debug;
use System.Tasking;
use Interfaces.C;
- use System.Error_Reporting;
use System.OS_Interface;
use System.Parameters;
+ use System.OS_Primitives;
- pragma Linker_Options ("-lc_r");
+ pragma Linker_Options ("-pthread");
------------------
-- Local Data --
@@ -85,12 +98,23 @@ package body System.Task_Primitives.Operations is
-- The followings are logically constants, but need to be initialized
-- at run time.
- ATCB_Key : aliased pthread_key_t;
- -- Key used to find the Ada Task_ID associated with a thread
+ All_Tasks_L : aliased System.Task_Primitives.RTS_Lock;
+ -- See comments on locking rules in System.Locking_Rules (spec).
+
+ Environment_Task_ID : Task_ID;
+ -- A variable to hold Task_ID for the environment task.
Unblocked_Signal_Mask : aliased sigset_t;
-- The set of signals that should unblocked in all tasks
+ Next_Serial_Number : Task_Serial_Number := 100;
+ -- We start at 100, to reserve some special values for
+ -- using in error checking.
+
+ Time_Slice_Val : Integer;
+ pragma Import (C, Time_Slice_Val, "__gl_time_slice_val");
+
+
-----------------------
-- Local Subprograms --
-----------------------
@@ -104,6 +128,30 @@ package body System.Task_Primitives.Operations is
function To_Address is new Unchecked_Conversion (Task_ID, System.Address);
+
+ --------------------
+ -- Local Packages --
+ --------------------
+
+ package Specific is
+
+ procedure Initialize (Environment_Task : Task_ID);
+ pragma Inline (Initialize);
+ -- Initialize various data needed by this package.
+
+ procedure Set (Self_Id : Task_ID);
+ pragma Inline (Set);
+ -- Set the self id for the current task.
+
+ function Self return Task_ID;
+ pragma Inline (Self);
+ -- Return a pointer to the Ada Task Control Block of the calling task.
+
+ end Specific;
+
+ package body Specific is separate;
+ -- The body of this package is target specific.
+
-------------------
-- Abort_Handler --
-------------------
@@ -113,7 +161,7 @@ package body System.Task_Primitives.Operations is
-- The technical issues and alternatives here are essentially
-- the same as for raising exceptions in response to other
- -- signals (e.g. Storage_Error). See code and comments in
+ -- signals (e.g. Storage_Error). See code and comments in
-- the package body System.Interrupt_Management.
-- Some implementations may not allow an exception to be propagated
@@ -124,7 +172,7 @@ package body System.Task_Primitives.Operations is
-- GNAT exceptions are originally implemented using setjmp()/longjmp().
-- On most UNIX systems, this will allow transfer out of a signal handler,
-- which is usually the only mechanism available for implementing
- -- asynchronous handlers of this kind. However, some
+ -- asynchronous handlers of this kind. However, some
-- systems do not restore the signal mask on longjmp(), leaving the
-- abort signal masked.
@@ -135,12 +183,15 @@ package body System.Task_Primitives.Operations is
-- Normal return from this handler will then raise
-- the exception after the mask and other system state has
-- been restored (see example below).
+
-- 2. Use siglongjmp()/sigsetjmp() to implement exceptions.
+
-- 3. Unmask the signal in the Abortion_Signal exception handler
-- (in the RTS).
-- The following procedure would be needed if we can't lonjmp out of
- -- a signal handler. (See below.)
+ -- a signal handler (See below)
+
-- procedure Raise_Abort_Signal is
-- begin
-- raise Standard'Abort_Signal;
@@ -151,7 +202,7 @@ package body System.Task_Primitives.Operations is
code : Interfaces.C.int;
context : access struct_sigcontext) is
- T : Task_ID := Self;
+ T : Task_ID := Self;
Result : Interfaces.C.int;
Old_Set : aliased sigset_t;
@@ -160,14 +211,17 @@ package body System.Task_Primitives.Operations is
-- following code can be used:
if T.Deferral_Level = 0
- and then T.Pending_ATC_Level < T.ATC_Nesting_Level then
+ and then T.Pending_ATC_Level < T.ATC_Nesting_Level and then
+ not T.Aborting
+ then
+ T.Aborting := True;
-- Make sure signals used for RTS internal purpose are unmasked
- Result := pthread_sigmask
- (SIG_UNBLOCK, Unblocked_Signal_Mask'Access, Old_Set'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Enter_Task (pthread_sigmask)"));
+ Result := pthread_sigmask (SIG_UNBLOCK,
+ Unblocked_Signal_Mask'Unchecked_Access, Old_Set'Unchecked_Access);
+ pragma Assert (Result = 0);
+
raise Standard'Abort_Signal;
end if;
@@ -182,19 +236,39 @@ package body System.Task_Primitives.Operations is
end Abort_Handler;
+ -------------------
+ -- Stack_Guard --
+ -------------------
+
+ procedure Stack_Guard (T : ST.Task_ID; On : Boolean) is
+
+ Stack_Base : constant Address := Get_Stack_Base (T.LL.Thread);
+ Guard_Page_Address : Address;
+
+ Res : Interfaces.C.int;
+
+ begin
+ if Stack_Base_Available then
+ -- Compute the guard page address
+
+ Guard_Page_Address :=
+ Stack_Base - (Stack_Base mod Get_Page_Size) + Get_Page_Size;
+
+ if On then
+ Res := mprotect (Guard_Page_Address, Get_Page_Size, PROT_ON);
+ else
+ Res := mprotect (Guard_Page_Address, Get_Page_Size, PROT_OFF);
+ end if;
+
+ pragma Assert (Res = 0);
+ end if;
+ end Stack_Guard;
+
----------
-- Self --
----------
- function Self return Task_ID is
- Result : System.Address;
-
- begin
- Result := pthread_getspecific (ATCB_Key);
- pragma Assert (Result /= System.Null_Address
- or else Shutdown ("GNULLI failure---pthread_getspecific"));
- return To_Task_ID (Result);
- end Self;
+ function Self return Task_ID renames Specific.Self;
---------------------
-- Initialize_Lock --
@@ -215,8 +289,7 @@ package body System.Task_Primitives.Operations is
Result : Interfaces.C.int;
begin
Result := pthread_mutexattr_init (Attributes'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_mutexattr_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
raise STORAGE_ERROR;
@@ -224,23 +297,23 @@ package body System.Task_Primitives.Operations is
Result := pthread_mutex_init (L, Attributes'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_mutex_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
raise STORAGE_ERROR;
end if;
+ Result := pthread_mutexattr_destroy (Attributes'Access);
+ pragma Assert (Result = 0);
end Initialize_Lock;
- procedure Initialize_Lock (L : access RTS_Lock) is
+ procedure Initialize_Lock (L : access RTS_Lock; Level : Lock_Level) is
Attributes : aliased pthread_mutexattr_t;
Result : Interfaces.C.int;
begin
Result := pthread_mutexattr_init (Attributes'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_mutexattr_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
raise STORAGE_ERROR;
@@ -248,13 +321,14 @@ package body System.Task_Primitives.Operations is
Result := pthread_mutex_init (L, Attributes'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_mutex_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
raise STORAGE_ERROR;
end if;
+ Result := pthread_mutexattr_destroy (Attributes'Access);
+ pragma Assert (Result = 0);
end Initialize_Lock;
-------------------
@@ -266,8 +340,7 @@ package body System.Task_Primitives.Operations is
begin
Result := pthread_mutex_destroy (L);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_destroy"));
+ pragma Assert (Result = 0);
end Finalize_Lock;
procedure Finalize_Lock (L : access RTS_Lock) is
@@ -275,8 +348,7 @@ package body System.Task_Primitives.Operations is
begin
Result := pthread_mutex_destroy (L);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_destroy"));
+ pragma Assert (Result = 0);
end Finalize_Lock;
----------------
@@ -288,14 +360,11 @@ package body System.Task_Primitives.Operations is
begin
Result := pthread_mutex_lock (L);
- if Result = 0 then
- Ceiling_Violation := False;
- else
- Ceiling_Violation := Result = EINVAL;
- end if;
- -- assumes the cause of EINVAL is a priority ceiling violation
- pragma Assert (Result = 0 or else Result = EINVAL
- or else Shutdown ("GNULLI failure---pthread_mutex_lock"));
+
+ -- Assume that the cause of EINVAL is a priority ceiling violation
+
+ Ceiling_Violation := (Result = EINVAL);
+ pragma Assert (Result = 0 or else Result = EINVAL);
end Write_Lock;
procedure Write_Lock (L : access RTS_Lock) is
@@ -303,17 +372,14 @@ package body System.Task_Primitives.Operations is
begin
Result := pthread_mutex_lock (L);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_lock"));
+ pragma Assert (Result = 0);
end Write_Lock;
procedure Write_Lock (T : Task_ID) is
- Result : Interfaces.C.int;
-
+ Result : Interfaces.C.int;
begin
Result := pthread_mutex_lock (T.LL.L'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_lock"));
+ pragma Assert (Result = 0);
end Write_Lock;
---------------
@@ -334,8 +400,7 @@ package body System.Task_Primitives.Operations is
begin
Result := pthread_mutex_unlock (L);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_unlock"));
+ pragma Assert (Result = 0);
end Unlock;
procedure Unlock (L : access RTS_Lock) is
@@ -343,158 +408,180 @@ package body System.Task_Primitives.Operations is
begin
Result := pthread_mutex_unlock (L);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_unlock"));
+ pragma Assert (Result = 0);
end Unlock;
procedure Unlock (T : Task_ID) is
- Result : Interfaces.C.int;
-
+ Result : Interfaces.C.int;
begin
Result := pthread_mutex_unlock (T.LL.L'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_unlock"));
+ pragma Assert (Result = 0);
end Unlock;
-------------
-- Sleep --
-------------
- procedure Sleep (Self_ID : Task_ID) is
+ procedure Sleep (Self_ID : Task_ID;
+ Reason : System.Tasking.Task_States) is
+
Result : Interfaces.C.int;
begin
- pragma Assert (Self_ID = Self
- or else Shutdown ("GNULLI failure---Self in Sleep"));
+ pragma Assert (Self_ID = Self);
Result := pthread_cond_wait (Self_ID.LL.CV'Access, Self_ID.LL.L'Access);
+
-- EINTR is not considered a failure.
- pragma Assert (Result = 0 or else Result = EINTR
- or else Shutdown ("GNULLI failure---Sleep"));
+
+ pragma Assert (Result = 0 or else Result = EINTR);
+
end Sleep;
- ---------------
- -- Sleep_For --
- ---------------
+ -----------------
+ -- Timed_Sleep --
+ -----------------
- procedure Sleep_For
+ -- This is for use within the run-time system, so abort is
+ -- assumed to be already deferred, and the caller should be
+ -- holding its own ATCB lock.
+
+ procedure Timed_Sleep
(Self_ID : Task_ID;
- Rel_Time : Duration;
- Timedout : out Boolean)
+ Time : Duration;
+ Mode : ST.Delay_Modes;
+ Reason : System.Tasking.Task_States;
+ Timedout : out Boolean;
+ Yielded : out Boolean)
is
+
+ Check_Time : constant Duration := Clock;
+ Abs_Time : Duration;
+ Request : aliased timespec;
+ Result : Interfaces.C.int;
+
begin
- Sleep_Until (Self_ID, Rel_Time + Clock, Timedout);
- end Sleep_For;
+ Timedout := True;
+ Yielded := False;
+
+ if Mode = Relative then
+ Abs_Time := Time + Check_Time;
+ else
+ Abs_Time := Time;
+ end if;
+
+ if Abs_Time > Check_Time then
+ Request := To_Timespec (Abs_Time);
+ loop
+ exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level
+ or else Self_ID.Pending_Priority_Change;
+
+ Result := pthread_cond_timedwait
+ (Self_ID.LL.CV'Access, Self_ID.LL.L'Access, Request'Access);
+
+ exit when Abs_Time <= Clock;
+
+ if Result = 0 or Result = EINTR then
+
+ -- Somebody may have called Wakeup for us
+
+ Timedout := False;
+ exit;
+ end if;
+
+ pragma Assert (Result = ETIMEDOUT);
+ end loop;
+ end if;
+ end Timed_Sleep;
-----------------
- -- Sleep_Until --
+ -- Timed_Delay --
-----------------
- procedure Sleep_Until
+ -- This is for use in implementing delay statements, so
+ -- we assume the caller is abort-deferred but is holding
+ -- no locks.
+
+ procedure Timed_Delay
(Self_ID : Task_ID;
- Abs_Time : Duration;
- Timedout : out Boolean)
+ Time : Duration;
+ Mode : ST.Delay_Modes)
is
- Request : aliased timespec;
- Result : Interfaces.C.int;
+ Check_Time : constant Duration := Clock;
+ Abs_Time : Duration;
+ Request : aliased timespec;
+ Result : Interfaces.C.int;
begin
- pragma Assert (Self_ID = Self
- or else Shutdown ("GNULLI failure---Self in Sleep_Until"));
- if Abs_Time <= Clock then
- Timedout := True;
- Result := sched_yield;
- return;
- end if;
+ -- Only the little window between deferring abort and
+ -- locking Self_ID is the reason we need to
+ -- check for pending abort and priority change below! :(
- Request := To_Timespec (Abs_Time);
+ Initialization.Defer_Abort_Nestable (Self_ID);
+ Write_Lock (Self_ID);
- -- We loop until the requested delay is serviced. For early wakeups,
- -- we check the Clock again and re-request delays until we sleep
- -- at least for the specified amount.
+ if Mode = Relative then
+ Abs_Time := Time + Check_Time;
+ else
+ Abs_Time := Time;
+ end if;
- loop
- -- Perform delays until one of the following conditions is true:
- -- 1) cond_timedwait wakes up due to time expiration.
- -- 2) We were interrupted by an abort signal (abortion is pending).
- -- 3) We received a wakeup, via cond_signal to our CV.
- -- 4) An error has occurred in the OS-provided delay primitive.
- -- Conditions (1), (2), and (3) are normal.
- -- Condition (4) should never happen unless the OS is broken,
- -- or there is an error in our own runtime system code.
+ if Abs_Time > Check_Time then
+ Request := To_Timespec (Abs_Time);
+ Self_ID.State := Delay_Sleep;
loop
- Result := pthread_cond_timedwait
- (Self_ID.LL.CV'Access, Self_ID.LL.L'Access, Request'Access);
-
- if Result = 0 or else
- (Self_ID.Pending_Action and then
- Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level)
- then
- Timedout := False;
- return;
- else
- -- As of 11/25/97, FreeBSD-3.0 returns the correct
- -- (POSIX specified) code (ETIMEDOUT) for a timed-out
- -- operation. Previous versions of FreeBSD would
- -- return -1, and set the thread-safe errno to EAGAIN.
- if Result < 0 and then Errno = EAGAIN then
- Result := ETIMEDOUT;
- end if;
+ if Self_ID.Pending_Priority_Change then
+ Self_ID.Pending_Priority_Change := False;
+ Self_ID.Base_Priority := Self_ID.New_Base_Priority;
+ Set_Priority (Self_ID, Self_ID.Base_Priority);
end if;
- if Result = ETIMEDOUT then
- exit;
- end if;
+ exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
- pragma Assert (Result /= EINVAL or else
- Shutdown ("GNULLI failure---Sleep_Until (cond_timedwait)"));
+ Result := pthread_cond_timedwait
+ (Self_ID.LL.CV'Access, Self_ID.LL.L'Access, Request'Access);
+ exit when Abs_Time <= Clock;
+
+ pragma Assert (Result = 0
+ or else Result = ETIMEDOUT
+ or else Result = EINTR);
end loop;
- -- Make sure we delayed long enough. If we did, give up the
- -- CPU. Otherwise, request a delay again with unserviced amount
- -- of time.
+ Self_ID.State := Runnable;
+ end if;
- if (Abs_Time <= Clock) then
- Timedout := True;
- Result := sched_yield;
- exit;
- else
- Request := To_Timespec (Abs_Time);
- end if;
- end loop;
- end Sleep_Until;
+ Unlock (Self_ID);
+ Result := sched_yield;
+ Initialization.Undefer_Abort_Nestable (Self_ID);
+ end Timed_Delay;
-----------
-- Clock --
-----------
function Clock return Duration is
- TS : aliased timespec;
+ TV : aliased struct_timeval;
Result : Interfaces.C.int;
begin
- Result := clock_gettime (CLOCK_REALTIME, TS'Unchecked_Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---clock_gettime"));
- return To_Duration (TS);
- exception
- when others =>
- pragma Assert (Shutdown ("exception in Clock"));
- return 0.0;
+ -- We should use clock_gettime() for FreeBSD 3.x; FreeBSD 2.x
+ -- doesn't have clock_gettime.
+ Result := gettimeofday (TV'Unchecked_Access, System.Null_Address);
+ pragma Assert (Result = 0);
+ return To_Duration (TV);
end Clock;
------------
-- Wakeup --
------------
- procedure Wakeup (T : Task_ID) is
+ procedure Wakeup (T : Task_ID; Reason : System.Tasking.Task_States) is
Result : Interfaces.C.int;
begin
Result := pthread_cond_signal (T.LL.CV'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Wakeup"));
+ pragma Assert (Result = 0);
end Wakeup;
-----------
@@ -503,6 +590,7 @@ package body System.Task_Primitives.Operations is
procedure Yield is
Result : Interfaces.C.int;
+
begin
Result := sched_yield;
end Yield;
@@ -511,31 +599,27 @@ package body System.Task_Primitives.Operations is
-- Set_Priority --
------------------
- -- FreeBSD doesn't have the correct pthread_setschedparam routine
- -- yet. Instead, pthread_setschedparam is imported from pthread_setprio
- -- which only takes a pthread_t and integer as arguments.
--- procedure Set_Priority (T : Task_ID; Prio : System.Any_Priority) is
--- Result : Interfaces.C.int;
--- Param : aliased struct_sched_param;
--- begin
--- T.LL.Current_Priority := Interfaces.C.int (Prio);
--- Param.prio := Interfaces.C.int (Prio);
---
--- Result := pthread_setschedparam (T.LL.Thread, SCHED_FIFO,
--- Param'Access);
--- pragma Assert (Result = 0
--- or else Shutdown ("GNULLI failure---Set_Priority"));
---
--- end Set_Priority;
procedure Set_Priority (T : Task_ID; Prio : System.Any_Priority) is
Result : Interfaces.C.int;
+ Param : aliased struct_sched_param;
+
begin
T.LL.Current_Priority := Interfaces.C.int (Prio);
- Result := pthread_setschedparam (T.LL.Thread, Interfaces.C.int (Prio));
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Set_Priority"));
+ -- Convert the Ada priority to be based around the default
+ -- system priority.
+ Param.sched_priority := DEFAULT_PRIO + Interfaces.C.int (Prio) -
+ Interfaces.C.int (System.Default_Priority);
+
+ if Time_Slice_Supported and then Time_Slice_Val > 0 then
+ Result := pthread_setschedparam
+ (T.LL.Thread, SCHED_RR, Param'Access);
+ else
+ Result := pthread_setschedparam
+ (T.LL.Thread, SCHED_FIFO, Param'Access);
+ end if;
+ pragma Assert (Result = 0);
end Set_Priority;
------------------
@@ -552,15 +636,22 @@ package body System.Task_Primitives.Operations is
----------------
procedure Enter_Task (Self_ID : Task_ID) is
- Result : Interfaces.C.int;
-
begin
-
Self_ID.LL.Thread := pthread_self;
- Result := pthread_setspecific (ATCB_Key, To_Address (Self_ID));
- pragma Assert (Result = 0 or else
- Shutdown ("GNULLI failure---Enter_Task (pthread_setspecific)"));
+ Specific.Set (Self_ID);
+
+ Lock_All_Tasks_List;
+
+ for I in Known_Tasks'Range loop
+ if Known_Tasks (I) = null then
+ Known_Tasks (I) := Self_ID;
+ Self_ID.Known_Tasks_Index := I;
+ exit;
+ end if;
+ end loop;
+
+ Unlock_All_Tasks_List;
end Enter_Task;
----------------------
@@ -573,9 +664,14 @@ package body System.Task_Primitives.Operations is
Cond_Attr : aliased pthread_condattr_t;
begin
+ -- Give the task a unique serial number.
+
+ Self_ID.Serial_Number := Next_Serial_Number;
+ Next_Serial_Number := Next_Serial_Number + 1;
+ pragma Assert (Next_Serial_Number /= 0);
+
Result := pthread_mutexattr_init (Mutex_Attr'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_mutexattr_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Succeeded := False;
@@ -583,8 +679,7 @@ package body System.Task_Primitives.Operations is
end if;
Result := pthread_mutex_init (Self_ID.LL.L'Access, Mutex_Attr'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_mutex_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Succeeded := False;
@@ -592,29 +687,30 @@ package body System.Task_Primitives.Operations is
end if;
Result := pthread_condattr_init (Cond_Attr'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_condattr_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Result := pthread_mutex_destroy (Self_ID.LL.L'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_destory"));
+ pragma Assert (Result = 0);
Succeeded := False;
return;
end if;
Result := pthread_cond_init (Self_ID.LL.CV'Access, Cond_Attr'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_cond_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Result := pthread_mutex_destroy (Self_ID.LL.L'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_mutex_destory"));
+ pragma Assert (Result = 0);
+ Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
+ pragma Assert (Result = 0);
Succeeded := False;
return;
end if;
+ Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
+ pragma Assert (Result = 0);
+
Succeeded := True;
end Initialize_TCB;
@@ -630,6 +726,8 @@ package body System.Task_Primitives.Operations is
Priority : System.Any_Priority;
Succeeded : out Boolean)
is
+ use type System.Task_Info.Task_Image_Type;
+
Attributes : aliased pthread_attr_t;
Adjusted_Stack_Size : Interfaces.C.size_t;
Result : Interfaces.C.int;
@@ -638,62 +736,41 @@ package body System.Task_Primitives.Operations is
Unchecked_Conversion (System.Address, Thread_Body);
begin
- if Stack_Size = System.Parameters.Unspecified_Size then
- Adjusted_Stack_Size := Interfaces.C.size_t (2 * Default_Stack_Size);
- -- Let's change the s-parame.adb to give a larger Stack_Size ?????
- else
- if Stack_Size < Size_Type (Minimum_Stack_Size) then
- Adjusted_Stack_Size :=
- Interfaces.C.size_t (Stack_Size + Minimum_Stack_Size);
-
- -- sum, instead of max: may be overkill, but should be safe
- -- thr_min_stack is a function call.
-
- -- Actually, we want to get the Default_Stack_Size and
- -- Minimum_Stack_Size from the file System.Parameters.
- -- Right now the package is not made target specific.
- -- We use our own local definitions for now ???
-
- else
- Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
- end if;
-
- -- Ask for 4 extra bytes of stack space so that the ATCB
- -- pointer can be stored below the stack limit, plus extra
- -- space for the frame of Task_Wrapper. This is so the user
- -- gets the amount of stack requested exclusive of the needs
- -- of the runtime.
+ if Stack_Size = Unspecified_Size then
+ Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
+ elsif Stack_Size < Minimum_Stack_Size then
+ Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
+ else
+ Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
- Adjusted_Stack_Size := Adjusted_Stack_Size + 4;
+ if Stack_Base_Available then
+ -- If Stack Checking is supported then allocate 2 additional pages:
+ --
+ -- In the worst case, stack is allocated at something like
+ -- N * Get_Page_Size - epsilon, we need to add the size for 2 pages
+ -- to be sure the effective stack size is greater than what
+ -- has been asked.
- -- Since the initial signal mask of a thread is inherited from the
- -- creator, we need to set our local signal mask mask all signals
- -- during the creation operation, to make sure the new thread is
- -- not disturbed by signals before it has set its own Task_ID.
+ Adjusted_Stack_Size := Adjusted_Stack_Size + 2 * Get_Page_Size;
+ end if;
Result := pthread_attr_init (Attributes'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM
- or else Shutdown ("GNULLI failure---pthread_attr_init"));
+ pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
Succeeded := False;
return;
end if;
- -- Create threads detached following email to report@gnat.com
- -- confirming this is correct (should be fixed for GNAT after 3.09).
- -- (Peter Burwood)
Result := pthread_attr_setdetachstate
(Attributes'Access, PTHREAD_CREATE_DETACHED);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_setdetachstate"));
+ pragma Assert (Result = 0);
Result := pthread_attr_setstacksize
(Attributes'Access, Interfaces.C.size_t (Adjusted_Stack_Size));
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---pthread_attr_setstacksize"));
+ pragma Assert (Result = 0);
-- Since the initial signal mask of a thread is inherited from the
-- creator, and the Environment task has all its signals masked, we
@@ -705,13 +782,20 @@ package body System.Task_Primitives.Operations is
Attributes'Access,
Thread_Body_Access (Wrapper),
To_Address (T));
- pragma Assert (Result = 0 or else Result = EAGAIN
- or else Shutdown ("GNULLI failure---Create_Task (pthread_create)"));
+ pragma Assert (Result = 0 or else Result = EAGAIN);
Succeeded := Result = 0;
- Set_Priority (T, Priority);
+ if T.Task_Image /= null then
+ declare
+ Name : aliased string (1 .. T.Task_Image.all'Length + 1);
+ begin
+ Name := T.Task_Image.all & Ascii.Nul;
+ Result := pthread_set_name_np (T.LL.Thread, Name'Address);
+ end;
+ end if;
+ Set_Priority (T, Priority);
end Create_Task;
------------------
@@ -722,21 +806,20 @@ package body System.Task_Primitives.Operations is
Result : Interfaces.C.int;
Tmp : Task_ID := T;
- procedure Free is new Unchecked_Deallocation
- (Ada_Task_Control_Block, Task_ID);
+ procedure Free is new
+ Unchecked_Deallocation (Ada_Task_Control_Block, Task_ID);
begin
Result := pthread_mutex_destroy (T.LL.L'Access);
- pragma Assert (Result = 0 or else
- Shutdown ("GNULLI failure---Finalize_TCB (pthread_mutex_destroy)"));
+ pragma Assert (Result = 0);
+
Result := pthread_cond_destroy (T.LL.CV'Access);
- pragma Assert (Result = 0 or else
- Shutdown ("GNULLI failure---Finalize_TCB (pthread_cond_destroy)"));
+ pragma Assert (Result = 0);
+
+ if T.Known_Tasks_Index /= -1 then
+ Known_Tasks (T.Known_Tasks_Index) := null;
+ end if;
- -- Following report to report@gnat.com regarding ATCB memory leak
- -- this Free is now called. The answer back from ACT didn't give
- -- the source for a fix, but I calling this Free is sufficient.
- -- (Peter Burwood)
Free (Tmp);
end Finalize_TCB;
@@ -759,21 +842,76 @@ package body System.Task_Primitives.Operations is
begin
Result := pthread_kill (T.LL.Thread,
Signal (System.Interrupt_Management.Abort_Task_Interrupt));
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Abort_Task"));
+ pragma Assert (Result = 0);
end Abort_Task;
----------------
+ -- Check_Exit --
+ ----------------
+
+ -- Dummy versions. The only currently working versions is for solaris
+ -- (native).
+
+ function Check_Exit (Self_ID : ST.Task_ID) return Boolean is
+ begin
+ return True;
+ end Check_Exit;
+
+ --------------------
+ -- Check_No_Locks --
+ --------------------
+
+ function Check_No_Locks (Self_ID : ST.Task_ID) return Boolean is
+ begin
+ return True;
+ end Check_No_Locks;
+
+ ----------------------
+ -- Environment_Task --
+ ----------------------
+
+ function Environment_Task return Task_ID is
+ begin
+ return Environment_Task_ID;
+ end Environment_Task;
+
+ -------------------------
+ -- Lock_All_Tasks_List --
+ -------------------------
+
+ procedure Lock_All_Tasks_List is
+ begin
+ Write_Lock (All_Tasks_L'Access);
+ end Lock_All_Tasks_List;
+
+ ---------------------------
+ -- Unlock_All_Tasks_List --
+ ---------------------------
+
+ procedure Unlock_All_Tasks_List is
+ begin
+ Unlock (All_Tasks_L'Access);
+ end Unlock_All_Tasks_List;
+
+ ----------------
-- Initialize --
----------------
procedure Initialize (Environment_Task : Task_ID) is
- act : aliased struct_sigaction;
- old_act : aliased struct_sigaction;
- Tmp_Set : aliased sigset_t;
- Result : Interfaces.C.int;
+ act : aliased struct_sigaction;
+ old_act : aliased struct_sigaction;
+ Tmp_Set : aliased sigset_t;
+ Result : Interfaces.C.int;
+ param : aliased struct_sched_param;
begin
+ Environment_Task_ID := Environment_Task;
+
+ -- Initialize the lock used to synchronize chain of all ATCBs.
+
+ Initialize_Lock (All_Tasks_L'Access, All_Tasks_Level);
+
+ Specific.Initialize (Environment_Task);
Enter_Task (Environment_Task);
@@ -783,33 +921,31 @@ package body System.Task_Primitives.Operations is
act.sa_handler := Abort_Handler'Address;
Result := sigemptyset (Tmp_Set'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Initialize (sigemptyset)"));
+ pragma Assert (Result = 0);
act.sa_mask := Tmp_Set;
Result :=
sigaction (
Signal (System.Interrupt_Management.Abort_Task_Interrupt),
- act'Access,
+ act'Unchecked_Access,
old_act'Unchecked_Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Initialize (sigaction)"));
+
+ pragma Assert (Result = 0);
+
+ if Time_Slice_Supported and then Time_Slice_Val > 0 then
+ if sched_getparam (Self_PID, param'Access) = 0 then
+ Result := sched_setscheduler (Self_PID, SCHED_RR, param'Access);
+ pragma Assert (Result = 0);
+ end if;
+ end if;
end Initialize;
begin
declare
Result : Interfaces.C.int;
- begin
- -- pthread_init;
- -- This call is needed for MIT thread library. We wish
- -- we could move this to s-osinte.adb and be executed during
- -- the package elaboration. However, in doing so we get an
- -- elaboration problem.
-
- -- It doesn't appear necessary to call it because pthread_init is
- -- called before any Ada elaboration occurs.
+ begin
-- Mask Environment task for all signals. The original mask of the
-- Environment task will be recovered by Interrupt_Server task
@@ -821,20 +957,14 @@ begin
-- Prepare the set of signals that should unblocked in all tasks
Result := sigemptyset (Unblocked_Signal_Mask'Access);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Initialize (sigemptyset)"));
+ pragma Assert (Result = 0);
for J in Interrupt_Management.Interrupt_ID loop
if System.Interrupt_Management.Keep_Unmasked (J) then
Result := sigaddset (Unblocked_Signal_Mask'Access, Signal (J));
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Initialize (sigaddset)"));
+ pragma Assert (Result = 0);
end if;
end loop;
-
- Result := pthread_key_create (ATCB_Key'Access, null);
- pragma Assert (Result = 0
- or else Shutdown ("GNULLI failure---Initialize (pthread_keycreate)"));
end;
end System.Task_Primitives.Operations;
diff --git a/lang/gnat/files/5ftaspri.ads b/lang/gnat/files/5ftaspri.ads
index 9cd6b64d989b..30922667f92e 100644
--- a/lang/gnat/files/5ftaspri.ads
+++ b/lang/gnat/files/5ftaspri.ads
@@ -1,15 +1,14 @@
------------------------------------------------------------------------------
-- --
--- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS --
+-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S --
-- --
-- S p e c --
--- (Version for new GNARL) --
-- --
--- $Revision: 1.1 $ --
+-- $Revision: 1.1 $ --
-- --
--- Copyright (C) 1991,92,93,94,95,1996 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-1997, 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- --
@@ -36,35 +35,7 @@
------------------------------------------------------------------------------
-- This is the FreeBSD PTHREADS version of this package. Contributed
--- by Daniel M. Eischen (deischen@iworks.InterWorks.org).
-
--- DO NOT EDIT this file.
--- It was automatically generated from another file by the m4 macro processor.
--- The name of the file you should edit is the same as this one, but with
--- ".ads" replaced by ".sm4", or
--- ".adb" replaced by ".bm4", or
--- ".c" replaced by ".cm4", or
--- ".dat" replaced by ".tm4"
-
--- Local options selected:
--- __TARGET = i386-unknown-freebsd
--- __ARCH = I386
--- __OS = FREEBSD
--- __HAS_SIGCONTEXT = 1
--- __HAS_UCONTEXT = 0
--- __THREADS = POSIX_THREADS
--- __THREAD_VARIANT = ??
--- __HAS_TIMESPEC = 1
--- __HAS_NANOSLEEP = 1
--- __HAS_CLOCK_GETTIME = 0
--- __HAS_GETTIMEOFDAY = 1
--- __POSIX_THREAD_PRIO_PROTECT = 0
--- __POSIX_THREAD_PRIO_INHERIT = 0
--- __POSIX_THREAD_ATTR_STACKADDR = 1
--- __POSIX_THREAD_ATTR_STACKSIZE = 1
--- __POSIX_THREAD_PRIORITY_SCHEDULING = 0
-
--- This package provides low-level support for most tasking features.
+-- by Daniel M. Eischen (eischen@vigrid.com).
with Interfaces.C;
-- used for int
@@ -99,6 +70,7 @@ private
type Lock is new System.OS_Interface.pthread_mutex_t;
type RTS_Lock is new System.OS_Interface.pthread_mutex_t;
+
type Private_Data is record
Thread : aliased System.OS_Interface.pthread_t;
pragma Atomic (Thread);
@@ -107,30 +79,38 @@ private
-- They put the same value (thr_self value). We do not want to
-- use lock on those operations and the only thing we have to
-- make sure is that they are updated in atomic fashion.
- CV : aliased System.OS_Interface.pthread_cond_t;
- L : aliased RTS_Lock;
+
+ CV : aliased System.OS_Interface.pthread_cond_t;
+
+ L : aliased RTS_Lock;
-- protection for all components is lock L
+
Current_Priority : Interfaces.C.int := 0;
-- Active priority, except that the effects of protected object
-- priority ceilings are not reflected. This only reflects explicit
-- priority changes and priority inherited through task activation
-- and rendezvous.
+ --
-- Ada 95 notes: In Ada 95, this field will be transferred to the
-- Priority field of an Entry_Calls component when an entry call
-- is initiated. The Priority of the Entry_Calls component will not
-- change for the duration of the call. The accepting task can
-- use it to boost its own priority without fear of its changing in
-- the meantime.
+ --
-- This can safely be used in the priority ordering
-- of entry queues. Once a call is queued, its priority does not
-- change.
+ --
-- Since an entry call cannot be made while executing
-- a protected action, the priority of a task will never reflect a
-- priority ceiling change at the point of an entry call.
+ --
-- Protection: Only written by Self, and only accessed when Acceptor
-- accepts an entry or when Created activates, at which points Self is
-- suspended.
- Stack_Size : Interfaces.c.size_t;
+
+ Stack_Size : Interfaces.C.size_t;
-- Requested stack size.
-- Protection: Only used by Self.
end record;
diff --git a/lang/gnat/files/freebsdgcc28-patches b/lang/gnat/files/freebsdgcc28-patches
new file mode 100644
index 000000000000..58db454627eb
--- /dev/null
+++ b/lang/gnat/files/freebsdgcc28-patches
@@ -0,0 +1,538 @@
+--- config/i386/freebsd.h.orig Sun Oct 19 09:31:05 1997
++++ config/i386/freebsd.h Tue Aug 11 14:28:56 1998
+@@ -35,10 +35,21 @@
+ #include "i386/perform.h"
+
+ #undef CPP_PREDEFINES
+-#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -D__386BSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
++#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__=2 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
++
++/* FreeBSD using a.out does not support DWARF2 unwinding mechanisms.
++ Thus, need the equivalent of "-fsjlj-exceptions" (use setjmp/longjmp
++ for exceptions). */
++#define DWARF2_UNWIND_INFO 0
++
++/* Provide a CPP_SPEC appropriate for OpenBSD. Current we just deal with
++ the GCC option `-posix'. */
++
++#undef CPP_SPEC
++#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
+
+ /* Like the default, except no -lg. */
+-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
++#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
+
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "unsigned int"
+@@ -54,8 +65,13 @@
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE 16
+
++/* We have atexit(3). */
+ #define HAVE_ATEXIT
+
++/* We want gcc.c to call mktemp() for each file it generates. We would
++ prefer mkstemp(), but we will take what we get. XXX busted */
++/* #undef MKTEMP_EACH_FILE */
++
+ #undef ASM_APP_ON
+ #define ASM_APP_ON "#APP\n"
+
+@@ -114,6 +130,7 @@
+
+ #define TYPE_ASM_OP ".type"
+ #define SIZE_ASM_OP ".size"
++#define SET_ASM_OP ".set"
+
+ /* The following macro defines the format used to output the second
+ operand of the .type assembler directive. Different svr4 assemblers
+@@ -123,6 +140,16 @@
+
+ #define TYPE_OPERAND_FMT "@%s"
+
++/* Handle #pragma weak and #pragma pack. */
++
++#define HANDLE_SYSV_PRAGMA 1
++
++/* This is how we tell the assembler that a symbol is weak. */
++
++#define ASM_WEAKEN_LABEL(FILE,NAME) \
++ do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
++ fputc ('\n', FILE); } while (0)
++
+ /* Write the extra assembler code needed to declare a function's result.
+ Most svr4 assemblers don't require any special declaration of the
+ result value, but there are exceptions. */
+@@ -131,9 +158,9 @@
+ #define ASM_DECLARE_RESULT(FILE, RESULT)
+ #endif
+
+-/* These macros generate the special .type and .size directives which
++/* these macros generate the special .type and .size directives which
+ are used to set the corresponding fields of the linker symbol table
+- entries in an ELF object file under SVR4. These macros also output
++ entries in an elf object file under svr4. these macros also output
+ the starting labels for the relevant functions/objects. */
+
+ /* Write the extra assembler code needed to declare a function properly.
+@@ -185,6 +212,7 @@
+ && DECL_INITIAL (DECL) == error_mark_node \
+ && !size_directive_output) \
+ { \
++ size_directive_output = 1; \
+ fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
+ assemble_name (FILE, name); \
+ fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
+@@ -213,33 +241,57 @@
+ } \
+ } while (0)
+
++/* XXX - should ASM_SPEC be " %| %{fpic:-k} %{fPIC:-k -K}" ??? */
+ #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
++
+ #define LINK_SPEC \
+- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
++ "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
++ %{shared:-Bshareable} \
++ %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
++ %{pg:-Bstatic} %{Z}} \
++ %{assert*} %{R*}"
++
++#ifdef FROM_OPENBSD
++/* This defines which switch letters take arguments.
++ make -R /path/to/lib work the same as -R/path/to/lib */
++#undef SWITCH_TAKES_ARG
++#define SWITCH_TAKES_ARG(CHAR) \
++ (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
++ || (CHAR) == 'R')
++#endif
++
++#define STARTFILE_SPEC \
++ "%{shared:c++rt0.o%s} \
++ %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
+
+-/* This is defined when gcc is compiled in the BSD-directory-tree, and must
+- * make up for the gap to all the stuff done in the GNU-makefiles.
++#define MD_STARTFILE_PREFIX "/usr/lib/aout/"
++
++/* FREEBSD_NATIVE is defined when gcc is compiled in the BSD-directory-tree,
++ * and must make up for the gap to all the stuff done in the GNU-makefiles.
+ */
+
+ #ifdef FREEBSD_NATIVE
+
+-#define INCLUDE_DEFAULTS { \
+- { "/usr/include", 0, 0, 0 }, \
+- { "/usr/include/g++", "G++", 1, 1 }, \
+- { 0, 0, 0, 0} \
+- }
++#undef GCC_INCLUDE_DIR
++#define GCC_INCLUDE_DIR "/usr/include"
++
++#undef GPLUSPLUS_INCLUDE_DIR
++#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
++
++/* Look for the include files in the system-defined places. */
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS \
++ { \
++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
++ { GCC_INCLUDE_DIR, 0, 0, 0 }, \
++ { 0, 0, 0, 0 } \
++ }
+
+ #undef MD_EXEC_PREFIX
+ #define MD_EXEC_PREFIX "/usr/libexec/"
+
+ #undef STANDARD_STARTFILE_PREFIX
+ #define STANDARD_STARTFILE_PREFIX "/usr/lib"
+-
+-#if 0 /* This is very wrong!!! */
+-#define DEFAULT_TARGET_MACHINE "i386-unknown-freebsd_1.0"
+-#define GPLUSPLUS_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
+-#define TOOL_INCLUDE_DIR "/usr/local/i386-unknown-freebsd_1.0/include"
+-#define GCC_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
+-#endif
+
+ #endif /* FREEBSD_NATIVE */
+--- configure.orig Sat Feb 28 18:02:02 1998
++++ configure Tue Aug 11 13:51:17 1998
+@@ -677,9 +677,9 @@
+ if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+ fi
+-ac_config_guess=$ac_aux_dir/config.guess
+-ac_config_sub=$ac_aux_dir/config.sub
+-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
++ac_config_guess="/bin/sh $ac_aux_dir/config.guess"
++ac_config_sub="/bin/sh $ac_aux_dir/config.sub"
++ac_configure="/bin/sh $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+ # Do some error checking and defaulting for the host and target type.
+@@ -2797,6 +2797,20 @@
+ a29k-*-*) # Default a29k environment.
+ use_collect2=yes
+ ;;
++ alpha*-*-freebsd*)
++ tm_file=alpha/freebsd.h
++ # On FreeBSD, the headers are already ok, except for math.h. (??right??)
++ fixincludes=fixinc.math
++ fixincludes=fixinc.math
++ tmake_file=t-libc-ok
++ ;;
++ alpha-*-openbsd*)
++ tm_file=alpha/openbsd.h
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ tmake_file=t-libc-ok
++ xmake_file=x-openbsd
++ ;;
+ alpha*-*-linux-gnuecoff*)
+ tm_file="${tm_file} alpha/linux.h"
+ xm_file="${xm_file} alpha/xm-linux.h"
+@@ -3158,6 +3172,14 @@
+ use_collect2=yes
+ fixincludes=Makefile.in
+ ;;
++ hppa*-*-openbsd*)
++ target_cpu_default=1
++ tm_file="pa/pa-openbsd.h"
++ xm_file=pa/xm-openbsd.h
++ xmake_file=x-openbsd
++ use_collect2=yes
++ fixincludes=Makefile.in
++ ;;
+ i370-*-mvs*)
+ ;;
+ i[34567]86-ibm-aix*) # IBM PS/2 running AIX
+@@ -3277,6 +3299,13 @@
+ fixincludes=fixinc.math
+ tmake_file=t-netbsd
+ ;;
++ i[34567]86-*-openbsd*)
++ tm_file=i386/openbsd.h
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ tmake_file=t-libc-ok
++ xmake_file=x-openbsd
++ ;;
+ i[34567]86-*-coff*)
+ tm_file=i386/i386-coff.h
+ tmake_file=i386/t-i386bare
+@@ -3964,6 +3993,13 @@
+ fixincludes=fixinc.math
+ tmake_file=t-netbsd
+ ;;
++ m68k-*-openbsd*)
++ tm_file=m68k/openbsd.h
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ tmake_file=t-libc-ok
++ xmake_file=x-openbsd
++ ;;
+ m68k-*-sysv3*) # Motorola m68k's running system V.3
+ xm_file=m68k/xm-m68kv.h
+ xmake_file=m68k/x-m68kv
+@@ -4273,6 +4309,20 @@
+ prefix=$native_prefix
+ fi
+ ;;
++ mips*el-*-openbsd*) # MIPS running OpenBSD
++ tm_file=mips/openbsd-le.h
++ xmake_file=x-openbsd
++ tmake_file=t-libc-ok
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ ;;
++ mips*-*-openbsd*) # MIPS big-endian running OpenBSD
++ tm_file=mips/openbsd-be.h
++ xmake_file=x-openbsd
++ tmake_file=t-libc-ok
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ ;;
+ mips-sony-bsd* | mips-sony-newsos*) # Sony NEWS 3600 or risc/news.
+ tm_file=mips/news4.h
+ if [ x$stabs = xyes ]; then
+@@ -4612,6 +4662,13 @@
+ fixincludes=fixinc.math
+ tmake_file=t-netbsd
+ ;;
++ ns32k-*-openbsd*)
++ tm_file=ns32k/openbsd.h
++ tmake_file=t-libc-ok
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ xmake_file=x-openbsd
++ ;;
+ pdp11-*-bsd)
+ tm_file="${tm_file} pdp11/2bsd.h"
+ ;;
+@@ -4625,10 +4682,23 @@
+ romp-*-aos*)
+ use_collect2=yes
+ ;;
++ romp-*-openbsd*)
++ tm_file=romp/openbsd.h
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ xmake_file=romp/x-openbsd
++ ;;
+ romp-*-mach*)
+ xmake_file=romp/x-mach
+ use_collect2=yes
+ ;;
++ powerpc-*-*bsd*)
++ tm_file=rs6000/openbsd.h
++ tmake_file=rs6000/t-openbsd
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ xmake_file=rs6000/x-openbsd
++ ;;
+ powerpc-*-sysv* | powerpc-*-elf*)
+ tm_file=rs6000/sysv4.h
+ xm_file=rs6000/xm-sysv4.h
+@@ -4841,6 +4911,13 @@
+ fixincludes=fixinc.math
+ tmake_file=t-netbsd
+ ;;
++ sparc-*-openbsd*)
++ tm_file=sparc/openbsd.h
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ tmake_file=t-libc-ok
++ xmake_file=x-openbsd
++ ;;
+ sparc-*-bsd*)
+ tm_file=sparc/bsd.h
+ ;;
+@@ -5009,6 +5086,14 @@
+ # On NetBSD, the headers are already okay, except for math.h.
+ fixincludes=fixinc.math
+ tmake_file=t-netbsd
++ float_format=vax
++ ;;
++ vax-*-openbsd*)
++ tm_file=vax/openbsd.h
++ tmake_file="t-libc-ok vax/t-openbsd"
++ # On OpenBSD, the headers are already okay.
++ fixincludes=Makefile.in
++ xmake_file=x-openbsd
+ float_format=vax
+ ;;
+ vax-*-ultrix*) # vaxen running ultrix
+--- choose-temp.c.orig Thu Dec 4 06:17:56 1997
++++ choose-temp.c Tue Aug 11 04:05:05 1998
+@@ -107,12 +107,17 @@
+ base = try (getenv ("TMP"), base);
+ base = try (getenv ("TEMP"), base);
+
++#ifdef COMMENT_OUT /* XXX - P_tmpdir is not /tmp in 4.4BSD */
+ #ifdef P_tmpdir
+ base = try (P_tmpdir, base);
+ #endif
++#endif /* XXX */
+
+ /* Try /usr/tmp, then /tmp. */
++#ifdef COMMENT_OUT /* XXX - want /tmp used, peroid. Sometimes pkg_add can
++ create a /usr/tmp, so beware. */
+ base = try (usrtmp, base);
++#endif /* XXX */
+ base = try (tmp, base);
+
+ /* If all else fails, use the current directory! */
+--- flags.h.orig Wed Dec 31 05:02:33 1997
++++ flags.h Tue Aug 11 13:31:22 1998
+@@ -216,6 +216,20 @@
+
+ extern int flag_unroll_all_loops;
+
++/* Nonzero forces all invariant computations in loops to be moved
++ outside the loop. */
++
++extern int flag_move_all_movables;
++
++/* Nonzero forces all general induction variables in loops to be
++ strength reduced. */
++
++extern int flag_reduce_all_givs;
++
++/* Nonzero gets another run of loop_optimize performed. */
++
++extern int flag_rerun_loop_opt;
++
+ /* Nonzero for -fcse-follow-jumps:
+ have cse follow jumps to do a more extensive job. */
+
+--- toplev.c.orig Wed Feb 25 18:04:46 1998
++++ toplev.c Tue Aug 11 14:40:22 1998
+@@ -463,6 +463,20 @@
+
+ int flag_unroll_all_loops;
+
++/* Nonzero forces all invariant computations in loops to be moved
++ outside the loop. */
++
++int flag_move_all_movables = 0;
++
++/* Nonzero forces all general induction variables in loops to be
++ strength reduced. */
++
++int flag_reduce_all_givs = 0;
++
++/* Nonzero gets another run of loop_optimize performed. */
++
++int flag_rerun_loop_opt = 0;
++
+ /* Nonzero for -fwritable-strings:
+ store string constants in data segment and don't uniquize them. */
+
+--- loop.c.orig Fri Feb 6 11:23:34 1998
++++ loop.c Tue Aug 11 16:57:35 1998
+@@ -1637,6 +1637,7 @@
+ extra cost because something else was already moved. */
+
+ if (already_moved[regno]
++ || flag_move_all_movables
+ || (threshold * savings * m->lifetime) >= insn_count
+ || (m->forces && m->forces->done
+ && n_times_used[m->forces->regno] == 1))
+@@ -3911,7 +3912,7 @@
+ of such giv's whether or not we know they are used after the loop
+ exit. */
+
+- if (v->lifetime * threshold * benefit < insn_count
++ if (!flag_reduce_all_givs && v->lifetime * threshold * benefit < insn_count
+ && ! bl->reversed)
+ {
+ if (loop_dump_stream)
+--- cp/lex.c.orig Wed Nov 26 12:13:20 1997
++++ cp/lex.c Tue Aug 11 13:37:17 1998
+@@ -3329,6 +3329,14 @@
+ token_buffer[0] = '^';
+ token_buffer[1] = 0;
+ }
++ else if (ptr->token == NAMESPACE)
++ {
++ static int warned;
++ if (! warned)
++ warning ("namespaces are mostly broken in this version of g++");
++
++ warned = 1;
++ }
+
+ value = (int) ptr->token;
+ }
+--- gcc.1.orig Tue Feb 17 10:44:00 1998
++++ gcc.1 Tue Aug 11 13:30:01 1998
+@@ -182,7 +182,7 @@
+ \-Waggregate\-return
+ \-Wcast\-align
+ \-Wcast\-qual
+-\-Wchar\-subscript
++\-Wchar\-subscripts
+ \-Wcomment
+ \-Wconversion
+ \-Wenum\-clash
+--- invoke.texi.orig Tue Feb 17 10:54:05 1998
++++ invoke.texi Tue Aug 11 13:29:38 1998
+@@ -115,7 +115,7 @@
+ @smallexample
+ -fsyntax-only -pedantic -pedantic-errors
+ -w -W -Wall -Waggregate-return -Wbad-function-cast
+--Wcast-align -Wcast-qual -Wchar-subscript -Wcomment
++-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment
+ -Wconversion -Werror -Wformat
+ -Wid-clash-@var{len} -Wimplicit -Wimplicit-int
+ -Wimplicit-function-declarations -Wimport -Winline
+@@ -153,6 +153,7 @@
+ -frerun-cse-after-loop -fschedule-insns
+ -fschedule-insns2 -fstrength-reduce -fthread-jumps
+ -funroll-all-loops -funroll-loops
++-fmove-all-movables -freduce-all-givs -frerun-loop-opt
+ -O -O0 -O1 -O2 -O3
+ @end smallexample
+
+@@ -2284,6 +2285,47 @@
+ Perform the optimization of loop unrolling. This is done for all loops
+ and usually makes programs run more slowly. @samp{-funroll-all-loops}
+ implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}.
++
++@item -fmove-all-movables
++Forces all invariant computations in loops to be moved
++outside the loop.
++This option is provided primarily to improve performance
++for some Fortran code, though it might improve code written
++in other languages.
++
++@emph{Note:} When compiling programs written in Fortran,
++this option is enabled by default.
++
++Analysis of Fortran code optimization and the resulting
++optimizations triggered by this option, and the
++@samp{-freduce-all-givs} and @samp{-frerun-loop-opt}
++options as well, were
++contributed by Toon Moene (@code{toon@@moene.indiv.nluug.nl}).
++
++Please let us (@code{fortran@@gnu.ai.mit.edu})
++know how use of these options affects
++the performance of your production code.
++We're very interested in code that runs @emph{slower}
++when these options are @emph{enabled}.
++
++@item -freduce-all-givs
++Forces all general-induction variables in loops to be
++strength-reduced.
++This option is provided primarily to improve performance
++for some Fortran code, though it might improve code written
++in other languages.
++
++@emph{Note:} When compiling programs written in Fortran,
++this option is enabled by default.
++
++@item -frerun-loop-opt
++Runs loop optimizations a second time.
++This option is provided primarily to improve performance
++for some Fortran code, though it might improve code written
++in other languages.
++
++@emph{Note:} When compiling programs written in Fortran,
++this option is enabled by default.
+
+ @item -fno-peephole
+ Disable any machine-specific peephole optimizations.
+--- config/alpha/alpha.c.orig Fri Feb 6 17:23:50 1998
++++ config/alpha/alpha.c Tue Aug 11 04:06:42 1998
+@@ -1843,7 +1843,7 @@
+ /* Write a version stamp. Don't write anything if we are running as a
+ cross-compiler. Otherwise, use the versions in /usr/include/stamp.h. */
+
+-#if !defined(CROSS_COMPILE) && !defined(_WIN32) && !defined(__linux__) && !defined(VMS)
++#if !defined(CROSS_COMPILE) && !defined(_WIN32) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__linux__) && !defined(VMS)
+ #include <stamp.h>
+ #endif
+
+--- ginclude/stdarg.h.orig Sat Oct 18 10:26:07 1997
++++ ginclude/stdarg.h Tue Aug 11 13:27:03 1998
+@@ -64,7 +64,7 @@
+
+ #ifndef __GNUC_VA_LIST
+ #define __GNUC_VA_LIST
+-#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
++#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) || defined(__OpenBSD__)
+ typedef char *__gnuc_va_list;
+ #else
+ typedef void *__gnuc_va_list;
+--- ginclude/stddef.h.orig Mon Oct 28 04:35:28 1996
++++ ginclude/stddef.h Tue Aug 11 13:26:05 1998
+@@ -24,7 +24,7 @@
+
+ /* On 4.3bsd-net2, make sure ansi.h is included, so we have
+ one less case to deal with in the following. */
+-#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
++#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__)
+ #include <machine/ansi.h>
+ #endif
+
diff --git a/lang/gnat/files/patch-aa b/lang/gnat/files/patch-aa
index eb8cd4588e4a..62e53dc189b9 100644
--- a/lang/gnat/files/patch-aa
+++ b/lang/gnat/files/patch-aa
@@ -1,141 +1,36 @@
-diff -c orig/Makefile.in gcc/Makefile.in
-*** orig/Makefile.in Thu Mar 27 17:32:15 1997
---- gcc-2.7.2.1/Makefile.in Fri Apr 4 19:55:09 1997
+*** ./Makefile.in.orig Wed Jun 23 02:34:31 1999
+--- ./Makefile.in Wed Jun 23 02:35:29 1999
***************
-*** 189,200 ****
- local_prefix = /usr/local
- # Directory in which to put host dependent programs and libraries
- exec_prefix = $(prefix)
- # Directory in which to put the executable for the command `gcc'
- bindir = $(exec_prefix)/bin
- # Directory in which to put the directories used by the compiler.
- libdir = $(exec_prefix)/lib
- # Directory in which the compiler finds executables, libraries, etc.
-! libsubdir = $(libdir)/gcc-lib/$(target)/$(version)
- # Directory in which the compiler finds g++ includes.
- gxx_include_dir= $(libdir)/g++-include
- # Directory to search for site-specific includes.
---- 189,202 ----
- local_prefix = /usr/local
- # Directory in which to put host dependent programs and libraries
- exec_prefix = $(prefix)
-+ # directory to hold compilers
-+ compdir = $(prefix)/libexec/ada
- # Directory in which to put the executable for the command `gcc'
- bindir = $(exec_prefix)/bin
- # Directory in which to put the directories used by the compiler.
- libdir = $(exec_prefix)/lib
- # Directory in which the compiler finds executables, libraries, etc.
-! libsubdir = $(libdir)
- # Directory in which the compiler finds g++ includes.
- gxx_include_dir= $(libdir)/g++-include
- # Directory to search for site-specific includes.
-***************
-*** 213,219 ****
- mandir = $(prefix)/man/man1
- # Directory in which to find other cross-compilation tools and headers.
- # Used in install-cross.
-! tooldir = $(exec_prefix)/$(target)
- # Dir for temp files.
- tmpdir = /tmp
+*** 152,158 ****
+ ENQUIRE_LDFLAGS = $(LDFLAGS)
---- 215,221 ----
- mandir = $(prefix)/man/man1
- # Directory in which to find other cross-compilation tools and headers.
- # Used in install-cross.
-! tooldir = $(exec_prefix)
- # Dir for temp files.
- tmpdir = /tmp
+ # Sed command to transform gcc to installed name. Overwritten by configure.
+! program_transform_name = -e s,x,x,
+ program_transform_cross_name = -e s,^,$(target_alias)-,
-***************
-*** 1141,1148 ****
+ # Tools to use when building a cross-compiler.
+--- 152,158 ----
+ ENQUIRE_LDFLAGS = $(LDFLAGS)
- gcc.o: gcc.c $(CONFIG_H) multilib.h config.status $(lang_specs_files)
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
-! -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
- -DDEFAULT_TARGET_VERSION=\"$(version)\" \
- -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
- -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
---- 1143,1152 ----
+ # Sed command to transform gcc to installed name. Overwritten by configure.
+! program_transform_name = -e s,^,ada,
+ program_transform_cross_name = -e s,^,$(target_alias)-,
- gcc.o: gcc.c $(CONFIG_H) multilib.h config.status $(lang_specs_files)
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-+ -DFREEBSD_NATIVE \
-+ -DFREEBSD_PREFIX=\"$(prefix)\" \
- -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
-! -DSTANDARD_EXEC_PREFIX=\"$(libdir)/\" \
- -DDEFAULT_TARGET_VERSION=\"$(version)\" \
- -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
- -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
-***************
-*** 2055,2069 ****
- # Create the installation directory.
- install-dir:
- -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
-- -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
- # This dir isn't currently searched by cpp.
- # -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
-! -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; chmod a+rx $(libdir)/gcc-lib/$(target) ; fi
-! -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version) ; fi
-! -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
- -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
- -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
- -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
- -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
- -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
- # We don't use mkdir -p to create the parents of mandir,
---- 2059,2073 ----
- # Create the installation directory.
- install-dir:
- -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
- # This dir isn't currently searched by cpp.
- # -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
-! # -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; chmod a+rx $(libdir)/gcc-lib/$(target) ; fi
-! # -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version) ; fi
-! # -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
- -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
- -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
- -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
-+ -if [ -d $(compdir) ] ; then true ; else mkdir $(compdir) ; chmod a+rx $(compdir) ; fi
- -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
- -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
- # We don't use mkdir -p to create the parents of mandir,
-***************
-*** 2077,2084 ****
- install-common: native install-dir $(EXTRA_PARTS) lang.install-common
- for file in $(COMPILERS); do \
- if [ -f $$file ] ; then \
-! rm -f $(libsubdir)/$$file; \
-! $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
- else true; \
- fi; \
- done
---- 2081,2088 ----
- install-common: native install-dir $(EXTRA_PARTS) lang.install-common
- for file in $(COMPILERS); do \
- if [ -f $$file ] ; then \
-! rm -f $(compdir)/$$file; \
-! $(INSTALL_PROGRAM) $$file $(compdir)/$$file; \
- else true; \
- fi; \
- done
+ # Tools to use when building a cross-compiler.
***************
-*** 2110,2117 ****
- $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
- chmod a-x $(libsubdir)/SYSCALLS.c.X; \
- fi
-! -rm -f $(libsubdir)/cpp$(exeext)
-! $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
+*** 2151,2157 ****
+ # Install the driver last so that the window when things are
+ # broken is small.
+ install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
+! install-man install-info lang.install-normal install-driver
- # Install the driver program as $(target)-gcc
- # and also as either gcc (if native) or $(tooldir)/bin/gcc.
---- 2114,2121 ----
- $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
- chmod a-x $(libsubdir)/SYSCALLS.c.X; \
- fi
-! -rm -f $(compdir)/cpp$(exeext)
-! $(INSTALL_PROGRAM) cpp$(exeext) $(compdir)/cpp$(exeext)
+ # Do nothing while making gcc with a cross-compiler. The person who
+ # makes gcc for the target machine has to know how to put a complete
+--- 2151,2157 ----
+ # Install the driver last so that the window when things are
+ # broken is small.
+ install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
+! install-man lang.install-normal install-driver
- # Install the driver program as $(target)-gcc
- # and also as either gcc (if native) or $(tooldir)/bin/gcc.
+ # Do nothing while making gcc with a cross-compiler. The person who
+ # makes gcc for the target machine has to know how to put a complete
diff --git a/lang/gnat/files/patch-ab b/lang/gnat/files/patch-ab
index baf5ebdeec18..998287bcf91e 100644
--- a/lang/gnat/files/patch-ab
+++ b/lang/gnat/files/patch-ab
@@ -1,36 +1,62 @@
-diff -c orig/gcc.c gcc/gcc.c
-*** orig/gcc.c Thu Apr 3 08:37:06 1997
---- gcc-2.7.2.1/gcc.c Fri Apr 4 23:21:00 1997
+*** ./config/i386/freebsd.h.orig Fri Sep 4 23:57:29 1998
+--- ./config/i386/freebsd.h Fri Sep 4 23:58:54 1998
***************
-*** 1354,1362 ****
- #undef MD_STARTFILE_PREFIX_1
- #endif
+*** 49,55 ****
+ #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-! #ifndef STANDARD_EXEC_PREFIX
-! #define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
-! #endif /* !defined STANDARD_EXEC_PREFIX */
+ /* Like the default, except no -lg. */
+! #define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
- static char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
- static char *standard_exec_prefix_1 = "/usr/lib/gcc/";
---- 1354,1360 ----
- #undef MD_STARTFILE_PREFIX_1
- #endif
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "unsigned int"
+--- 49,55 ----
+ #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-! #define STANDARD_EXEC_PREFIX FREEBSD_PREFIX "/libexec/"
+ /* Like the default, except no -lg. */
+! #define LIB_SPEC "%{!shared:%{!pg:%{!pthread:%{!kthread:-lc}%{kthread:-lpthread -lc}}%{pthread:-lc_r}}%{pg:%{!pthread:%{!kthread:-lc_p}%{kthread:-lpthread_p -lc_p}}%{pthread:-lc_r_p}}}"
- static char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
- static char *standard_exec_prefix_1 = "/usr/lib/gcc/";
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "unsigned int"
+*** ./config/i386/freebsd-elf.h.orig Fri Dec 5 07:15:34 1997
+--- ./config/i386/freebsd-elf.h Fri Feb 12 21:35:52 1999
***************
-*** 2708,2715 ****
---- 2706,2716 ----
- /* Use 2 as fourth arg meaning try just the machine as a suffix,
- as well as trying the machine and the version. */
- #ifdef FREEBSD_NATIVE
-+ add_prefix (&exec_prefixes, FREEBSD_PREFIX "/libexec/ada/", 0, 0, NULL_PTR);
-+ add_prefix (&exec_prefixes, FREEBSD_PREFIX "/libexec/", 0, 0, NULL_PTR);
- add_prefix (&exec_prefixes, "/usr/libexec/", 0, 0, NULL_PTR);
- add_prefix (&exec_prefixes, "/usr/bin/", 0, 0, NULL_PTR);
-+ add_prefix (&startfile_prefixes, FREEBSD_PREFIX "/lib/", 0, 0, NULL_PTR);
- add_prefix (&startfile_prefixes, "/usr/libdata/gcc/", 0, 0, NULL_PTR);
- #else /* not FREEBSD_NATIVE */
- #ifndef OS2
+*** 140,146 ****
+ #define WCHAR_TYPE_SIZE BITS_PER_WORD
+
+ #undef CPP_PREDEFINES
+! #define CPP_PREDEFINES "-Dunix -D__ELF__ -D__FreeBSD__=2 -Asystem(FreeBSD)"
+
+ #undef CPP_SPEC
+ #define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
+--- 140,146 ----
+ #define WCHAR_TYPE_SIZE BITS_PER_WORD
+
+ #undef CPP_PREDEFINES
+! #define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__=3 -Asystem(FreeBSD) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
+
+ #undef CPP_SPEC
+ #define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
+***************
+*** 152,159 ****
+ * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
+ */
+ #define LIB_SPEC \
+! "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
+! %{!ggdb:-lc} %{ggdb:-lg}}"
+ #else
+ #define LIB_SPEC \
+ "%{!shared: \
+--- 152,164 ----
+ * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
+ */
+ #define LIB_SPEC \
+! "%{!shared: \
+! %{!pg: \
+! %{!pthread: %{!kthread:-lc} %{kthread:-lpthread -lc}} \
+! %{pthread:-lc_r}} \
+! %{pg: \
+! %{!pthread: %{!kthread:-lc_p} %{kthread:-lpthread_p -lc_p}} \
+! %{pthread:-lc_r_p}}}"
+ #else
+ #define LIB_SPEC \
+ "%{!shared: \
diff --git a/lang/gnat/files/patch-ac b/lang/gnat/files/patch-ac
index e831059d7171..26c4d9687173 100644
--- a/lang/gnat/files/patch-ac
+++ b/lang/gnat/files/patch-ac
@@ -1,32 +1,24 @@
-*** gcc-2.7.2.1/ada/Makefile.in.orig Sun Nov 16 09:10:32 1997
---- gcc-2.7.2.1/ada/Makefile.in Sun Nov 16 09:14:37 1997
+*** ./ada/Makefile.in.orig Wed Jul 29 21:00:07 1998
+--- ./ada/Makefile.in Mon Aug 31 09:16:59 1998
***************
-*** 815,820 ****
---- 815,821 ----
- fsu* | FSU*) letter=l;;\
- native | *) letter=i;;\
- esac;;\
-+ *86*-freebsd*) letter=f ;;\
- mips-sgi-irix*) letter=g ;;\
- hppa*-hp-hpux*) letter=h ;;\
- *-ibm-aix4*) letter=c ;;\
-***************
-*** 865,870 ****
---- 866,872 ----
- *-*-rtems* | *-rtems* |\
- *-go32-msdos | *-go32 |\
- *86*-linux* |\
-+ *86*-freebsd* |\
- mips-sni-* |\
- *) \
- \
-***************
-*** 920,925 ****
---- 922,928 ----
- *-*-rtems* | *-rtems* |\
- *-go32-msdos | *-go32 |\
- *86*-linux* |\
-+ *86*-freebsd* |\
- mips-sni-* |\
- *-*-cygwin32* |\
- *-*-mingw32* |\
+*** 779,784 ****
+--- 779,797 ----
+ endif
+ endif
+
++ ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
++ LIBGNAT_TARGET_PAIRS = \
++ a-intnam.ads<4fintnam.ads \
++ s-inmaop.adb<7sinmaop.adb \
++ s-intman.adb<5fintman.adb \
++ s-osinte.adb<5fosinte.adb \
++ s-osinte.ads<5fosinte.ads \
++ s-osprim.adb<7sosprim.adb \
++ s-taprop.adb<5ftaprop.adb \
++ s-taspri.ads<5ftaspri.ads \
++ s-tpopsp.adb<7stpopsp.adb
++ endif
++
+ ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-emstop.adb<4gemstop.adb \
diff --git a/lang/gnat/files/patch-ad b/lang/gnat/files/patch-ad
index 15066bfc11f2..5ca0030b6f41 100644
--- a/lang/gnat/files/patch-ad
+++ b/lang/gnat/files/patch-ad
@@ -1,36 +1,19 @@
-*** gcc-2.7.2.1/ada/make.adb.orig Thu Aug 14 00:02:45 1997
---- gcc-2.7.2.1/ada/make.adb Sun Nov 16 09:18:18 1997
+*** ./ada/make.adb.orig Wed Jul 29 21:01:09 1998
+--- ./ada/make.adb Tue Sep 1 00:24:06 1998
***************
-*** 201,207 ****
+*** 202,208 ****
-- Compiler, Binder & Linker Data and Subprograms --
----------------------------------------------------
-! Gcc : String_Access := GNAT.OS_Lib.Locate_Exec_On_Path ("gcc");
- Gnatbind : String_Access := GNAT.OS_Lib.Locate_Exec_On_Path ("gnatbind");
- Gnatlink : String_Access := GNAT.OS_Lib.Locate_Exec_On_Path ("gnatlink");
-
---- 201,207 ----
+! Gcc : String_Access := Program_Name ("gcc");
+ Gnatbind : String_Access := Program_Name ("gnatbind");
+ Gnatlink : String_Access := Program_Name ("gnatlink");
+ -- Default compiler, binder, linker programs
+--- 202,208 ----
-- Compiler, Binder & Linker Data and Subprograms --
----------------------------------------------------
-! Gcc : String_Access := GNAT.OS_Lib.Locate_Exec_On_Path ("adagcc");
- Gnatbind : String_Access := GNAT.OS_Lib.Locate_Exec_On_Path ("gnatbind");
- Gnatlink : String_Access := GNAT.OS_Lib.Locate_Exec_On_Path ("gnatlink");
-
-***************
-*** 941,947 ****
- Comp_Last := Comp_Last + 1;
- Comp_Args (Comp_Last) := new String'(Name_Buffer (1 .. Name_Len));
-
-! Display ("gcc", Comp_Args (Args'First .. Comp_Last));
-
- return
- GNAT.OS_Lib.Non_Blocking_Spawn
---- 941,947 ----
- Comp_Last := Comp_Last + 1;
- Comp_Args (Comp_Last) := new String'(Name_Buffer (1 .. Name_Len));
-
-! Display ("adagcc", Comp_Args (Args'First .. Comp_Last));
-
- return
- GNAT.OS_Lib.Non_Blocking_Spawn
+! Gcc : String_Access := Program_Name ("adagcc");
+ Gnatbind : String_Access := Program_Name ("gnatbind");
+ Gnatlink : String_Access := Program_Name ("gnatlink");
+ -- Default compiler, binder, linker programs
diff --git a/lang/gnat/files/patch-ae b/lang/gnat/files/patch-ae
index 5ebf05b30a00..bc5c986bcef5 100644
--- a/lang/gnat/files/patch-ae
+++ b/lang/gnat/files/patch-ae
@@ -1,19 +1,19 @@
-*** gcc-2.7.2.1/ada/gnatcmd.adb.orig Thu Aug 14 00:02:49 1997
---- gcc-2.7.2.1/ada/gnatcmd.adb Sun Nov 16 09:23:23 1997
+*** ./ada/gnatcmd.adb.orig Wed Jul 29 21:01:07 1998
+--- ./ada/gnatcmd.adb Tue Sep 1 00:25:06 1998
***************
-*** 987,993 ****
+*** 988,994 ****
(Cname => new S'("COMPILE"),
- Usage => new S'("GNAT COMPILE file file .. file /qualifiers"),
-! Unixcmd => new S'("gcc -c"),
+ Usage => new S'("GNAT COMPILE filespec[,...] /qualifiers"),
+! Unixcmd => new S'("gcc -c -x ada"),
Switches => GCC_Switches'Access,
- Minfile => 1,
- Maxfile => 0,
---- 987,993 ----
+ Params => new Parameter_Array'(1 => FILES_OR_WILDCARD),
+ Defext => " "),
+--- 988,994 ----
(Cname => new S'("COMPILE"),
- Usage => new S'("GNAT COMPILE file file .. file /qualifiers"),
-! Unixcmd => new S'("adagcc -c"),
+ Usage => new S'("GNAT COMPILE filespec[,...] /qualifiers"),
+! Unixcmd => new S'("adagcc -c -x ada"),
Switches => GCC_Switches'Access,
- Minfile => 1,
- Maxfile => 0,
+ Params => new Parameter_Array'(1 => FILES_OR_WILDCARD),
+ Defext => " "),
diff --git a/lang/gnat/files/patch-af b/lang/gnat/files/patch-af
index d7f39259084c..8ec2237ecc32 100644
--- a/lang/gnat/files/patch-af
+++ b/lang/gnat/files/patch-af
@@ -1,37 +1,19 @@
-*** gcc-2.7.2.1/ada/gnatlink.adb.orig Sun Nov 16 09:24:27 1997
---- gcc-2.7.2.1/ada/gnatlink.adb Sun Nov 16 09:25:18 1997
+*** ./ada/gnatlink.adb.orig Wed Jul 29 21:01:08 1998
+--- ./ada/gnatlink.adb Tue Sep 1 00:26:17 1998
***************
-*** 63,69 ****
+*** 73,79 ****
Table_Increment => 100,
Table_Name => "Gnatlink.Binder_Options");
-! Gcc : constant String := "gcc";
+! Gcc : String_Access := Program_Name ("gcc");
Read_Mode : constant String := "r" & Ascii.Nul;
- Write_Mode : constant String := "w" & Ascii.Nul;
---- 63,69 ----
+
+--- 73,79 ----
Table_Increment => 100,
Table_Name => "Gnatlink.Binder_Options");
-! Gcc : constant String := "adagcc";
+! Gcc : String_Access := Program_Name ("adagcc");
Read_Mode : constant String := "r" & Ascii.Nul;
- Write_Mode : constant String := "w" & Ascii.Nul;
-***************
-*** 424,430 ****
- Write_Eol;
- Write_Str (" [-v] -- verbose mode");
- Write_Eol;
-! Write_Str (" [-gnatlink name] -- full name for the linker (gcc)");
- Write_Eol;
- Write_Str (" [list of objects] -- non Ada binaries");
- Write_Eol;
---- 424,431 ----
- Write_Eol;
- Write_Str (" [-v] -- verbose mode");
- Write_Eol;
-! Write_Str (" [-gnatlink name] -- full name for the linker " &
-! "(adagcc)");
- Write_Eol;
- Write_Str (" [list of objects] -- non Ada binaries");
- Write_Eol;
+