aboutsummaryrefslogtreecommitdiffstats
path: root/lang/gnat/files
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2002-12-02 03:10:48 +0800
committerdeischen <deischen@FreeBSD.org>2002-12-02 03:10:48 +0800
commit6ccc781cd9d3afd5350f5c2ca2bd3a0093be6728 (patch)
tree0a6c95dde9e1133b206c051e8d81f7c84d89d6af /lang/gnat/files
parent1e5fe0f8d2ae6bc93e9790f1999da9cc07ccfc31 (diff)
downloadfreebsd-ports-gnome-6ccc781cd9d3afd5350f5c2ca2bd3a0093be6728.tar.gz
freebsd-ports-gnome-6ccc781cd9d3afd5350f5c2ca2bd3a0093be6728.tar.zst
freebsd-ports-gnome-6ccc781cd9d3afd5350f5c2ca2bd3a0093be6728.zip
Update to the latest released version of GNAT (3.15p). Also use a
new bootstrap compiler and fix so that it builds under -current. Approved by: portmgr
Diffstat (limited to 'lang/gnat/files')
-rw-r--r--lang/gnat/files/5fosinte.ads38
-rw-r--r--lang/gnat/files/5fsystem.ads171
-rw-r--r--lang/gnat/files/5ftaprop.adb386
-rw-r--r--lang/gnat/files/freebsd5x-patch-0115
-rw-r--r--lang/gnat/files/freebsdgcc28-patches795
-rw-r--r--lang/gnat/files/patch-ab53
-rw-r--r--lang/gnat/files/patch-ac68
-rw-r--r--lang/gnat/files/patch-ae36
-rw-r--r--lang/gnat/files/patch-ag28
-rw-r--r--lang/gnat/files/patch-ai2
-rw-r--r--lang/gnat/files/patch-aj65
-rw-r--r--lang/gnat/files/patch-am32
-rw-r--r--lang/gnat/files/patch-ao4
-rw-r--r--lang/gnat/files/patch-ap50
14 files changed, 428 insertions, 1315 deletions
diff --git a/lang/gnat/files/5fosinte.ads b/lang/gnat/files/5fosinte.ads
index 5cb6ce3c62cc..b4bb2c9853e3 100644
--- a/lang/gnat/files/5fosinte.ads
+++ b/lang/gnat/files/5fosinte.ads
@@ -152,8 +152,9 @@ package System.OS_Interface is
-- Signals --
-------------
- NSIG : constant := 32;
- type Signal is new int range 0 .. Interfaces.C."-" (NSIG, 1);
+ Max_Interrupt : constant := 31;
+ type Signal is new int range 0 .. Max_Interrupt;
+ for Signal'Size use int'Size;
-- NAMEs not used are commented-out
-- NAMEs not supported on this system have __NAME for value
@@ -210,32 +211,19 @@ package System.OS_Interface is
type sigset_t is private;
- function sigaddset
- (set : access sigset_t;
- sig : Signal)
- return int;
+ function sigaddset (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigaddset, "sigaddset");
- function sigdelset
- (set : access sigset_t;
- sig : Signal)
- return int;
+ function sigdelset (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigdelset, "sigdelset");
- function sigfillset
- (set : access sigset_t)
- return int;
+ function sigfillset (set : access sigset_t) return int;
pragma Import (C, sigfillset, "sigfillset");
- function sigismember
- (set : access sigset_t;
- sig : Signal)
- return int;
+ function sigismember (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigismember, "sigismember");
- function sigemptyset
- (set : access sigset_t)
- return int;
+ function sigemptyset (set : access sigset_t) return int;
pragma Import (C, sigemptyset, "sigemptyset");
-- sigcontext is architecture dependent, so define it private
@@ -358,6 +346,16 @@ package System.OS_Interface is
function getpid return pid_t;
pragma Import (C, getpid, "getpid");
+ ---------
+ -- LWP --
+ ---------
+
+ function lwp_self return System.Address;
+ -- lwp_self does not exist on this thread library, revert to pthread_self
+ -- which is the closest approximation (with getpid). This function is
+ -- needed to share 7staprop.adb across POSIX-like targets.
+ pragma Import (C, lwp_self, "pthread_self");
+
-------------
-- Threads --
-------------
diff --git a/lang/gnat/files/5fsystem.ads b/lang/gnat/files/5fsystem.ads
index f4c1192b1981..e7fb766e44bb 100644
--- a/lang/gnat/files/5fsystem.ads
+++ b/lang/gnat/files/5fsystem.ads
@@ -60,16 +60,16 @@ pragma Pure (System);
Max_Mantissa : constant := 63;
Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
- Tick : constant := Standard'Tick;
+ Tick : constant := 1.0;
-- Storage-related Declarations
type Address is private;
Null_Address : constant Address;
- Storage_Unit : constant := Standard'Storage_Unit;
- Word_Size : constant := Standard'Word_Size;
- Memory_Size : constant := 2 ** Standard'Address_Size;
+ Storage_Unit : constant := 8;
+ Word_Size : constant := 32;
+ Memory_Size : constant := 2 ** 32;
-- Address comparison
@@ -88,32 +88,18 @@ pragma Pure (System);
-- Other System-Dependent Declarations
type Bit_Order is (High_Order_First, Low_Order_First);
- Default_Bit_Order : constant Bit_Order :=
- Bit_Order'Val (Standard'Default_Bit_Order);
+ Default_Bit_Order : constant Bit_Order := Low_Order_First;
-- Priority-related Declarations (RM D.1)
- Max_Priority : constant Positive := 30;
-
+ Max_Priority : constant Positive := 30;
Max_Interrupt_Priority : constant Positive := 31;
- subtype Any_Priority is Integer
- range 0 .. Standard'Max_Interrupt_Priority;
-
- subtype Priority is Any_Priority
- range 0 .. Standard'Max_Priority;
-
- -- Functional notation is needed in the following to avoid visibility
- -- problems when this package is compiled through rtsfind in the middle
- -- of another compilation.
+ subtype Any_Priority is Integer range 0 .. 31;
+ subtype Priority is Any_Priority range 0 .. 30;
+ subtype Interrupt_Priority is Any_Priority range 31 .. 31;
- subtype Interrupt_Priority is Any_Priority
- range
- Standard."+" (Standard'Max_Priority, 1) ..
- Standard'Max_Interrupt_Priority;
-
- Default_Priority : constant Priority :=
- Standard."/" (Standard."+" (Priority'First, Priority'Last), 2);
+ Default_Priority : constant Priority := 15;
private
@@ -126,117 +112,28 @@ private
-- These parameters provide information about the target that is used
-- by the compiler. They are in the private part of System, where they
- -- can be accessed using Rtsfind. All values defined here must be
- -- constants, since they are accessed at compile time.
-
- -- Note these definitions must come before the definitions of any
- -- complex types or other code that may require Rtsfind to access
- -- these entities during compilation of System itself.
-
- -----------------------------------
- -- Control of Exception Handling --
- -----------------------------------
-
- -- GNAT provides two methods of implementing exceptions:
-
- -- Longjmp/Setjmp (-gnatL)
-
- -- This approach uses longjmp/setjmp to handle exceptions. It
- -- uses less storage, and can often propagate exceptions faster,
- -- at the expense of (sometimes considerable) overhead in setting
- -- up an exception handler. This approach is available on all
- -- targets, and is the default where it is the only approach.
-
- -- Zero Cost (-gnatZ)
-
- -- This approach uses separate exception tables. These use extra
- -- storage, and exception propagation can be quite slow, but there
- -- is no overhead in setting up an exception handler (it is to this
- -- latter operation that the phrase zero-cost refers). This approach
- -- is only available on some targets, and is the default where it is
- -- available.
-
- Zero_Cost_Exceptions : constant Boolean := False;
- -- Set False for Longjmp/Setjmp, True for Zero Cost
-
- -------------------------------
- -- Control of Stack Checking --
- -------------------------------
-
- -- GNAT provides two methods of implementing exceptions:
-
- -- GCC Probing Mechanism
-
- -- This approach uses the standard GCC mechanism for
- -- stack checking. The method assumes that accessing
- -- storage immediately beyond the end of the stack
- -- will result in a trap that is converted to a storage
- -- error by the runtime system. This mechanism has
- -- minimal overhead, but requires complex hardware,
- -- operating system and run-time support. Probing is
- -- the default method where it is available. The stack
- -- size for the environment task depends on the operating
- -- system and cannot be set in a system-independent way.
-
- -- GNAT Stack-limit Checking
-
- -- This method relies on comparing the stack pointer
- -- with per-task stack limits. If the check fails, an
- -- exception is explicitly raised. The advantage is
- -- that the method requires no extra system dependent
- -- runtime support and can be used on systems without
- -- memory protection as well, but at the cost of more
- -- overhead for doing the check. This method is the
- -- default on systems that lack complete support for
- -- probing.
-
- Stack_Check_Probes : constant Boolean := True;
- -- Set True for GCC Probing, False for GNAT Stack-limit Checking
-
- Stack_Check_Default : constant Boolean := True;
- -- Set True for systems where stack checking is performed by default
-
- ----------------------------------------------
- -- Boolean-Valued Floating-Point Attributes --
- ----------------------------------------------
-
- -- The constants below give the values for representation oriented
- -- floating-point attributes that are the same for all float types
- -- on the target. These are all boolean values.
-
- -- A value is only True if the target reliably supports the corresponding
- -- feature. Reliably here means that support is guaranteed for all
- -- possible settings of the relevant compiler switches (like -mieee),
- -- since we cannot control the user setting of those switches.
-
- -- The attributes cannot dependent on the current setting of compiler
- -- switches, since the values must be static and consistent throughout
- -- the partition. We probably should add such consistency checks in future,
- -- but for now we don't do this.
-
- Denorm : constant Boolean := True;
-
- Machine_Rounds : constant Boolean := True;
-
- Machine_Overflows : constant Boolean := False;
-
- Signed_Zeros : constant Boolean := True;
-
- ----------------------------
- -- Support of Long Shifts --
- ----------------------------
-
- -- In GNORT mode, we cannot call library routines, and in particular
- -- we cannot call routines for long (64-bit) shifts if such routines
- -- are required on the target. This comes up in the context of support
- -- of packed arrays. We can only represent packed arrays whose length
- -- is in the range 33- to 64-bits as modular types if long shifts are
- -- done with inline code.
-
- -- For the default version, for now we set long shifts inlined as True
- -- This may not be quite accurate, but until we get proper separate
- -- System's for each target, it is a safer choice.
-
- Long_Shifts_Inlined : constant Boolean := True;
-
+ -- can be accessed using the special circuitry in the Targparm unit
+ -- whose source should be consulted for more detailed descriptions
+ -- of the individual switch values.
+
+ AAMP : constant Boolean := False;
+ Backend_Divide_Checks : constant Boolean := False;
+ Backend_Overflow_Checks : constant Boolean := False;
+ Command_Line_Args : constant Boolean := True;
+ Denorm : constant Boolean := True;
+ Fractional_Fixed_Ops : constant Boolean := False;
+ Frontend_Layout : constant Boolean := False;
+ Functions_Return_By_DSP : constant Boolean := False;
+ Long_Shifts_Inlined : constant Boolean := True;
+ High_Integrity_Mode : constant Boolean := False;
+ Machine_Overflows : constant Boolean := False;
+ Machine_Rounds : constant Boolean := True;
+ OpenVMS : constant Boolean := False;
+ Signed_Zeros : constant Boolean := True;
+ Stack_Check_Default : constant Boolean := False;
+ Stack_Check_Probes : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := False;
+ GCC_ZCX_Support : constant Boolean := False;
+ Front_End_ZCX_Support : constant Boolean := False;
end System;
diff --git a/lang/gnat/files/5ftaprop.adb b/lang/gnat/files/5ftaprop.adb
index ff9a62ca1590..7fac4bd7801c 100644
--- a/lang/gnat/files/5ftaprop.adb
+++ b/lang/gnat/files/5ftaprop.adb
@@ -105,25 +105,31 @@ package body System.Task_Primitives.Operations is
pragma Linker_Options ("-pthread");
- ------------------
- -- Local Data --
- ------------------
+ ----------------
+ -- Local Data --
+ ----------------
-- The followings are logically constants, but need to be initialized
-- at run time.
- All_Tasks_L : aliased System.Task_Primitives.RTS_Lock;
- -- See comments on locking rules in System.Tasking (spec).
+ Single_RTS_Lock : aliased RTS_Lock;
+ -- This is a lock to allow only one thread of control in the RTS at
+ -- a time; it is used to execute in mutual exclusion from all other tasks.
+ -- Used mainly in Single_Lock mode, but also to protect All_Tasks_List
Environment_Task_ID : Task_ID;
-- A variable to hold Task_ID for the environment task.
+ Locking_Policy : Character;
+ pragma Import (C, Locking_Policy, "__gl_locking_policy");
+ -- Value of the pragma Locking_Policy:
+ -- 'C' for Ceiling_Locking
+ -- 'I' for Inherit_Locking
+ -- ' ' for none.
+
Unblocked_Signal_Mask : aliased sigset_t;
-- The set of signals that should unblocked in all tasks
- Default_Prio : Interfaces.C.int := 15;
- -- FreeBSDs default priority for a thread.
-
-- The followings are internal configuration constants needed.
Next_Serial_Number : Task_Serial_Number := 100;
@@ -133,14 +139,17 @@ package body System.Task_Primitives.Operations is
Time_Slice_Val : Integer;
pragma Import (C, Time_Slice_Val, "__gl_time_slice_val");
+ Dispatching_Policy : Character;
+ pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy");
+
+ FIFO_Within_Priorities : constant Boolean := Dispatching_Policy = 'F';
+ -- Indicates whether FIFO_Within_Priorities is set.
+
-----------------------
-- Local Subprograms --
-----------------------
- procedure Abort_Handler
- (signo : Signal;
- code : Interfaces.C.int;
- context : access struct_sigcontext);
+ procedure Abort_Handler (Sig : Signal);
function To_Task_ID is new Unchecked_Conversion (System.Address, Task_ID);
@@ -215,9 +224,7 @@ package body System.Task_Primitives.Operations is
-- end if;
procedure Abort_Handler
- (signo : Signal;
- code : Interfaces.C.int;
- context : access struct_sigcontext) is
+ (Sig : Signal) is
T : Task_ID := Self;
Result : Interfaces.C.int;
@@ -250,15 +257,13 @@ package body System.Task_Primitives.Operations is
-- Context.PC := Raise_Abort_Signal'Address;
-- return;
-- end if;
-
end Abort_Handler;
- -------------------
- -- Stack_Guard --
- -------------------
+ -----------------
+ -- Stack_Guard --
+ -----------------
procedure Stack_Guard (T : ST.Task_ID; On : Boolean) is
-
Stack_Base : constant Address := Get_Stack_Base (T.Common.LL.Thread);
Guard_Page_Address : Address;
@@ -302,7 +307,7 @@ package body System.Task_Primitives.Operations is
-- Note: mutexes and cond_variables needed per-task basis are
-- initialized in Intialize_TCB and the Storage_Error is
- -- handled. Other mutexes (such as All_Tasks_Lock, Memory_Lock...)
+ -- handled. Other mutexes (such as RTS_Lock, Memory_Lock...)
-- used in RTS is initialized before any status change of RTS.
-- Therefore rasing Storage_Error in the following routines
-- should be able to be handled safely.
@@ -313,7 +318,6 @@ package body System.Task_Primitives.Operations is
is
Attributes : aliased pthread_mutexattr_t;
Result : Interfaces.C.int;
- Adjusted_Prio : Interfaces.C.int;
begin
Result := pthread_mutexattr_init (Attributes'Access);
@@ -323,17 +327,20 @@ package body System.Task_Primitives.Operations is
raise Storage_Error;
end if;
- Result := pthread_mutexattr_setprotocol
- (Attributes'Access, PTHREAD_PRIO_PROTECT);
- pragma Assert (Result = 0);
+ if Locking_Policy = 'C' then
+ Result := pthread_mutexattr_setprotocol
+ (Attributes'Access, PTHREAD_PRIO_PROTECT);
+ pragma Assert (Result = 0);
- -- Convert the Ada priority to be based around the default
- -- system priority.
- Adjusted_Prio := Interfaces.C.int (Prio) -
- Interfaces.C.int (System.Default_Priority) + Default_Prio;
- Result := pthread_mutexattr_setprioceiling
- (Attributes'Access, Adjusted_Prio);
- pragma Assert (Result = 0);
+ Result := pthread_mutexattr_setprioceiling
+ (Attributes'Access, Interfaces.C.int (Prio));
+ pragma Assert (Result = 0);
+
+ elsif Locking_Policy = 'I' then
+ Result := pthread_mutexattr_setprotocol
+ (Attributes'Access, PTHREAD_PRIO_INHERIT);
+ pragma Assert (Result = 0);
+ end if;
Result := pthread_mutex_init (L, Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
@@ -349,7 +356,6 @@ package body System.Task_Primitives.Operations is
procedure Initialize_Lock (L : access RTS_Lock; Level : Lock_Level) is
Attributes : aliased pthread_mutexattr_t;
Result : Interfaces.C.int;
- Adjusted_Prio : Interfaces.C.int;
begin
Result := pthread_mutexattr_init (Attributes'Access);
@@ -359,22 +365,26 @@ package body System.Task_Primitives.Operations is
raise Storage_Error;
end if;
- -- Convert the Ada priority to be based around the default
- -- system priority.
- Adjusted_Prio := Interfaces.C.int (System.Any_Priority'Last) -
- Interfaces.C.int (System.Default_Priority) + Default_Prio;
- Result := pthread_mutexattr_setprotocol
- (Attributes'Access, PTHREAD_PRIO_PROTECT);
- pragma Assert (Result = 0);
+ if Locking_Policy = 'C' then
+ Result := pthread_mutexattr_setprotocol
+ (Attributes'Access, PTHREAD_PRIO_PROTECT);
+ pragma Assert (Result = 0);
- Result := pthread_mutexattr_setprioceiling
- (Attributes'Access, Adjusted_Prio);
- pragma Assert (Result = 0);
+ Result := pthread_mutexattr_setprioceiling
+ (Attributes'Access, Interfaces.C.int (System.Any_Priority'Last));
+ pragma Assert (Result = 0);
+
+ elsif Locking_Policy = 'I' then
+ Result := pthread_mutexattr_setprotocol
+ (Attributes'Access, PTHREAD_PRIO_INHERIT);
+ pragma Assert (Result = 0);
+ end if;
Result := pthread_mutex_init (L, Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
+ Result := pthread_mutexattr_destroy (Attributes'Access);
raise Storage_Error;
end if;
@@ -388,7 +398,6 @@ package body System.Task_Primitives.Operations is
procedure Finalize_Lock (L : access Lock) is
Result : Interfaces.C.int;
-
begin
Result := pthread_mutex_destroy (L);
pragma Assert (Result = 0);
@@ -396,7 +405,6 @@ package body System.Task_Primitives.Operations is
procedure Finalize_Lock (L : access RTS_Lock) is
Result : Interfaces.C.int;
-
begin
Result := pthread_mutex_destroy (L);
pragma Assert (Result = 0);
@@ -408,7 +416,6 @@ package body System.Task_Primitives.Operations is
procedure Write_Lock (L : access Lock; Ceiling_Violation : out Boolean) is
Result : Interfaces.C.int;
-
begin
Result := pthread_mutex_lock (L);
@@ -418,20 +425,24 @@ package body System.Task_Primitives.Operations is
pragma Assert (Result = 0 or else Result = EINVAL);
end Write_Lock;
- procedure Write_Lock (L : access RTS_Lock) is
+ procedure Write_Lock
+ (L : access RTS_Lock; Global_Lock : Boolean := False)
+ is
Result : Interfaces.C.int;
-
begin
- Result := pthread_mutex_lock (L);
- pragma Assert (Result = 0);
+ if not Single_Lock or else Global_Lock then
+ Result := pthread_mutex_lock (L);
+ pragma Assert (Result = 0);
+ end if;
end Write_Lock;
procedure Write_Lock (T : Task_ID) is
Result : Interfaces.C.int;
-
begin
- Result := pthread_mutex_lock (T.Common.LL.L'Access);
- pragma Assert (Result = 0);
+ if not Single_Lock then
+ Result := pthread_mutex_lock (T.Common.LL.L'Access);
+ pragma Assert (Result = 0);
+ end if;
end Write_Lock;
---------------
@@ -449,40 +460,46 @@ package body System.Task_Primitives.Operations is
procedure Unlock (L : access Lock) is
Result : Interfaces.C.int;
-
begin
Result := pthread_mutex_unlock (L);
pragma Assert (Result = 0);
end Unlock;
- procedure Unlock (L : access RTS_Lock) is
+ procedure Unlock (L : access RTS_Lock; Global_Lock : Boolean := False) is
Result : Interfaces.C.int;
-
begin
- Result := pthread_mutex_unlock (L);
- pragma Assert (Result = 0);
+ if not Single_Lock or else Global_Lock then
+ Result := pthread_mutex_unlock (L);
+ pragma Assert (Result = 0);
+ end if;
end Unlock;
procedure Unlock (T : Task_ID) is
Result : Interfaces.C.int;
-
begin
- Result := pthread_mutex_unlock (T.Common.LL.L'Access);
- pragma Assert (Result = 0);
+ if not Single_Lock then
+ Result := pthread_mutex_unlock (T.Common.LL.L'Access);
+ pragma Assert (Result = 0);
+ end if;
end Unlock;
- -------------
- -- Sleep --
- -------------
+ -----------
+ -- Sleep --
+ -----------
- procedure Sleep (Self_ID : Task_ID;
- Reason : System.Tasking.Task_States) is
+ procedure Sleep
+ (Self_ID : Task_ID;
+ Reason : System.Tasking.Task_States)
+ is
Result : Interfaces.C.int;
-
begin
- pragma Assert (Self_ID = Self);
- Result := pthread_cond_wait (Self_ID.Common.LL.CV'Access,
- Self_ID.Common.LL.L'Access);
+ if Single_Lock then
+ Result := pthread_cond_wait
+ (Self_ID.Common.LL.CV'Access, Single_RTS_Lock'Access);
+ else
+ Result := pthread_cond_wait
+ (Self_ID.Common.LL.CV'Access, Self_ID.Common.LL.L'Access);
+ end if;
-- EINTR is not considered a failure.
@@ -505,7 +522,7 @@ package body System.Task_Primitives.Operations is
Timedout : out Boolean;
Yielded : out Boolean)
is
- Check_Time : constant Duration := Clock;
+ Check_Time : constant Duration := Monotonic_Clock;
Rel_Time : Duration;
Abs_Time : Duration;
Request : aliased timespec;
@@ -541,10 +558,18 @@ package body System.Task_Primitives.Operations is
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.Common.LL.CV'Access,
- Self_ID.Common.LL.L'Access, Request'Access);
+ if Single_Lock then
+ Result := pthread_cond_timedwait
+ (Self_ID.Common.LL.CV'Access, Single_RTS_Lock'Access,
+ Request'Access);
+
+ else
+ Result := pthread_cond_timedwait
+ (Self_ID.Common.LL.CV'Access, Self_ID.Common.LL.L'Access,
+ Request'Access);
+ end if;
- exit when Abs_Time <= Clock;
+ exit when Abs_Time <= Monotonic_Clock;
if Result = 0 or Result = EINTR then
@@ -572,7 +597,7 @@ package body System.Task_Primitives.Operations is
Time : Duration;
Mode : ST.Delay_Modes)
is
- Check_Time : constant Duration := Clock;
+ Check_Time : constant Duration := Monotonic_Clock;
Abs_Time : Duration;
Rel_Time : Duration;
Request : aliased timespec;
@@ -584,6 +609,11 @@ package body System.Task_Primitives.Operations is
-- check for pending abort and priority change below! :(
SSL.Abort_Defer.all;
+
+ if Single_Lock then
+ Lock_RTS;
+ end if;
+
Write_Lock (Self_ID);
if Mode = Relative then
@@ -619,9 +649,15 @@ package body System.Task_Primitives.Operations is
exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
- Result := pthread_cond_timedwait (Self_ID.Common.LL.CV'Access,
- Self_ID.Common.LL.L'Access, Request'Access);
- exit when Abs_Time <= Clock;
+ if Single_Lock then
+ Result := pthread_cond_timedwait (Self_ID.Common.LL.CV'Access,
+ Single_RTS_Lock'Access, Request'Access);
+ else
+ Result := pthread_cond_timedwait (Self_ID.Common.LL.CV'Access,
+ Self_ID.Common.LL.L'Access, Request'Access);
+ end if;
+
+ exit when Abs_Time <= Monotonic_Clock;
pragma Assert (Result = 0
or else Result = ETIMEDOUT
@@ -632,15 +668,20 @@ package body System.Task_Primitives.Operations is
end if;
Unlock (Self_ID);
+
+ if Single_Lock then
+ Unlock_RTS;
+ end if;
+
Result := sched_yield;
SSL.Abort_Undefer.all;
end Timed_Delay;
- -----------
- -- Clock --
- -----------
+ ---------------------
+ -- Monotonic_Clock --
+ ---------------------
- function Clock return Duration is
+ function Monotonic_Clock return Duration is
TS : aliased timespec;
Result : Interfaces.C.int;
@@ -649,7 +690,7 @@ package body System.Task_Primitives.Operations is
(clock_id => CLOCK_REALTIME, tp => TS'Unchecked_Access);
pragma Assert (Result = 0);
return To_Duration (TS);
- end Clock;
+ end Monotonic_Clock;
-------------------
-- RT_Resolution --
@@ -666,7 +707,6 @@ package body System.Task_Primitives.Operations is
procedure Wakeup (T : Task_ID; Reason : System.Tasking.Task_States) is
Result : Interfaces.C.int;
-
begin
Result := pthread_cond_signal (T.Common.LL.CV'Access);
pragma Assert (Result = 0);
@@ -678,7 +718,6 @@ package body System.Task_Primitives.Operations is
procedure Yield (Do_Yield : Boolean := True) is
Result : Interfaces.C.int;
-
begin
if Do_Yield then
Result := sched_yield;
@@ -690,8 +729,8 @@ package body System.Task_Primitives.Operations is
------------------
procedure Set_Priority
- (T : Task_ID;
- Prio : System.Any_Priority;
+ (T : Task_ID;
+ Prio : System.Any_Priority;
Loss_Of_Inheritance : Boolean := False)
is
Result : Interfaces.C.int;
@@ -699,18 +738,19 @@ package body System.Task_Primitives.Operations is
begin
T.Common.Current_Priority := Prio;
-
- -- 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);
+ Param.sched_priority := Interfaces.C.int (Prio);
if Time_Slice_Supported and then Time_Slice_Val > 0 then
Result := pthread_setschedparam
(T.Common.LL.Thread, SCHED_RR, Param'Access);
- else
+
+ elsif FIFO_Within_Priorities or else Time_Slice_Val = 0 then
Result := pthread_setschedparam
(T.Common.LL.Thread, SCHED_FIFO, Param'Access);
+
+ else
+ Result := pthread_setschedparam
+ (T.Common.LL.Thread, SCHED_OTHER, Param'Access);
end if;
pragma Assert (Result = 0);
@@ -732,20 +772,21 @@ package body System.Task_Primitives.Operations is
procedure Enter_Task (Self_ID : Task_ID) is
begin
Self_ID.Common.LL.Thread := pthread_self;
+ Self_ID.Common.LL.LWP := lwp_self;
Specific.Set (Self_ID);
- Lock_All_Tasks_List;
+ Lock_RTS;
- for I in Known_Tasks'Range loop
- if Known_Tasks (I) = null then
- Known_Tasks (I) := Self_ID;
- Self_ID.Known_Tasks_Index := I;
+ for J in Known_Tasks'Range loop
+ if Known_Tasks (J) = null then
+ Known_Tasks (J) := Self_ID;
+ Self_ID.Known_Tasks_Index := J;
exit;
end if;
end loop;
- Unlock_All_Tasks_List;
+ Unlock_RTS;
end Enter_Task;
--------------
@@ -763,9 +804,8 @@ package body System.Task_Primitives.Operations is
procedure Initialize_TCB (Self_ID : Task_ID; Succeeded : out Boolean) is
Mutex_Attr : aliased pthread_mutexattr_t;
- Result : Interfaces.C.int;
- Cond_Attr : aliased pthread_condattr_t;
- Adjusted_Prio : Interfaces.C.int;
+ Result : Interfaces.C.int;
+ Cond_Attr : aliased pthread_condattr_t;
begin
-- Give the task a unique serial number.
@@ -774,66 +814,63 @@ package body System.Task_Primitives.Operations is
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);
-
- if Result /= 0 then
- Succeeded := False;
- return;
- end if;
-
- -- Convert the Ada priority to be based around the default
- -- system priority.
- Adjusted_Prio := Interfaces.C.int (System.Any_Priority'Last) -
- Interfaces.C.int (System.Default_Priority) + Default_Prio;
-
- Result := pthread_mutexattr_setprotocol
- (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
- pragma Assert (Result = 0);
+ if not Single_Lock then
+ Result := pthread_mutexattr_init (Mutex_Attr'Access);
+ pragma Assert (Result = 0 or else Result = ENOMEM);
+
+ if Result = 0 then
+ if Locking_Policy = 'C' then
+ Result := pthread_mutexattr_setprotocol
+ (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
+ pragma Assert (Result = 0);
+
+ Result := pthread_mutexattr_setprioceiling
+ (Mutex_Attr'Access,
+ Interfaces.C.int (System.Any_Priority'Last));
+ pragma Assert (Result = 0);
+
+ elsif Locking_Policy = 'I' then
+ Result := pthread_mutexattr_setprotocol
+ (Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
+ pragma Assert (Result = 0);
+ end if;
- Result := pthread_mutexattr_setprioceiling
- (Mutex_Attr'Access, Adjusted_Prio);
- pragma Assert (Result = 0);
+ Result := pthread_mutex_init (Self_ID.Common.LL.L'Access,
+ Mutex_Attr'Access);
+ pragma Assert (Result = 0 or else Result = ENOMEM);
+ end if;
- Result := pthread_mutex_init (Self_ID.Common.LL.L'Access,
- Mutex_Attr'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM);
+ if Result /= 0 then
+ Succeeded := False;
+ return;
+ end if;
- if Result /= 0 then
- Succeeded := False;
- return;
+ Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
+ pragma Assert (Result = 0);
end if;
- Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
- pragma Assert (Result = 0);
-
Result := pthread_condattr_init (Cond_Attr'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
- if Result /= 0 then
- Result := pthread_mutex_destroy (Self_ID.Common.LL.L'Access);
- pragma Assert (Result = 0);
- Succeeded := False;
- return;
+ if Result = 0 then
+ Result := pthread_cond_init (Self_ID.Common.LL.CV'Access,
+ Cond_Attr'Access);
+ pragma Assert (Result = 0 or else Result = ENOMEM);
end if;
- Result := pthread_cond_init (Self_ID.Common.LL.CV'Access,
- Cond_Attr'Access);
- pragma Assert (Result = 0 or else Result = ENOMEM);
+ if Result = 0 then
+ Succeeded := True;
+ else
+ if not Single_Lock then
+ Result := pthread_mutex_destroy (Self_ID.Common.LL.L'Access);
+ pragma Assert (Result = 0);
+ end if;
- if Result /= 0 then
- Result := pthread_condattr_destroy (Cond_Attr'Access);
- pragma Assert (Result = 0);
- Result := pthread_mutex_destroy (Self_ID.Common.LL.L'Access);
- pragma Assert (Result = 0);
Succeeded := False;
- return;
end if;
Result := pthread_condattr_destroy (Cond_Attr'Access);
pragma Assert (Result = 0);
-
- Succeeded := True;
end Initialize_TCB;
-----------------
@@ -894,18 +931,13 @@ package body System.Task_Primitives.Operations is
(Attributes'Access, Adjusted_Stack_Size);
pragma Assert (Result = 0);
- if Time_Slice_Supported and then Time_Slice_Val > 0 then
- Result := pthread_attr_setschedpolicy (Attributes'Access, SCHED_RR);
- pragma Assert (Result = 0);
- end if;
-
- if T.Task_Info /= Default_Scope then
+ if T.Common.Task_Info /= Default_Scope then
-- We are assuming that Scope_Type has the same values than the
-- corresponding C macros
Result := pthread_attr_setscope
- (Attributes'Access, Task_Info_Type'Pos (T.Task_Info));
+ (Attributes'Access, Task_Info_Type'Pos (T.Common.Task_Info));
pragma Assert (Result = 0);
end if;
@@ -932,6 +964,9 @@ package body System.Task_Primitives.Operations is
end;
end if;
+ Result := pthread_attr_destroy (Attributes'Access);
+ pragma Assert (Result = 0);
+
Set_Priority (T, Priority);
end Create_Task;
@@ -947,8 +982,10 @@ package body System.Task_Primitives.Operations is
Unchecked_Deallocation (Ada_Task_Control_Block, Task_ID);
begin
- Result := pthread_mutex_destroy (T.Common.LL.L'Access);
- pragma Assert (Result = 0);
+ if not Single_Lock then
+ Result := pthread_mutex_destroy (T.Common.LL.L'Access);
+ pragma Assert (Result = 0);
+ end if;
Result := pthread_cond_destroy (T.Common.LL.CV'Access);
pragma Assert (Result = 0);
@@ -1012,23 +1049,23 @@ package body System.Task_Primitives.Operations is
return Environment_Task_ID;
end Environment_Task;
- -------------------------
- -- Lock_All_Tasks_List --
- -------------------------
+ --------------
+ -- Lock_RTS --
+ --------------
- procedure Lock_All_Tasks_List is
+ procedure Lock_RTS is
begin
- Write_Lock (All_Tasks_L'Access);
- end Lock_All_Tasks_List;
+ Write_Lock (Single_RTS_Lock'Access, Global_Lock => True);
+ end Lock_RTS;
- ---------------------------
- -- Unlock_All_Tasks_List --
- ---------------------------
+ ----------------
+ -- Unlock_RTS --
+ ----------------
- procedure Unlock_All_Tasks_List is
+ procedure Unlock_RTS is
begin
- Unlock (All_Tasks_L'Access);
- end Unlock_All_Tasks_List;
+ Unlock (Single_RTS_Lock'Access, Global_Lock => True);
+ end Unlock_RTS;
------------------
-- Suspend_Task --
@@ -1067,7 +1104,7 @@ package body System.Task_Primitives.Operations is
-- Initialize the lock used to synchronize chain of all ATCBs.
- Initialize_Lock (All_Tasks_L'Access, All_Tasks_Level);
+ Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level);
Specific.Initialize (Environment_Task);
@@ -1094,10 +1131,6 @@ package body System.Task_Primitives.Operations is
begin
declare
Result : Interfaces.C.int;
- My_Tid : pthread_t;
- Param : aliased struct_sched_param;
- Policy : aliased Interfaces.C.int;
-
begin
-- Mask Environment task for all signals. The original mask of the
-- Environment task will be recovered by Interrupt_Server task
@@ -1117,14 +1150,5 @@ begin
pragma Assert (Result = 0);
end if;
end loop;
-
- -- Earlier versions of FreeBSDs threads libraries used a priority
- -- range of 0..126. Newer versions use POSIX priorities 0..31.
- -- Autodetect the range by looking at the current priority.
- My_Tid := pthread_self;
- if pthread_getschedparam (My_Tid, Policy'Access, Param'Access) = 0 then
- Default_Prio := Param.sched_priority;
- end if;
end;
-
end System.Task_Primitives.Operations;
diff --git a/lang/gnat/files/freebsd5x-patch-01 b/lang/gnat/files/freebsd5x-patch-01
new file mode 100644
index 000000000000..176a094fc779
--- /dev/null
+++ b/lang/gnat/files/freebsd5x-patch-01
@@ -0,0 +1,15 @@
+--- ./config/i386/freebsd.h.orig Tue Nov 26 12:56:06 2002
++++ ./config/i386/freebsd.h Tue Nov 26 12:57:30 2002
+@@ -165,10 +165,10 @@
+ "%{!shared: \
+ %{!pg: \
+ %{!pthread: %{!kthread:-lc} %{kthread:-lpthread -lc}} \
+- %{pthread:-lc_r}} \
++ %{pthread:-lc_r -lc}} \
+ %{pg: \
+ %{!pthread: %{!kthread:-lc_p} %{kthread:-lpthread_p -lc_p}} \
+- %{pthread:-lc_r_p}}}"
++ %{pthread:-lc_r_p -lc_p}}}"
+ #else
+ #define LIB_SPEC \
+ "%{!shared: \
diff --git a/lang/gnat/files/freebsdgcc28-patches b/lang/gnat/files/freebsdgcc28-patches
deleted file mode 100644
index 50b520273a14..000000000000
--- a/lang/gnat/files/freebsdgcc28-patches
+++ /dev/null
@@ -1,795 +0,0 @@
---- config/i386/freebsd.h.orig Fri Dec 5 04:15:34 1997
-+++ config/i386/freebsd.h Sun Mar 21 17:59:06 1999
-@@ -26,8 +26,18 @@
-
- /* The svr4 ABI for the i386 says that records and unions are returned
- in memory. */
-+/* On FreeBSD, we do not. */
- #undef DEFAULT_PCC_STRUCT_RETURN
--#define DEFAULT_PCC_STRUCT_RETURN 1
-+#define DEFAULT_PCC_STRUCT_RETURN 0
-+
-+/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
-+ libraries compiled with the native cc, so undef it. */
-+#undef NO_DOLLAR_IN_LABEL
-+
-+/* FreeBSD using ELF does not support DWARF2 unwinding mechanisms.
-+ Thus, need the equivalent of "-fsjlj-exceptions" (use setjmp/longjmp
-+ for exceptions). */
-+#define DWARF2_UNWIND_INFO 0
-
- /* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
-@@ -140,7 +150,7 @@
- #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
- #undef CPP_PREDEFINES
--#define CPP_PREDEFINES "-Dunix -D__ELF__ -D__FreeBSD__=2 -Asystem(FreeBSD)"
-+#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}"
---- configure.orig Sat Feb 28 18:02:02 1998
-+++ configure Mon Feb 8 11:51:44 1999
-@@ -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
-@@ -3256,20 +3278,20 @@
- # Next line turned off because both 386BSD and BSD/386 use GNU ld.
- # use_collect2=yes
- ;;
-- i[34567]86-*-freebsdelf*)
-- tm_file="i386/i386.h i386/att.h linux.h i386/freebsd-elf.h i386/perform.h"
-+ i[34567]86-*-freebsdaout*)
-+ tm_file=i386/freebsd-aout.h
- # On FreeBSD, the headers are already ok, except for math.h.
- fixincludes=fixinc.math
- tmake_file=i386/t-freebsd
-- gas=yes
-- gnu_ld=yes
-- stabs=yes
- ;;
- i[34567]86-*-freebsd*)
-- tm_file=i386/freebsd.h
-+ tm_file="i386/i386.h i386/att.h linux.h i386/freebsd.h i386/perform.h"
- # On FreeBSD, the headers are already ok, except for math.h.
- fixincludes=fixinc.math
- tmake_file=i386/t-freebsd
-+ gas=yes
-+ gnu_ld=yes
-+ stabs=yes
- ;;
- i[34567]86-*-netbsd*)
- tm_file=i386/netbsd.h
-@@ -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 Wed Mar 31 00:08:39 1999
-@@ -125,6 +125,10 @@
-
- extern int warn_aggregate_return;
-
-+/* Nonzero means that -Wformat accepts certain non-ANSI formats. */
-+
-+extern int flag_format_extensions;
-+
- /* Nonzero if generating code to do profiling. */
-
- extern int profile_flag;
-@@ -215,6 +219,20 @@
- This is generally not a win. */
-
- 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 Wed Mar 31 00:15:41 1999
-@@ -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. */
-
-@@ -691,6 +705,7 @@
- {"stack-check", &flag_stack_check, 1},
- {"bytecode", &output_bytecode, 1},
- {"check-memory-usage", &flag_check_memory_usage, 1},
-+ {"format-extensions", &flag_format_extensions, 1},
- {"prefix-function-name", &flag_prefix_function_name, 1}
- };
-
-@@ -880,6 +895,10 @@
- {"uninitialized", &warn_uninitialized, 1},
- {"inline", &warn_inline, 1}
- };
-+
-+/* Nonzero means that -Wformat accepts certain system-dependent formats. */
-+
-+int flag_format_extensions = 0;
-
- /* Output files for assembler code (real compiler output)
- and debugging dumps. */
---- 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.
---- expmed.c.dist Sat Nov 8 14:11:58 1997
-+++ expmed.c Thu Aug 13 11:18:13 1998
-@@ -2249,7 +2249,8 @@
- rtx shift_subtarget = preserve ? 0 : accum;
- rtx add_target
- = (opno == alg.ops - 1 && target != 0 && variant != add_variant
-- ? target : 0);
-+ && ! preserve)
-+ ? target : 0;
- rtx accum_target = preserve ? 0 : accum;
-
- switch (alg.op[opno])
-@@ -2716,6 +2717,7 @@
- optab optab1, optab2;
- int op1_is_constant, op1_is_pow2;
- int max_cost, extra_cost;
-+ static HOST_WIDE_INT last_div_const = 0;
-
- op1_is_constant = GET_CODE (op1) == CONST_INT;
- op1_is_pow2 = (op1_is_constant
-@@ -2825,8 +2827,15 @@
- size = GET_MODE_BITSIZE (mode);
- #endif
-
-+ /* Only deduct something for a REM if the last divide done was
-+ for a different constant. Then set the constant of the last
-+ divide. */
- max_cost = div_cost[(int) compute_mode]
-- - (rem_flag ? mul_cost[(int) compute_mode] + add_cost : 0);
-+ - (rem_flag && ! (last_div_const != 0 && op1_is_constant
-+ && INTVAL (op1) == last_div_const)
-+ ? mul_cost[(int) compute_mode] + add_cost : 0);
-+
-+ last_div_const = ! rem_flag && op1_is_constant ? INTVAL (op1) : 0;
-
- /* Now convert to the best mode to use. */
- if (compute_mode != mode)
---- configure.in.orig Sat Feb 28 12:58:12 1998
-+++ configure.in Tue Feb 9 02:24:34 1999
-@@ -303,6 +303,13 @@
- 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*-*-linux-gnuecoff*)
- tm_file="${tm_file} alpha/linux.h"
- xm_file="${xm_file} alpha/xm-linux.h"
-@@ -762,20 +769,20 @@
- # Next line turned off because both 386BSD and BSD/386 use GNU ld.
- # use_collect2=yes
- ;;
-- i[[34567]]86-*-freebsdelf*)
-- tm_file="i386/i386.h i386/att.h linux.h i386/freebsd-elf.h i386/perform.h"
-+ i[[34567]]86-*-freebsdaout*)
-+ tm_file=i386/freebsd.h
- # On FreeBSD, the headers are already ok, except for math.h.
- fixincludes=fixinc.math
- tmake_file=i386/t-freebsd
-- gas=yes
-- gnu_ld=yes
-- stabs=yes
- ;;
- i[[34567]]86-*-freebsd*)
-- tm_file=i386/freebsd.h
-+ tm_file="i386/i386.h i386/att.h linux.h i386/freebsd.h i386/perform.h"
- # On FreeBSD, the headers are already ok, except for math.h.
- fixincludes=fixinc.math
- tmake_file=i386/t-freebsd
-+ gas=yes
-+ gnu_ld=yes
-+ stabs=yes
- ;;
- i[[34567]]86-*-netbsd*)
- tm_file=i386/netbsd.h
---- c-common.c.orig Wed Feb 18 19:16:13 1998
-+++ c-common.c Tue Mar 30 14:42:30 1999
-@@ -623,6 +623,7 @@
- int format_num;
- int first_arg_num;
- int is_scan;
-+ int null_format_ok;
- tree argument;
- int arg_num;
-
-@@ -637,12 +638,26 @@
- && (!strcmp (IDENTIFIER_POINTER (format_type), "printf")
- || !strcmp (IDENTIFIER_POINTER (format_type),
- "__printf__")))
-- is_scan = 0;
-+ {
-+ is_scan = 0;
-+ null_format_ok = 0;
-+ }
-+ else if (TREE_CODE (format_type) == IDENTIFIER_NODE
-+ && (!strcmp (IDENTIFIER_POINTER (format_type), "printf0")
-+ || !strcmp (IDENTIFIER_POINTER (format_type),
-+ "__printf0__")))
-+ {
-+ is_scan = 0;
-+ null_format_ok = 1;
-+ }
- else if (TREE_CODE (format_type) == IDENTIFIER_NODE
- && (!strcmp (IDENTIFIER_POINTER (format_type), "scanf")
- || !strcmp (IDENTIFIER_POINTER (format_type),
- "__scanf__")))
-- is_scan = 1;
-+ {
-+ is_scan = 1;
-+ null_format_ok = 0;
-+ }
- else if (TREE_CODE (format_type) == IDENTIFIER_NODE)
- {
- error ("`%s' is an unrecognized format function type",
-@@ -651,7 +666,7 @@
- }
- else
- {
-- error ("unrecognized format specifier");
-+ error_with_decl (decl, "unrecognized format specifier");
- continue;
- }
-
-@@ -718,7 +733,8 @@
-
- record_function_format (DECL_NAME (decl),
- DECL_ASSEMBLER_NAME (decl),
-- is_scan, format_num, first_arg_num);
-+ is_scan, null_format_ok, format_num,
-+ first_arg_num);
- break;
- }
-
-@@ -906,6 +922,7 @@
- int pointer_count;
- /* Type of argument if no length modifier is used. */
- tree *nolen;
-+ /* EGCS has tree *hhlen -- length modifier for shortening to byte */
- /* Type of argument if length modifier for shortening is used.
- If NULL, then this modifier is not allowed. */
- tree *hlen;
-@@ -926,6 +943,11 @@
- } format_char_info;
-
- static format_char_info print_char_table[] = {
-+/* FreeBSD kernel extensions. */
-+ { "D", 1, T_C, NULL, NULL, NULL, NULL, NULL, "-wp" },
-+ { "b", 1, T_C, NULL, NULL, NULL, NULL, NULL, "-wp" },
-+ { "rz", 0, NULL, T_I, T_L, NULL, NULL, NULL, "-wp0 +#" },
-+#define unextended_print_char_table (print_char_table + 3)
- { "di", 0, T_I, T_I, T_L, T_LL, T_LL, T_ST, "-wp0 +" },
- { "oxX", 0, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, "-wp0#" },
- { "u", 0, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, "-wp0" },
-@@ -960,6 +982,7 @@
- tree name; /* identifier such as "printf" */
- tree assembler_name; /* optional mangled identifier (for C++) */
- int is_scan; /* TRUE if *scanf */
-+ int null_format_ok; /* TRUE if the format string may be NULL */
- int format_num; /* number of format argument */
- int first_arg_num; /* number of first arg (zero for varargs) */
- } function_format_info;
-@@ -991,15 +1014,15 @@
- void
- init_function_format_info ()
- {
-- record_function_format (get_identifier ("printf"), NULL_TREE, 0, 1, 2);
-- record_function_format (get_identifier ("fprintf"), NULL_TREE, 0, 2, 3);
-- record_function_format (get_identifier ("sprintf"), NULL_TREE, 0, 2, 3);
-- record_function_format (get_identifier ("scanf"), NULL_TREE, 1, 1, 2);
-- record_function_format (get_identifier ("fscanf"), NULL_TREE, 1, 2, 3);
-- record_function_format (get_identifier ("sscanf"), NULL_TREE, 1, 2, 3);
-- record_function_format (get_identifier ("vprintf"), NULL_TREE, 0, 1, 0);
-- record_function_format (get_identifier ("vfprintf"), NULL_TREE, 0, 2, 0);
-- record_function_format (get_identifier ("vsprintf"), NULL_TREE, 0, 2, 0);
-+ record_function_format (get_identifier ("printf"), NULL_TREE, 0, 0, 1, 2);
-+ record_function_format (get_identifier ("fprintf"), NULL_TREE, 0, 0, 2, 3);
-+ record_function_format (get_identifier ("sprintf"), NULL_TREE, 0, 0, 2, 3);
-+ record_function_format (get_identifier ("scanf"), NULL_TREE, 1, 0, 1, 2);
-+ record_function_format (get_identifier ("fscanf"), NULL_TREE, 1, 0, 2, 3);
-+ record_function_format (get_identifier ("sscanf"), NULL_TREE, 1, 0, 2, 3);
-+ record_function_format (get_identifier ("vprintf"), NULL_TREE, 0, 0, 1, 0);
-+ record_function_format (get_identifier ("vfprintf"), NULL_TREE, 0, 0, 2, 0);
-+ record_function_format (get_identifier ("vsprintf"), NULL_TREE, 0, 0, 2, 0);
-
- record_international_format (get_identifier ("gettext"), NULL_TREE, 1);
- record_international_format (get_identifier ("dgettext"), NULL_TREE, 2);
-@@ -1016,11 +1039,12 @@
- (e.g. for varargs such as vfprintf). */
-
- void
--record_function_format (name, assembler_name, is_scan,
-+record_function_format (name, assembler_name, is_scan, null_format_ok,
- format_num, first_arg_num)
- tree name;
- tree assembler_name;
- int is_scan;
-+ int null_format_ok;
- int format_num;
- int first_arg_num;
- {
-@@ -1044,6 +1068,7 @@
- }
-
- info->is_scan = is_scan;
-+ info->null_format_ok = null_format_ok;
- info->format_num = format_num;
- info->first_arg_num = first_arg_num;
- }
-@@ -1194,7 +1219,8 @@
-
- if (integer_zerop (format_tree))
- {
-- warning ("null format string");
-+ if (!info->null_format_ok)
-+ warning ("null format string");
- return;
- }
- if (TREE_CODE (format_tree) != ADDR_EXPR)
-@@ -1329,6 +1355,7 @@
- It will work on most machines, because size_t and int
- have the same mode. But might as well warn anyway,
- since it will fail on other machines. */
-+ /* XXX should we allow unsigned ints here? */
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
- != integer_type_node)
- &&
-@@ -1336,7 +1363,7 @@
- != unsigned_type_node))
- {
- sprintf (message,
-- "field width is not type int (arg %d)",
-+ "precision is not type int (arg %d)",
- arg_num);
- warning (message);
- }
-@@ -1371,6 +1398,7 @@
- cur_param = TREE_VALUE (params);
- params = TREE_CHAIN (params);
- ++arg_num;
-+ /* XXX should we allow unsigned ints here? */
- if (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
- != integer_type_node)
- {
-@@ -1388,6 +1416,56 @@
- }
- }
- }
-+ if (*format_chars == 'b')
-+ {
-+ /* There should be an int arg to control the string arg. */
-+ if (params == 0)
-+ {
-+ warning (tfaff);
-+ return;
-+ }
-+ if (info->first_arg_num != 0)
-+ {
-+ cur_param = TREE_VALUE (params);
-+ params = TREE_CHAIN (params);
-+ ++arg_num;
-+ if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
-+ != integer_type_node)
-+ &&
-+ (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
-+ != unsigned_type_node))
-+ {
-+ sprintf (message, "bitmap is not type int (arg %d)",
-+ arg_num);
-+ warning (message);
-+ }
-+ }
-+ }
-+ if (*format_chars == 'D')
-+ {
-+ /* There should be an unsigned char * arg before the string arg. */
-+ if (params == 0)
-+ {
-+ warning (tfaff);
-+ return;
-+ }
-+ if (info->first_arg_num != 0)
-+ {
-+ cur_param = TREE_VALUE (params);
-+ params = TREE_CHAIN (params);
-+ ++arg_num;
-+ cur_type = TREE_TYPE (cur_param);
-+ if (TREE_CODE (cur_type) != POINTER_TYPE
-+ || TYPE_MAIN_VARIANT (TREE_TYPE (cur_type))
-+ != unsigned_char_type_node)
-+ {
-+ sprintf (message,
-+ "ethernet address is not type unsigned char * (arg %d)",
-+ arg_num);
-+ warning (message);
-+ }
-+ }
-+ }
- if (*format_chars == 'h' || *format_chars == 'l')
- length_char = *format_chars++;
- else if (*format_chars == 'q' || *format_chars == 'L')
-@@ -1436,7 +1514,9 @@
- continue;
- }
- format_chars++;
-- fci = info->is_scan ? scan_char_table : print_char_table;
-+ fci = info->is_scan ? scan_char_table
-+ : flag_format_extensions ? print_char_table
-+ : unextended_print_char_table;
- while (fci->format_chars != 0
- && index (fci->format_chars, format_char) == 0)
- ++fci;
---- c-tree.h.orig Fri Aug 8 13:09:02 1997
-+++ c-tree.h Tue Mar 30 14:14:51 1999
-@@ -162,7 +162,7 @@
- extern void declare_function_name PROTO((void));
- extern void decl_attributes PROTO((tree, tree, tree));
- extern void init_function_format_info PROTO((void));
--extern void record_function_format PROTO((tree, tree, int, int, int));
-+extern void record_function_format PROTO((tree, tree, int, int, int, int));
- extern void check_function_format PROTO((tree, tree, tree));
- /* Print an error message for invalid operands to arith operation CODE.
- NOP_EXPR is used as a special case (see truthvalue_conversion). */
---- 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-ab b/lang/gnat/files/patch-ab
index 9444d3a57fbd..b0eba166ba6b 100644
--- a/lang/gnat/files/patch-ab
+++ b/lang/gnat/files/patch-ab
@@ -1,26 +1,27 @@
-*** ./config/i386/freebsd.h.orig Fri Dec 5 07:15:34 1997
---- ./config/i386/freebsd.h Fri Feb 12 21:35:52 1999
-***************
-*** 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: \
+--- config/i386/freebsd.h.orig Mon Nov 25 07:16:22 2002
++++ config/i386/freebsd.h Mon Nov 25 09:18:52 2002
+@@ -162,8 +162,13 @@
+ * -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}}"
++ "%{!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: \
+@@ -186,7 +191,7 @@
+ done. */
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
++#define LINK_SPEC "%{shared:-shared} \
+ %{!shared: \
+ %{!ibcs: \
+ %{!static: \
diff --git a/lang/gnat/files/patch-ac b/lang/gnat/files/patch-ac
index 4c6d040f1aff..470b37cc2421 100644
--- a/lang/gnat/files/patch-ac
+++ b/lang/gnat/files/patch-ac
@@ -1,37 +1,31 @@
---- ada/Makefile.in.orig Thu May 3 07:01:07 2001
-+++ ada/Makefile.in Mon Feb 4 13:15:17 2002
-@@ -1109,6 +1109,25 @@
- $(CC) -c $(CFLAGS) -gnatpg $(ADA_INCLUDES) $<
- 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-mastop.adb<5omastop.adb \
-+ s-osinte.adb<5fosinte.adb \
-+ s-osinte.ads<5fosinte.ads \
-+ s-osprim.adb<7sosprim.adb \
-+ s-taprop.adb<5ftaprop.adb \
-+ s-taspri.ads<7staspri.ads \
-+ s-tpopsp.adb<7stpopsp.adb \
-+ system.ads<5fsystem.ads
-+
-+ SHARED_MAJOR = 1
-+ soext = .so.$(SHARED_MAJOR)
-+ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
-+endif
-+
- ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),)
- ifeq ($(strip $(filter-out mips sgi irix6%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
-@@ -1997,7 +2016,7 @@
- $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) $(misclib) -lm
- cd rts; ../../xgcc -B../../ -shared $(TARGET_LIBGCC2_CFLAGS) \
- -o libgnarl-$(LIBRARY_VERSION)$(soext) $(SO_OPTS)libgnarl-$(LIBRARY_VERSION)$(soext) \
-- $(GNATRTL_TASKING_OBJS) -l$(threadslib)
-+ $(GNATRTL_TASKING_OBJS) $(threadslib)
- cd rts; $(LN) libgnat-$(LIBRARY_VERSION)$(soext) libgnat$(soext)
- cd rts; $(LN) libgnarl-$(LIBRARY_VERSION)$(soext) libgnarl$(soext)
-
+*** ada/Makefile.in.orig Thu Oct 24 04:02:15 2002
+--- ada/Makefile.in Fri Nov 22 09:12:11 2002
+***************
+*** 820,825 ****
+--- 820,845 ----
+ 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-mastop.adb<5omastop.adb \
++ s-osinte.adb<5fosinte.adb \
++ s-osinte.ads<5fosinte.ads \
++ s-osprim.adb<7sosprim.adb \
++ s-taprop.adb<5ftaprop.adb \
++ s-taspri.ads<7staspri.ads \
++ s-tpopsp.adb<7stpopsp.adb \
++ system.ads<5fsystem.ads
++
++ SHARED_MAJOR = 1
++ soext = .so.$(SHARED_MAJOR)
++ THREADSLIB=-pthread
++ LIBRARY_VERSION := $(strip $(shell grep Library_Version $(fsrcpfx)gnatvsn.ads | sed -e 's/.*GNAT Lib v\(.*\)[ "].*/\1/'))
++ endif
++
+ ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),)
+ ifeq ($(strip $(filter-out mips sgi irix6%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = \
diff --git a/lang/gnat/files/patch-ae b/lang/gnat/files/patch-ae
index ab87807bb760..728b752cddf4 100644
--- a/lang/gnat/files/patch-ae
+++ b/lang/gnat/files/patch-ae
@@ -1,19 +1,19 @@
-*** ./ada/gnatcmd.adb.orig Fri Sep 24 08:41:33 1999
---- ./ada/gnatcmd.adb Tue Nov 2 02:44:41 1999
+*** ./ada/gnatcmd.adb.orig Thu Oct 24 04:02:18 2002
+--- ./ada/gnatcmd.adb Fri Nov 22 09:16:30 2002
***************
-*** 1173,1179 ****
-
- (Cname => new S'("COMPILE"),
- Usage => new S'("GNAT COMPILE filespec[,...] /qualifiers"),
-! Unixcmd => new S'("gcc -c -x ada"),
- Switches => GCC_Switches'Access,
- Params => new Parameter_Array'(1 => FILES_OR_WILDCARD),
- Defext => " "),
---- 1173,1179 ----
-
- (Cname => new S'("COMPILE"),
- Usage => new S'("GNAT COMPILE filespec[,...] /qualifiers"),
-! Unixcmd => new S'("adagcc -c -x ada"),
- Switches => GCC_Switches'Access,
- Params => new Parameter_Array'(1 => FILES_OR_WILDCARD),
- Defext => " "),
+*** 2530,2536 ****
+ Usage => new S'("GNAT SHARED [obj_&_lib_&_exe_&_opt"
+ & "files] /qualifiers"),
+ VMS_Only => True,
+! Unixcmd => new S'("gcc"),
+ Unixsws => new Argument_List'(new String'("-shared")
+ & Init_Object_Dirs),
+ Switches => Shared_Switches'Access,
+--- 2530,2536 ----
+ Usage => new S'("GNAT SHARED [obj_&_lib_&_exe_&_opt"
+ & "files] /qualifiers"),
+ VMS_Only => True,
+! Unixcmd => new S'("adagcc"),
+ Unixsws => new Argument_List'(new String'("-shared")
+ & Init_Object_Dirs),
+ Switches => Shared_Switches'Access,
diff --git a/lang/gnat/files/patch-ag b/lang/gnat/files/patch-ag
index 8cd40a65c1e8..4bc89fcccd5c 100644
--- a/lang/gnat/files/patch-ag
+++ b/lang/gnat/files/patch-ag
@@ -1,19 +1,19 @@
-*** ./ada/gnatchop.adb.orig Fri Sep 24 08:42:44 1999
---- ./ada/gnatchop.adb Tue Nov 2 02:43:44 1999
+*** ./ada/gnatchop.adb.orig Thu Oct 24 04:02:18 2002
+--- ./ada/gnatchop.adb Fri Nov 22 09:18:03 2002
***************
-*** 1575,1581 ****
- begin
- -- Check presence of required executables
+*** 49,55 ****
+ Config_File_Name : constant String_Access := new String'("gnat.adc");
+ -- The name of the file holding the GNAT configuration pragmas
-! Gnat_Cmd := Locate_Executable ("gcc");
+! Gcc : String_Access := new String'("gcc");
+ -- May be modified by switch --GCC=
- if Gnat_Cmd = null then
- goto No_Files_Written;
---- 1575,1581 ----
- begin
- -- Check presence of required executables
+ Gcc_Set : Boolean := False;
+--- 49,55 ----
+ Config_File_Name : constant String_Access := new String'("gnat.adc");
+ -- The name of the file holding the GNAT configuration pragmas
-! Gnat_Cmd := Locate_Executable ("adagcc");
+! Gcc : String_Access := new String'("adagcc");
+ -- May be modified by switch --GCC=
- if Gnat_Cmd = null then
- goto No_Files_Written;
+ Gcc_Set : Boolean := False;
diff --git a/lang/gnat/files/patch-ai b/lang/gnat/files/patch-ai
index ff080cda20fe..4f9c35e206c3 100644
--- a/lang/gnat/files/patch-ai
+++ b/lang/gnat/files/patch-ai
@@ -54,7 +54,7 @@
+ Raise_From_Signal_Handler (exception, msg);
+ }
+
-+ static void
++ void
+ __gnat_install_handler ()
+ {
+ struct sigaction act;
diff --git a/lang/gnat/files/patch-aj b/lang/gnat/files/patch-aj
index 27861217e09f..564a9ec5cce5 100644
--- a/lang/gnat/files/patch-aj
+++ b/lang/gnat/files/patch-aj
@@ -1,53 +1,54 @@
-*** ada/a-sysdep.c.orig Wed Jul 19 15:09:47 2000
---- ada/a-sysdep.c Fri Oct 13 08:58:43 2000
+*** ada/a-sysdep.c.orig Thu Oct 24 04:02:16 2002
+--- ada/a-sysdep.c Fri Nov 22 09:24:51 2002
***************
-*** 236,242 ****
-
+*** 286,292 ****
#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
|| (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \
-! || defined (__MACHTEN__)
+ || defined (__MACHTEN__) || defined (hpux) || defined (_AIX) \
+! || (defined (__svr4__) && defined (i386)) || defined (__Lynx__)
#include <termios.h>
- #include <fcntl.h>
#elif defined (VMS)
---- 236,242 ----
-
+ extern char *decc$ga_stdscr;
+--- 286,293 ----
#if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
|| (defined (__osf__) && ! defined (__alpha_vxworks)) || defined (WINNT) \
-! || defined (__MACHTEN__) || defined (__FreeBSD__)
+ || defined (__MACHTEN__) || defined (hpux) || defined (_AIX) \
+! || (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \
+! || defined (__FreeBSD__)
#include <termios.h>
- #include <fcntl.h>
#elif defined (VMS)
+ extern char *decc$ga_stdscr;
***************
-*** 286,292 ****
- {
- #if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
+*** 336,342 ****
|| (defined (__osf__) && ! defined (__alpha_vxworks)) \
-! || defined (__CYGWIN32__) || defined (__MACHTEN__)
+ || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (hpux) \
+ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
+! || defined (__Lynx__)
char c;
int nread;
int good_one = 0;
---- 286,292 ----
- {
- #if defined (linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
+--- 337,343 ----
|| (defined (__osf__) && ! defined (__alpha_vxworks)) \
-! || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__FreeBSD__)
+ || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (hpux) \
+ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
+! || defined (__Lynx__) || defined (__FreeBSD__)
char c;
int nread;
int good_one = 0;
***************
-*** 303,309 ****
- /* Set RAW mode */
- termios_rec.c_lflag = termios_rec.c_lflag & ~ICANON;
- #if defined(sgi) || defined (sun) || defined (__EMX__) || defined (__osf__) \
-! || defined (linux) || defined (__MACHTEN__)
- eof_ch = termios_rec.c_cc[VEOF];
+*** 355,361 ****
+ #if defined(linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
+ || defined (__osf__) || defined (__MACHTEN__) || defined (hpux) \
+ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
+! || defined (__Lynx__)
+ eof_ch = termios_rec.c_cc[VEOF];
- /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
---- 303,309 ----
- /* Set RAW mode */
- termios_rec.c_lflag = termios_rec.c_lflag & ~ICANON;
- #if defined(sgi) || defined (sun) || defined (__EMX__) || defined (__osf__) \
-! || defined (linux) || defined (__MACHTEN__) || defined (__FreeBSD__)
- eof_ch = termios_rec.c_cc[VEOF];
+ /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
+--- 356,362 ----
+ #if defined(linux) || defined (sun) || defined (sgi) || defined (__EMX__) \
+ || defined (__osf__) || defined (__MACHTEN__) || defined (hpux) \
+ || defined (_AIX) || (defined (__svr4__) && defined (i386)) \
+! || defined (__Lynx__) || defined (__FreeBSD__)
+ eof_ch = termios_rec.c_cc[VEOF];
- /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
+ /* If waiting (i.e. Get_Immediate (Char)), set MIN = 1 and wait for
diff --git a/lang/gnat/files/patch-am b/lang/gnat/files/patch-am
deleted file mode 100644
index ae8b2a9db558..000000000000
--- a/lang/gnat/files/patch-am
+++ /dev/null
@@ -1,32 +0,0 @@
---- ada/g-os_lib.adb.orig Fri Feb 1 23:18:26 2002
-+++ ada/g-os_lib.adb Fri Feb 1 23:22:08 2002
-@@ -192,26 +192,13 @@
- (FD : out File_Descriptor;
- Name : out Temp_File_Name)
- is
-- function Get_Temp_Name (T : Address) return Address;
-- pragma Import (C, Get_Temp_Name, "mktemp");
--
-- function Open_New_Temp
-- (Name : System.Address;
-- Fmode : Mode)
-- return File_Descriptor;
-- pragma Import (C, Open_New_Temp, "open_new_temp");
-+ function Open_New_Temp (T : Address) return File_Descriptor;
-+ pragma Import (C, Open_New_Temp, "mkstemp");
-
- begin
- Name (1 .. Temp_File_Len - 1) := "GNAT-XXXXXX";
- Name (Temp_File_Len) := ASCII.NUL;
--
-- -- Check for NULL pointer returned by C
--
-- if Get_Temp_Name (Name'Address) = Null_Address then
-- FD := -1;
-- else
-- FD := Open_New_Temp (Name'Address, Binary);
-- end if;
-+ FD := Open_New_Temp (Name'Address);
- end Create_Temp_File;
-
- -----------------
diff --git a/lang/gnat/files/patch-ao b/lang/gnat/files/patch-ao
index 5ad4ff0b5afe..3391b525a05e 100644
--- a/lang/gnat/files/patch-ao
+++ b/lang/gnat/files/patch-ao
@@ -1,5 +1,5 @@
---- ../gnat-3.14p-src/examples/Makefile Tue Jan 30 18:00:05 2001
-+++ ../gnat-3.14p-src/examples/Makefile.new Mon Feb 4 15:01:55 2002
+--- ../gnat-3.15p-src/examples/Makefile Tue Jan 30 18:00:05 2001
++++ ../gnat-3.15p-src/examples/Makefile.new Mon Feb 4 15:01:55 2002
@@ -6,10 +6,10 @@
CC = gcc
diff --git a/lang/gnat/files/patch-ap b/lang/gnat/files/patch-ap
index aa61a67799b7..9474e433c9ef 100644
--- a/lang/gnat/files/patch-ap
+++ b/lang/gnat/files/patch-ap
@@ -1,20 +1,30 @@
---- ada/a-adaint.c.orig Tue Feb 12 17:24:15 2002
-+++ ada/a-adaint.c Tue Feb 12 17:21:56 2002
-@@ -590,6 +590,17 @@
- strcpy (tmp_filename, pname);
- free (pname);
- }
-+#elif defined (__FreeBSD__)
-+ {
-+ int fd;
-+
-+ strcpy (tmp_filename, "/tmp/gnat-XXXXXX");
-+ fd = mkstemp (tmp_filename);
-+ if (fd < 0)
-+ strcpy (tmp_filename, "");
-+ else
-+ close (fd);
-+ }
- #else
- tmpnam (tmp_filename);
- #endif
+*** ada/a-adaint.c.orig Thu Oct 24 04:02:15 2002
+--- ada/a-adaint.c Fri Nov 22 09:53:21 2002
+***************
+*** 605,610 ****
+--- 605,612 ----
+
+ #if defined (linux) && !defined (__vxworks)
+ return mkstemp (path);
++ #elif defined (__FreeBSD__)
++ return mkstemp (path);
+ #elif defined (__Lynx__)
+ mktemp (path);
+ #else
+***************
+*** 673,679 ****
+
+ free (pname);
+ }
+! #elif defined (linux)
+ char *tmpdir = getenv ("TMPDIR");
+
+ if (tmpdir == NULL)
+--- 675,681 ----
+
+ free (pname);
+ }
+! #elif defined (linux) || defined (__FreeBSD__)
+ char *tmpdir = getenv ("TMPDIR");
+
+ if (tmpdir == NULL)