~ubuntu-branches/debian/sid/gcc-4.8/sid

« back to all changes in this revision

Viewing changes to .svn/pristine/b6/b63e048c5deffe1fe08113474b559e7b969c7734.svn-base

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-12-19 19:48:34 UTC
  • Revision ID: package-import@ubuntu.com-20141219194834-4dz1q7rrn5pad823
Tags: 4.8.4-1
* GCC 4.8.4 release.
  - Fix PR target/61407 (darwin), PR middle-end/58624 (ice),
    PR sanitizer/64265 (wrong code).
* Require recent binutils to pass go test failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: add support for GNU/kFreeBSD.
 
2
 
 
3
Index: b/src/gcc/ada/terminals.c
 
4
===================================================================
 
5
--- a/src/gcc/ada/terminals.c
 
6
+++ b/src/gcc/ada/terminals.c
 
7
@@ -987,6 +987,7 @@ __gnat_setup_winsize (void *desc, int ro
 
8
 /* On some system termio is either absent or including it will disable termios
 
9
    (HP-UX) */
 
10
 #if ! defined (__hpux__) && ! defined (FREEBSD) && \
 
11
+    ! defined (__FreeBSD_kernel__) && \
 
12
     ! defined (__APPLE__) && ! defined(__rtems__)
 
13
 #   include <termio.h>
 
14
 #endif
 
15
Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.adb
 
16
===================================================================
 
17
--- /dev/null
 
18
+++ b/src/gcc/ada/s-osinte-kfreebsd-gnu.adb
 
19
@@ -0,0 +1,158 @@
 
20
+------------------------------------------------------------------------------
 
21
+--                                                                          --
 
22
+--                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
 
23
+--                                                                          --
 
24
+--                   S Y S T E M . O S _ I N T E R F A C E                  --
 
25
+--                                                                          --
 
26
+--                                   B o d y                                --
 
27
+--                                                                          --
 
28
+--             Copyright (C) 1991-1994, Florida State University            --
 
29
+--                     Copyright (C) 1995-2006, AdaCore                     --
 
30
+--                                                                          --
 
31
+-- GNARL is free software; you can  redistribute it  and/or modify it under --
 
32
+-- terms of the  GNU General Public License as published  by the Free Soft- --
 
33
+-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
 
34
+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
 
35
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
 
36
+-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 
37
+-- for  more details.  You should have  received  a copy of the GNU General --
 
38
+-- Public License  distributed with GNARL; see file COPYING.  If not, write --
 
39
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
 
40
+-- Boston, MA 02110-1301, USA.                                              --
 
41
+--                                                                          --
 
42
+-- As a special exception,  if other files  instantiate  generics from this --
 
43
+-- unit, or you link  this unit with other files  to produce an executable, --
 
44
+-- this  unit  does not  by itself cause  the resulting  executable  to  be --
 
45
+-- covered  by the  GNU  General  Public  License.  This exception does not --
 
46
+-- however invalidate  any other reasons why  the executable file  might be --
 
47
+-- covered by the  GNU Public License.                                      --
 
48
+--                                                                          --
 
49
+-- GNARL was developed by the GNARL team at Florida State University.       --
 
50
+-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
 
51
+--                                                                          --
 
52
+------------------------------------------------------------------------------
 
53
+
 
54
+--  This is the GNU/kFreeBSD version of this package.
 
55
+
 
56
+pragma Polling (Off);
 
57
+--  Turn off polling, we do not want ATC polling to take place during
 
58
+--  tasking operations. It causes infinite loops and other problems.
 
59
+
 
60
+--  This package encapsulates all direct interfaces to OS services
 
61
+--  that are needed by children of System.
 
62
+
 
63
+package body System.OS_Interface is
 
64
+
 
65
+   --------------------
 
66
+   -- Get_Stack_Base --
 
67
+   --------------------
 
68
+
 
69
+   function Get_Stack_Base (thread : pthread_t) return Address is
 
70
+      pragma Warnings (Off, thread);
 
71
+
 
72
+   begin
 
73
+      return Null_Address;
 
74
+   end Get_Stack_Base;
 
75
+
 
76
+   ------------------
 
77
+   -- pthread_init --
 
78
+   ------------------
 
79
+
 
80
+   procedure pthread_init is
 
81
+   begin
 
82
+      null;
 
83
+   end pthread_init;
 
84
+
 
85
+   -----------------------------------
 
86
+   -- pthread_mutexattr_setprotocol --
 
87
+   -----------------------------------
 
88
+
 
89
+   function pthread_mutexattr_setprotocol
 
90
+     (attr     : access pthread_mutexattr_t;
 
91
+      protocol : int) return int is
 
92
+      pragma Unreferenced (attr, protocol);
 
93
+   begin
 
94
+      return 0;
 
95
+   end pthread_mutexattr_setprotocol;
 
96
+
 
97
+   -----------------------------------
 
98
+   -- pthread_mutexattr_getprotocol --
 
99
+   -----------------------------------
 
100
+
 
101
+   function pthread_mutexattr_getprotocol
 
102
+     (attr     : access pthread_mutexattr_t;
 
103
+      protocol : access int) return int is
 
104
+      pragma Unreferenced (attr, protocol);
 
105
+   begin
 
106
+      return 0;
 
107
+   end pthread_mutexattr_getprotocol;
 
108
+
 
109
+   --------------------------------------
 
110
+   -- pthread_mutexattr_setprioceiling --
 
111
+   --------------------------------------
 
112
+
 
113
+   function pthread_mutexattr_setprioceiling
 
114
+     (attr     : access pthread_mutexattr_t;
 
115
+      prioceiling : int) return int is
 
116
+      pragma Unreferenced (attr, prioceiling);
 
117
+   begin
 
118
+      return 0;
 
119
+   end pthread_mutexattr_setprioceiling;
 
120
+
 
121
+   --------------------------------------
 
122
+   -- pthread_mutexattr_getprioceiling --
 
123
+   --------------------------------------
 
124
+
 
125
+   function pthread_mutexattr_getprioceiling
 
126
+     (attr     : access pthread_mutexattr_t;
 
127
+      prioceiling : access int) return int is
 
128
+      pragma Unreferenced (attr, prioceiling);
 
129
+   begin
 
130
+      return 0;
 
131
+   end pthread_mutexattr_getprioceiling;
 
132
+
 
133
+   -----------------
 
134
+   -- To_Duration --
 
135
+   -----------------
 
136
+
 
137
+   function To_Duration (TS : timespec) return Duration is
 
138
+   begin
 
139
+      return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
 
140
+   end To_Duration;
 
141
+
 
142
+   ------------------------
 
143
+   -- To_Target_Priority --
 
144
+   ------------------------
 
145
+
 
146
+   function To_Target_Priority
 
147
+     (Prio : System.Any_Priority) return Interfaces.C.int
 
148
+   is
 
149
+   begin
 
150
+      return Interfaces.C.int (Prio);
 
151
+   end To_Target_Priority;
 
152
+
 
153
+   -----------------
 
154
+   -- To_Timespec --
 
155
+   -----------------
 
156
+
 
157
+   function To_Timespec (D : Duration) return timespec is
 
158
+      S : time_t;
 
159
+      F : Duration;
 
160
+
 
161
+   begin
 
162
+      S := time_t (Long_Long_Integer (D));
 
163
+      F := D - Duration (S);
 
164
+
 
165
+      --  If F has negative value due to a round-up, adjust for positive F
 
166
+      --  value.
 
167
+
 
168
+      if F < 0.0 then
 
169
+         S := S - 1;
 
170
+         F := F + 1.0;
 
171
+      end if;
 
172
+
 
173
+      return timespec'(tv_sec => S,
 
174
+                       tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
 
175
+   end To_Timespec;
 
176
+
 
177
+end System.OS_Interface;
 
178
Index: b/src/gcc/ada/gcc-interface/Makefile.in
 
179
===================================================================
 
180
--- a/src/gcc/ada/gcc-interface/Makefile.in
 
181
+++ b/src/gcc/ada/gcc-interface/Makefile.in
 
182
@@ -1221,7 +1221,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%
 
183
   a-intnam.ads<a-intnam-freebsd.ads \
 
184
   s-inmaop.adb<s-inmaop-posix.adb \
 
185
   s-intman.adb<s-intman-posix.adb \
 
186
-  s-osinte.adb<s-osinte-posix.adb \
 
187
+  s-osinte.adb<s-osinte-kfreebsd-gnu.adb \
 
188
   s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
 
189
   s-osprim.adb<s-osprim-posix.adb \
 
190
   s-taprop.adb<s-taprop-posix.adb \
 
191
@@ -1252,7 +1252,7 @@ ifeq ($(strip $(filter-out x86_64 kfreeb
 
192
   a-numaux.ads<a-numaux-x86.ads \
 
193
   s-inmaop.adb<s-inmaop-posix.adb \
 
194
   s-intman.adb<s-intman-posix.adb \
 
195
-  s-osinte.adb<s-osinte-posix.adb \
 
196
+  s-osinte.adb<s-osinte-kfreebsd-gnu.adb \
 
197
   s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
 
198
   s-osprim.adb<s-osprim-posix.adb \
 
199
   s-taprop.adb<s-taprop-posix.adb \
 
200
Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
 
201
===================================================================
 
202
--- a/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
 
203
+++ b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads
 
204
@@ -45,6 +45,7 @@ package System.OS_Interface is
 
205
    pragma Preelaborate;
 
206
 
 
207
    pragma Linker_Options ("-lpthread");
 
208
+   pragma Linker_Options ("-lrt");
 
209
 
 
210
    subtype int            is Interfaces.C.int;
 
211
    subtype char           is Interfaces.C.char;
 
212
@@ -206,9 +207,7 @@ package System.OS_Interface is
 
213
    function nanosleep (rqtp, rmtp : access timespec) return int;
 
214
    pragma Import (C, nanosleep, "nanosleep");
 
215
 
 
216
-   type clockid_t is private;
 
217
-
 
218
-   CLOCK_REALTIME : constant clockid_t;
 
219
+   type clockid_t is new int;
 
220
 
 
221
    function clock_gettime
 
222
      (clock_id : clockid_t;
 
223
@@ -252,6 +251,16 @@ package System.OS_Interface is
 
224
    function getpid return pid_t;
 
225
    pragma Import (C, getpid, "getpid");
 
226
 
 
227
+   ---------
 
228
+   -- LWP --
 
229
+   ---------
 
230
+
 
231
+   function lwp_self return System.Address;
 
232
+   --  lwp_self does not exist on this thread library, revert to pthread_self
 
233
+   --  which is the closest approximation (with getpid). This function is
 
234
+   --  needed to share 7staprop.adb across POSIX-like targets.
 
235
+   pragma Import (C, lwp_self, "pthread_self");
 
236
+
 
237
    -------------
 
238
    -- Threads --
 
239
    -------------
 
240
@@ -282,6 +291,14 @@ package System.OS_Interface is
 
241
    PTHREAD_SCOPE_PROCESS : constant := 0;
 
242
    PTHREAD_SCOPE_SYSTEM  : constant := 2;
 
243
 
 
244
+   --  Read/Write lock not supported on freebsd. To add support both types
 
245
+   --  pthread_rwlock_t and pthread_rwlockattr_t must properly be defined
 
246
+   --  with the associated routines pthread_rwlock_[init/destroy] and
 
247
+   --  pthread_rwlock_[rdlock/wrlock/unlock].
 
248
+
 
249
+   subtype pthread_rwlock_t     is pthread_mutex_t;
 
250
+   subtype pthread_rwlockattr_t is pthread_mutexattr_t;
 
251
+
 
252
    -----------
 
253
    -- Stack --
 
254
    -----------
 
255
@@ -419,31 +436,25 @@ package System.OS_Interface is
 
256
    PTHREAD_PRIO_PROTECT : constant := 2;
 
257
    PTHREAD_PRIO_INHERIT : constant := 1;
 
258
 
 
259
+   --  GNU/kFreeBSD does not support Thread Priority Protection or Thread
 
260
+   --  Priority Inheritance and lacks some pthread_mutexattr_* functions.
 
261
+   --  Replace them with dummy versions.
 
262
+
 
263
    function pthread_mutexattr_setprotocol
 
264
      (attr     : access pthread_mutexattr_t;
 
265
       protocol : int) return int;
 
266
-   pragma Import
 
267
-      (C, pthread_mutexattr_setprotocol, "pthread_mutexattr_setprotocol");
 
268
 
 
269
    function pthread_mutexattr_getprotocol
 
270
      (attr     : access pthread_mutexattr_t;
 
271
       protocol : access int) return int;
 
272
-   pragma Import
 
273
-     (C, pthread_mutexattr_getprotocol, "pthread_mutexattr_getprotocol");
 
274
 
 
275
    function pthread_mutexattr_setprioceiling
 
276
      (attr     : access pthread_mutexattr_t;
 
277
       prioceiling : int) return int;
 
278
-   pragma Import
 
279
-     (C, pthread_mutexattr_setprioceiling,
 
280
-      "pthread_mutexattr_setprioceiling");
 
281
 
 
282
    function pthread_mutexattr_getprioceiling
 
283
      (attr     : access pthread_mutexattr_t;
 
284
       prioceiling : access int) return int;
 
285
-   pragma Import
 
286
-     (C, pthread_mutexattr_getprioceiling,
 
287
-      "pthread_mutexattr_getprioceiling");
 
288
 
 
289
    type struct_sched_param is record
 
290
       sched_priority : int;  --  scheduling priority
 
291
@@ -570,8 +581,8 @@ private
 
292
    --  #define sa_handler __sigaction_u._handler
 
293
    --  #define sa_sigaction __sigaction_u._sigaction
 
294
 
 
295
-   --  Should we add a signal_context type here ?
 
296
-   --  How could it be done independent of the CPU architecture ?
 
297
+   --  Should we add a signal_context type here ???
 
298
+   --  How could it be done independent of the CPU architecture ???
 
299
    --  sigcontext type is opaque, so it is architecturally neutral.
 
300
    --  It is always passed as an access type, so define it as an empty record
 
301
    --  since the contents are not used anywhere.
 
302
@@ -588,9 +599,6 @@ private
 
303
    end record;
 
304
    pragma Convention (C, timespec);
 
305
 
 
306
-   type clockid_t is new int;
 
307
-   CLOCK_REALTIME : constant clockid_t := 0;
 
308
-
 
309
    type pthread_attr_t is record
 
310
       detachstate   : int;
 
311
       schedpolicy   : int;
 
312
Index: b/src/gcc/ada/gsocket.h
 
313
===================================================================
 
314
--- a/src/gcc/ada/gsocket.h
 
315
+++ b/src/gcc/ada/gsocket.h
 
316
@@ -231,7 +231,7 @@
 
317
 # endif
 
318
 #endif
 
319
 
 
320
-#if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__)
 
321
+#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__vxworks) || defined(__rtems__) || defined(__GNU__)
 
322
 # define Has_Sockaddr_Len 1
 
323
 #else
 
324
 # define Has_Sockaddr_Len 0
 
325
Index: b/src/gcc/ada/s-oscons-tmplt.c
 
326
===================================================================
 
327
--- a/src/gcc/ada/s-oscons-tmplt.c
 
328
+++ b/src/gcc/ada/s-oscons-tmplt.c
 
329
@@ -1414,7 +1414,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU
 
330
 /* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */
 
331
 # define CLOCK_RT_Ada "-1"
 
332
 
 
333
-#elif defined(__FreeBSD__) || defined(_AIX)
 
334
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(_AIX)
 
335
 /** On these platforms use system provided monotonic clock instead of
 
336
  ** the default CLOCK_REALTIME. We then need to set up cond var attributes
 
337
  ** appropriately (see thread.c).