Ravenports generated: 11 Oct 2017 17:12
[ravenports.git] / bucket_30 / gnatcross
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               gnatcross
4 VERSION=                7.2.0
5 KEYWORDS=               lang
6 VARIANTS=               FARM64_R11
7 SDESC[FARM64_R11]=      C/Ada cross-compiler, target: FreeBSD/ARM64 (R11)
8 HOMEPAGE=               http://www.dragonlace.net
9 CONTACT=                John_Marino[draco@marino.st]
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            GCC/releases/gcc-7.2.0
13 DISTFILE[1]=            gcc-7.2.0.tar.xz:main
14 DF_INDEX=               1
15 SPKGS[FARM64_R11]=      single
16
17 OPTIONS_AVAILABLE=      FARM64R11
18 OPTIONS_STANDARD=       none
19 VOPTS[FARM64_R11]=      FARM64R11=ON
20
21 BUILD_DEPENDS=          gmp:static:standard
22                         mpfr:static:standard
23                         mpc:static:standard
24                         zlib:static:standard
25                         libiconv:static:standard
26
27 USES=                   gmake libtool perl:build
28
29 DISTNAME=               gcc-7.2.0
30
31 LICENSE=                GPLv2+:single LGPL21:single GPLv3+:single
32                         LGPL3:single GPLv3RLE:single
33 LICENSE_SCHEME=         multi
34 LICENSE_FILE=           GPLv2+:{{WRKSRC}}/COPYING
35                         LGPL21:{{WRKSRC}}/COPYING.LIB
36                         GPLv3+:{{WRKSRC}}/COPYING3
37                         LGPL3:{{WRKSRC}}/COPYING3.LIB
38                         GPLv3RLE:{{WRKSRC}}/COPYING.RUNTIME
39
40 MUST_CONFIGURE=         yes
41 CONFIGURE_OUTSOURCE=    yes
42 CONFIGURE_ARGS=         --enable-languages="c c++ ada fortran"
43                         --target={{XCCTARGET}}
44                         --program-prefix={{XCCTARGET}}-
45                         --prefix={{PREFIX}}
46                         --with-sysroot={{SRPREFIX}}
47                         --with-system-zlib
48                         --with-gmp={{LOCALBASE}}
49                         --with-mpfr={{LOCALBASE}}
50                         --with-mpc={{LOCALBASE}}
51                         --with-iconv={{LOCALBASE}}
52                         --enable-threads=posix
53                         --enable-checking=release
54                         --disable-bootstrap
55                         --disable-shared
56                         --disable-libssp
57                         --disable-libgomp
58                         --disable-libquadmath
59                         --disable-libsanitizer
60                         --disable-libitm
61                         --disable-libcc1
62                         --disable-nls
63                         {{TARGET_SPECIFIC}}
64
65 PLIST_SUB=              GCCVERS="7.2.0"
66                         TARGET="{{XCCTARGET}}"
67 SUB_FILES=              pkg-message-single
68 SUB_LIST=               TARGET="{{XCCTARGET}}"
69
70 [FARM64R11].DESCRIPTION=                Set target to FreeBSD/ARM64 (Release 11)
71 [FARM64R11].BUILDRUN_DEPENDS_ON=        gnatcross-binutils:single:FARM64_R11
72 [FARM64R11].MAKEFILE_ON=                OS_LABEL4VERS="[{{OPSYS}}/{{ARCH}} x FreeBSD_11/ARM64]"
73                                         PREFIX={{LOCALBASE}}/FreeBSD11_ARM64
74                                         SRPREFIX={{PREFIX}}/sysroot
75                                         XCCTARGET=aarch64-raven-freebsd11.1
76                                         TARGET_SPECIFIC=#none
77
78 post-patch:
79         # Update LINK_SPEC to add gcc-aux lib runpath in every binary
80         @${ECHO} "Configuring LINK_SPEC runpath"
81         @${REINPLACE_CMD} -e 's;\@PREFIX\@;${PREFIX};' \
82                 ${WRKSRC}/gcc/config/dragonfly.h \
83                 ${WRKSRC}/gcc/config/i386/freebsd64.h \
84                 ${WRKSRC}/gcc/config/i386/freebsd.h \
85                 ${WRKSRC}/gcc/config/i386/gnu-user64.h \
86                 ${WRKSRC}/gcc/config/aarch64/aarch64-freebsd.h
87         # work around malloc detection issue
88         ${REINPLACE_CMD} -e 's/#undef HAVE_ALIGNED_ALLOC/#define HAVE_ALIGNED_ALLOC 1/' \
89                 ${WRKSRC}/libstdc++-v3/config.h.in
90
91 post-stage:
92         ${RM} -r ${STAGEDIR}${PREFIX}/lib/gcc/${XCCTARGET}/7.2.0/include-fixed/
93         ${RM} -r ${STAGEDIR}${MANPREFIX}
94 .for loop in A B
95         (cd ${STAGEDIR}${PREFIX}; ${FIND} * -type d -empty | \
96                 ${SORT} -dr | ${XARGS} ${RMDIR})
97 .endfor
98         (cd ${STAGEDIR}${PREFIX}; \
99                 ${FIND} * \( -type f -or -type l \) | ${SORT} | \
100                 ${SED} -e '/^bin\//d' -e '/^${XCCTARGET}\/bin\//d' \
101                 >> ${WRKDIR}/.manifest.single.mktmp)
102
103 post-extract:
104         # Personalize GNAT for each different machine
105         @${ECHO} "-=> GNATCROSS ${OS_LABEL4VERS}" > ${WRKSRC}/gcc/REVISION
106
107 do-install:
108         # Buggy makefile; seems to have forgotten this is a cross compiler
109         # Manually rename products so it doesn't rebuild them with new name
110 .for X in gnat gnatbind gnatchop gnatclean gnatfind gnatkr gnatlink gnatls \
111         gnatmake gnatprep gnatxref
112         if [ ! -f "${BUILD_WRKSRC}/gcc/${X}" ]; then \
113            ${CP} -a ${BUILD_WRKSRC}/gcc/${X}-cross ${BUILD_WRKSRC}/gcc/${X}; \
114         fi
115 .endfor
116         (cd ${BUILD_WRKSRC} && ${SETENV} ${MAKE_ENV:C/^PATH=/&${PREFIX}\/bin:/} \
117                 ${MAKE_CMD} install-strip DESTDIR=${STAGEDIR})
118         ${MV} ${STAGEDIR}${PREFIX}/bin/ada \
119                 ${STAGEDIR}${PREFIX}/bin/${XCCTARGET}-ada
120
121 [FILE:134:descriptions/desc.single.FARM64_R11]
122 This package contains a C/C++/Fortran/Ada cross-compiler based on GCC 7
123 that targets the FreeBSD/ARM64 operating system (Release 11).
124
125
126 [FILE:95:distinfo]
127 1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a     62312628 gcc-7.2.0.tar.xz
128
129
130 [FILE:501:manifests/plist.single]
131 bin/
132  %%TARGET%%-ada
133  %%TARGET%%-c++
134  %%TARGET%%-cpp
135  %%TARGET%%-gcc-%%GCCVERS%%
136  %%TARGET%%-gcov
137  %%TARGET%%-g++
138  %%TARGET%%-gcc
139  %%TARGET%%-gcc-ar
140  %%TARGET%%-gcc-nm
141  %%TARGET%%-gcc-ranlib
142  %%TARGET%%-gcov-dump
143  %%TARGET%%-gcov-tool
144  %%TARGET%%-gfortran
145  %%TARGET%%-gnat
146  %%TARGET%%-gnatbind
147  %%TARGET%%-gnatchop
148  %%TARGET%%-gnatclean
149  %%TARGET%%-gnatfind
150  %%TARGET%%-gnatkr
151  %%TARGET%%-gnatlink
152  %%TARGET%%-gnatls
153  %%TARGET%%-gnatmake
154  %%TARGET%%-gnatname
155  %%TARGET%%-gnatprep
156  %%TARGET%%-gnatxref
157
158
159 [FILE:39877:patches/patch-diff-ada]
160 --- gcc/ada/adaint.c.orig
161 +++ gcc/ada/adaint.c
162 @@ -1174,6 +1174,47 @@
163      free (pname);
164    }
165  
166 +#elif defined (__ANDROID__)
167 +
168 +  /*
169 +   * ext2 /ext3/ext4/fat16/fat32 have no path limits
170 +   * /data/local/tmp normally requires rooted devices, if it even exists
171 +   * /sdcard is the standard location for external storage.  Nativeactivity
172 +   * manifest needs to authorize its use, otherwise it might not have the
173 +   * proper permissions.
174 +   */
175 +
176 +  int testfd;
177 +  char *datadir = getenv ("ANDROID_DATA");
178 +
179 +  if (datadir == NULL)
180 +    strncpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX", L_tmpnam);
181 +  else
182 +    snprintf (tmp_filename, L_tmpnam, "%s/local/tmp/gnat-XXXXXX", datadir);
183 +
184 +  testfd = mkstemp (tmp_filename);
185 +  if (testfd != -1)
186 +    {
187 +      close (testfd);
188 +      return;
189 +    }
190 +
191 +  char *sdcard = getenv ("EXTERNAL_STORAGE");
192 +
193 +  if (sdcard == NULL)
194 +    strncpy (tmp_filename, "/sdcard/gnat-XXXXXX", L_tmpnam);
195 +  else
196 +    snprintf (tmp_filename, L_tmpnam, "%s/gnat-XXXXXX", sdcard);
197 +
198 +  testfd = mkstemp (tmp_filename);
199 +  if (testfd != -1)
200 +    {
201 +      close (testfd);
202 +      return;
203 +    }
204 +
205 +  tmpnam (tmp_filename);
206 +
207  #elif defined (__linux__) || defined (__FreeBSD__) || defined (__NetBSD__) \
208    || defined (__OpenBSD__) || defined (__GLIBC__) || defined (__ANDROID__) \
209    || defined (__DragonFly__)
210 @@ -1460,7 +1501,7 @@
211    utimbuf.modtime = time_stamp;
212  
213    /* Set access time to now in local time.  */
214 -  t = time ((time_t) 0);
215 +  t = time (NULL);
216    utimbuf.actime = mktime (localtime (&t));
217  
218    utime (name, &utimbuf);
219 --- gcc/ada/cio.c.orig
220 +++ gcc/ada/cio.c
221 @@ -49,7 +49,7 @@
222  
223  /* Don't use macros on GNU/Linux since they cause incompatible changes between
224     glibc 2.0 and 2.1 */
225 -#ifdef __linux__
226 +#if defined __linux__ && !defined __ANDROID__
227  #undef putchar
228  #undef getchar
229  #undef fputc
230 --- gcc/ada/cstreams.c.orig
231 +++ gcc/ada/cstreams.c
232 @@ -71,7 +71,7 @@
233  #include <unixlib.h>
234  #endif
235  
236 -#ifdef __linux__
237 +#if defined __linux__ && !defined __ANDROID__
238  /* Don't use macros on GNU/Linux since they cause incompatible changes between
239     glibc 2.0 and 2.1 */
240  
241 --- /dev/null
242 +++ gcc/ada/g-socthi-bsd.adb
243 @@ -0,0 +1,356 @@
244 +------------------------------------------------------------------------------
245 +--                                                                          --
246 +--                         GNAT COMPILER COMPONENTS                         --
247 +--                                                                          --
248 +--                    G N A T . S O C K E T S . T H I N                     --
249 +--                                                                          --
250 +--                                 B o d y                                  --
251 +--                                                                          --
252 +--                     Copyright (C) 2001-2013, AdaCore                     --
253 +--                                                                          --
254 +-- GNAT is free software;  you can  redistribute it  and/or modify it under --
255 +-- terms of the  GNU General Public License as published  by the Free Soft- --
256 +-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
257 +-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
258 +-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
259 +-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
260 +--                                                                          --
261 +-- As a special exception under Section 7 of GPL version 3, you are granted --
262 +-- additional permissions described in the GCC Runtime Library Exception,   --
263 +-- version 3.1, as published by the Free Software Foundation.               --
264 +--                                                                          --
265 +-- You should have received a copy of the GNU General Public License and    --
266 +-- a copy of the GCC Runtime Library Exception along with this program;     --
267 +-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
268 +-- <http://www.gnu.org/licenses/>.                                          --
269 +--                                                                          --
270 +-- GNAT was originally developed  by the GNAT team at  New York University. --
271 +-- Extensive contributions were provided by Ada Core Technologies Inc.      --
272 +--                                                                          --
273 +------------------------------------------------------------------------------
274 +
275 +--  This package provides a target dependent thin interface to the sockets
276 +--  layer for use by the GNAT.Sockets package (g-socket.ads). This package
277 +--  should not be directly with'ed by an applications program.
278 +
279 +--  This is the *BSD version which uses fcntl rather than ioctl
280 +--  The constant SCON.Thread_Blocking_IO is always true (for all platforms, not
281 +--  just *BSD), so this binding is significantly simpler than the standard
282 +--  one it replaces.
283 +
284 +with GNAT.OS_Lib; use GNAT.OS_Lib;
285 +
286 +with Interfaces.C; use Interfaces.C;
287 +
288 +package body GNAT.Sockets.Thin is
289 +
290 +   function Syscall_Accept
291 +     (S       : C.int;
292 +      Addr    : System.Address;
293 +      Addrlen : not null access C.int) return C.int;
294 +   pragma Import (C, Syscall_Accept, "accept");
295 +   --  The accept() function accepts a connection on a socket.  An incoming
296 +   --  connection is acknowledged and associated with an immediately created
297 +   --  socket.  The original socket is returned to the listening state.
298 +
299 +   function Syscall_Connect
300 +     (S       : C.int;
301 +      Name    : System.Address;
302 +      Namelen : C.int) return C.int;
303 +   pragma Import (C, Syscall_Connect, "connect");
304 +   --  The connect() system call initiates a connection on a socket.  If the
305 +   --  parameter S is of type SOCK_DGRAM then connect() permanently specifies
306 +   --  the peer to which datagrams are to be sent.  If S is type SOCK_STREAM
307 +   --  then connect() attempts to make a connection with another socket, which
308 +   --  is identified by the parameter Name.
309 +
310 +   function Syscall_Recv
311 +     (S     : C.int;
312 +      Msg   : System.Address;
313 +      Len   : C.int;
314 +      Flags : C.int) return C.int;
315 +   pragma Import (C, Syscall_Recv, "recv");
316 +   --  The recv() function receives a message from a socket.  The call can be
317 +   --  used on a connection mode socket or a bound, connectionless socket.  If
318 +   --  no messages are available at the socket, the recv() call waits for a
319 +   --  message to arrive unless the socket is non-blocking.  If a socket is
320 +   --  non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK.
321 +
322 +   function Syscall_Recvfrom
323 +     (S       : C.int;
324 +      Msg     : System.Address;
325 +      Len     : C.int;
326 +      Flags   : C.int;
327 +      From    : System.Address;
328 +      Fromlen : not null access C.int) return C.int;
329 +   pragma Import (C, Syscall_Recvfrom, "recvfrom");
330 +   --  The recvfrom() system call receives a message from a socket and captures
331 +   --  the address from which the data was sent.  It can be used to receive
332 +   --  data on an unconnected socket as well.  If no messages are available,
333 +   --  the call waits for a message to arrive on blocking sockets.  For
334 +   --  non-blocking sockets without messages, -1 is returned and ERRNO is set
335 +   --  to EAGAIN or EWOULDBLOCK.
336 +
337 +   function Syscall_Recvmsg
338 +     (S     : C.int;
339 +      Msg   : System.Address;
340 +      Flags : C.int) return System.CRTL.ssize_t;
341 +   pragma Import (C, Syscall_Recvmsg, "recvmsg");
342 +   --  The recvmsg call receives a message from a socket, and can be used to
343 +   --  receive data on an unconnected socket as well.  If no messages are
344 +   --  available, the call waits for a message to arrive on blocking sockets.
345 +   --  For non-blocking sockets without messages, -1 is returned and ERRNO is
346 +   --  set to EAGAIN or EWOULDBLOCK.
347 +
348 +   function Syscall_Sendmsg
349 +     (S     : C.int;
350 +      Msg   : System.Address;
351 +      Flags : C.int) return System.CRTL.ssize_t;
352 +   pragma Import (C, Syscall_Sendmsg, "sendmsg");
353 +   --  The sendmsg() function sends a message to a socket, and can be used with
354 +   --  unconnected sockets as well (the msg is ignored in this case).  The
355 +   --  function returns the number of bytes sent when successful, otherwise it
356 +   --  returns -1 and ERRNO is set (many possible values).
357 +
358 +   function Syscall_Sendto
359 +     (S     : C.int;
360 +      Msg   : System.Address;
361 +      Len   : C.int;
362 +      Flags : C.int;
363 +      To    : System.Address;
364 +      Tolen : C.int) return C.int;
365 +   pragma Import (C, Syscall_Sendto, "sendto");
366 +   --  The sendto() function only works for connected sockets and it initiates
367 +   --  the transmission of a message.  A successful call returns the numbers of
368 +   --  bytes sent, and a failure returns a -1 and ERRNO is set.
369 +
370 +   function Syscall_Socket
371 +     (Domain   : C.int;
372 +      Typ      : C.int;
373 +      Protocol : C.int) return C.int;
374 +   pragma Import (C, Syscall_Socket, "socket");
375 +   --  The socket() function is used to create an unbound socket and returns a
376 +   --  file descriptor that can be used with other socket functions.  Upon
377 +   --  failure, a -1 is returned and ERRNO is set.
378 +
379 +   procedure Disable_SIGPIPE (S : C.int);
380 +   pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
381 +
382 +   procedure Disable_All_SIGPIPEs;
383 +   pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes");
384 +   --  Sets the process to ignore all SIGPIPE signals on platforms that
385 +   --  don't support Disable_SIGPIPE for particular streams.
386 +
387 +   function C_Fcntl
388 +     (Fd  : C.int;
389 +      Cmd : C.int;
390 +      Val : C.int) return C.int;
391 +   pragma Import (C, C_Fcntl, "fcntl");
392 +   --  The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support
393 +   --  setting a socket in non-blocking mode.  fcntl must be used instead.
394 +
395 +   --------------
396 +   -- C_Accept --
397 +   --------------
398 +
399 +   function C_Accept
400 +     (S       : C.int;
401 +      Addr    : System.Address;
402 +      Addrlen : not null access C.int) return C.int
403 +   is
404 +      R : constant C.int := Syscall_Accept (S, Addr, Addrlen);
405 +   begin
406 +
407 +      Disable_SIGPIPE (R);
408 +      return R;
409 +   end C_Accept;
410 +
411 +   ---------------
412 +   -- C_Connect --
413 +   ---------------
414 +
415 +   function C_Connect
416 +     (S       : C.int;
417 +      Name    : System.Address;
418 +      Namelen : C.int) return C.int
419 +   is
420 +   begin
421 +      return Syscall_Connect (S, Name, Namelen);
422 +   end C_Connect;
423 +
424 +   ------------------
425 +   -- Socket_Ioctl --
426 +   ------------------
427 +
428 +   function Socket_Ioctl
429 +     (S   : C.int;
430 +      Req : SOSC.IOCTL_Req_T;
431 +      Arg : access C.int) return C.int
432 +   is
433 +   begin
434 +      if Req = SOSC.FIONBIO then
435 +         declare
436 +            use Interfaces;
437 +            flags    : constant Unsigned_32 :=
438 +                                Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0));
439 +            nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.O_NDELAY);
440 +            enabled  : constant Boolean := Arg.all = 1;
441 +            newval   : C.int := C.int (flags);
442 +         begin
443 +            if enabled then
444 +               newval := C.int (flags or nonblock);
445 +            elsif (flags and nonblock) > 0 then
446 +               newval := C.int (flags - nonblock);
447 +            end if;
448 +            return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval);
449 +         end;
450 +      end if;
451 +
452 +      return C_Ioctl (S, Req, Arg);
453 +   end Socket_Ioctl;
454 +
455 +   ------------
456 +   -- C_Recv --
457 +   ------------
458 +
459 +   function C_Recv
460 +     (S     : C.int;
461 +      Msg   : System.Address;
462 +      Len   : C.int;
463 +      Flags : C.int) return C.int
464 +   is
465 +   begin
466 +      return Syscall_Recv (S, Msg, Len, Flags);
467 +   end C_Recv;
468 +
469 +   ----------------
470 +   -- C_Recvfrom --
471 +   ----------------
472 +
473 +   function C_Recvfrom
474 +     (S       : C.int;
475 +      Msg     : System.Address;
476 +      Len     : C.int;
477 +      Flags   : C.int;
478 +      From    : System.Address;
479 +      Fromlen : not null access C.int) return C.int
480 +   is
481 +   begin
482 +      return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
483 +   end C_Recvfrom;
484 +
485 +   ---------------
486 +   -- C_Recvmsg --
487 +   ---------------
488 +
489 +   function C_Recvmsg
490 +     (S     : C.int;
491 +      Msg   : System.Address;
492 +      Flags : C.int) return System.CRTL.ssize_t
493 +   is
494 +   begin
495 +      return  Syscall_Recvmsg (S, Msg, Flags);
496 +   end C_Recvmsg;
497 +
498 +   ---------------
499 +   -- C_Sendmsg --
500 +   ---------------
501 +
502 +   function C_Sendmsg
503 +     (S     : C.int;
504 +      Msg   : System.Address;
505 +      Flags : C.int) return System.CRTL.ssize_t
506 +   is
507 +   begin
508 +      return Syscall_Sendmsg (S, Msg, Flags);
509 +   end C_Sendmsg;
510 +
511 +   --------------
512 +   -- C_Sendto --
513 +   --------------
514 +
515 +   function C_Sendto
516 +     (S     : C.int;
517 +      Msg   : System.Address;
518 +      Len   : C.int;
519 +      Flags : C.int;
520 +      To    : System.Address;
521 +      Tolen : C.int) return C.int
522 +   is
523 +   begin
524 +      return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
525 +   end C_Sendto;
526 +
527 +   --------------
528 +   -- C_Socket --
529 +   --------------
530 +
531 +   function C_Socket
532 +     (Domain   : C.int;
533 +      Typ      : C.int;
534 +      Protocol : C.int) return C.int
535 +   is
536 +      R : constant C.int := Syscall_Socket (Domain, Typ, Protocol);
537 +   begin
538 +      Disable_SIGPIPE (R);
539 +      return R;
540 +   end C_Socket;
541 +
542 +   --------------
543 +   -- Finalize --
544 +   --------------
545 +
546 +   procedure Finalize is
547 +   begin
548 +      null;
549 +   end Finalize;
550 +
551 +   -------------------------
552 +   -- Host_Error_Messages --
553 +   -------------------------
554 +
555 +   package body Host_Error_Messages is separate;
556 +
557 +   ----------------
558 +   -- Initialize --
559 +   ----------------
560 +
561 +   procedure Initialize is
562 +   begin
563 +      Disable_All_SIGPIPEs;
564 +   end Initialize;
565 +
566 +   --------------------
567 +   -- Signalling_Fds --
568 +   --------------------
569 +
570 +   package body Signalling_Fds is
571 +
572 +      --  In this default implementation, we use a C version of these
573 +      --  subprograms provided by socket.c.
574 +
575 +      function C_Create (Fds : not null access Fd_Pair) return C.int;
576 +      function C_Read (Rsig : C.int) return C.int;
577 +      function C_Write (Wsig : C.int) return C.int;
578 +      procedure C_Close (Sig : C.int);
579 +
580 +      pragma Import (C, C_Create, "__gnat_create_signalling_fds");
581 +      pragma Import (C, C_Read,   "__gnat_read_signalling_fd");
582 +      pragma Import (C, C_Write,  "__gnat_write_signalling_fd");
583 +      pragma Import (C, C_Close,  "__gnat_close_signalling_fd");
584 +
585 +      function Create
586 +        (Fds : not null access Fd_Pair) return C.int renames C_Create;
587 +      function Read (Rsig : C.int) return C.int renames C_Read;
588 +      function Write (Wsig : C.int) return C.int renames C_Write;
589 +      procedure Close (Sig : C.int) renames C_Close;
590 +
591 +   end Signalling_Fds;
592 +
593 +   --------------------------
594 +   -- Socket_Error_Message --
595 +   --------------------------
596 +
597 +   function Socket_Error_Message (Errno : Integer) return String is separate;
598 +
599 +end GNAT.Sockets.Thin;
600 --- gcc/ada/gnatchop.adb.orig
601 +++ gcc/ada/gnatchop.adb
602 @@ -44,7 +44,7 @@
603     Config_File_Name : constant String_Access := new String'("gnat.adc");
604     --  The name of the file holding the GNAT configuration pragmas
605  
606 -   Gcc : String_Access := new String'("gcc");
607 +   Gcc : String_Access := new String'("ada");
608     --  May be modified by switch --GCC=
609  
610     Gcc_Set : Boolean := False;
611 --- gcc/ada/gnatlink.adb.orig
612 +++ gcc/ada/gnatlink.adb
613 @@ -136,7 +136,7 @@
614     --  This table collects the arguments to be passed to compile the binder
615     --  generated file.
616  
617 -   Gcc : String_Access := Program_Name ("gcc", "gnatlink");
618 +   Gcc : String_Access := Program_Name ("ada", "gnatlink");
619  
620     Read_Mode : constant String := "r" & ASCII.NUL;
621  
622 --- gcc/ada/make.adb.orig
623 +++ gcc/ada/make.adb
624 @@ -670,7 +670,7 @@
625     -- Compiler, Binder & Linker Data and Subprograms --
626     ----------------------------------------------------
627  
628 -   Gcc      : String_Access := Program_Name ("gcc", "gnatmake");
629 +   Gcc      : String_Access := Program_Name ("ada", "gnatmake");
630     Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake");
631     Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake");
632     --  Default compiler, binder, linker programs
633 --- gcc/ada/mlib-prj.adb.orig
634 +++ gcc/ada/mlib-prj.adb
635 @@ -335,6 +335,11 @@
636  
637        Foreign_Sources : Boolean;
638  
639 +      Rpath_Disabled : Boolean := False;
640 +      --  If -R is passed through the library options for the linker, it will
641 +      --  prevent the implemented libraries portion of the rpath switch from
642 +      --  being built, even if the linker is capable of supporting rpath.
643 +
644        Rpath : String_Access := null;
645        --  Allocated only if Path Option is supported
646  
647 @@ -768,7 +773,7 @@
648              Opts.Table (Opts.Last) :=
649                new String'("-L" & Name_Buffer (1 .. Name_Len));
650  
651 -            if Path_Option /= null then
652 +            if not Rpath_Disabled and then Path_Option /= null then
653                 Add_Rpath (Name_Buffer (1 .. Name_Len));
654              end if;
655  
656 @@ -1299,9 +1304,13 @@
657                    Get_Name_String (Element.Value);
658  
659                    if Name_Len /= 0 then
660 -                     Opts.Increment_Last;
661 -                     Opts.Table (Opts.Last) :=
662 -                       new String'(Name_Buffer (1 .. Name_Len));
663 +                     if Name_Buffer (1 .. Name_Len) = "-R" then
664 +                        Rpath_Disabled := True;
665 +                     else
666 +                        Opts.Increment_Last;
667 +                        Opts.Table (Opts.Last) :=
668 +                          new String'(Name_Buffer (1 .. Name_Len));
669 +                     end if;
670                    end if;
671  
672                    Current := Element.Next;
673 --- gcc/ada/mlib-utl.adb.orig
674 +++ gcc/ada/mlib-utl.adb
675 @@ -446,7 +446,7 @@
676        if Driver_Name = No_Name then
677           if Gcc_Exec = null then
678              if Gcc_Name = null then
679 -               Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
680 +               Gcc_Name := Osint.Program_Name ("ada", "gnatmake");
681              end if;
682  
683              Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all);
684 --- gcc/ada/prj-makr.adb.orig
685 +++ gcc/ada/prj-makr.adb
686 @@ -115,7 +115,7 @@
687  
688     procedure Dup2 (Old_Fd, New_Fd : File_Descriptor);
689  
690 -   Gcc      : constant String := "gcc";
691 +   Gcc      : constant String := "ada";
692     Gcc_Path : String_Access := null;
693  
694     Non_Empty_Node : constant Project_Node_Id := 1;
695 --- /dev/null
696 +++ gcc/ada/s-trasym-bsd.adb
697 @@ -0,0 +1,151 @@
698 +------------------------------------------------------------------------------
699 +--                                                                          --
700 +--                         GNAT RUN-TIME COMPONENTS                         --
701 +--                                                                          --
702 +--           S Y S T E M . T R A C E B A C K . S Y M B O L I C              --
703 +--                                                                          --
704 +--                                 B o d y                                  --
705 +--                                                                          --
706 +--                     Copyright (C) 1999-2009, AdaCore                     --
707 +--                                                                          --
708 +-- GNAT is free software;  you can  redistribute it  and/or modify it under --
709 +-- terms of the  GNU General Public License as published  by the Free Soft- --
710 +-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
711 +-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
712 +-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
713 +-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
714 +-- for  more details.  You should have  received  a copy of the GNU General --
715 +-- Public License  distributed with GNAT;  see file COPYING.  If not, write --
716 +-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
717 +-- Boston, MA 02110-1301, USA.                                              --
718 +--                                                                          --
719 +-- As a special exception,  if other files  instantiate  generics from this --
720 +-- unit, or you link  this unit with other files  to produce an executable, --
721 +-- this  unit  does not  by itself cause  the resulting  executable  to  be --
722 +-- covered  by the  GNU  General  Public  License.  This exception does not --
723 +-- however invalidate  any other reasons why  the executable file  might be --
724 +-- covered by the  GNU Public License.                                      --
725 +--                                                                          --
726 +-- GNAT was originally developed  by the GNAT team at  New York University. --
727 +-- Extensive contributions were provided by Ada Core Technologies Inc.      --
728 +--                                                                          --
729 +------------------------------------------------------------------------------
730 +
731 +--  Run-time symbolic traceback support
732 +--  This file is based on the work by Juergen Pfiefer which is still used
733 +--  today to provide symbolic traceback support for gnu/kFreeBSD.
734 +--  Incorporated in GNAT-AUX by John Marino <http://www.dragonlace.net>
735 +
736 +with System.Soft_Links;
737 +with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback;
738 +
739 +package body System.Traceback.Symbolic is
740 +
741 +   package TSL renames System.Soft_Links;
742 +
743 +   --  To perform the raw addresses to symbolic form translation we rely on a
744 +   --  libaddr2line symbolizer which examines debug info from a provided
745 +   --  executable file name, and an absolute path is needed to ensure the file
746 +   --  is always found. This is "__gnat_locate_exec_on_path (gnat_argv [0])"
747 +   --  for our executable file, a fairly heavy operation so we cache the
748 +   --  result.
749 +
750 +   Exename : System.Address;
751 +   --  Pointer to the name of the executable file to be used on all
752 +   --  invocations of the libaddr2line symbolization service.
753 +
754 +   Exename_Resolved : Boolean := False;
755 +   --  Flag to indicate whether we have performed the executable file name
756 +   --  resolution already. Relying on a not null Exename for this purpose
757 +   --  would be potentially inefficient as this is what we will get if the
758 +   --  resolution attempt fails.
759 +
760 +   ------------------------
761 +   -- Symbolic_Traceback --
762 +   ------------------------
763 +
764 +   function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is
765 +
766 +      procedure convert_addresses
767 +        (filename : System.Address;
768 +         addrs    : System.Address;
769 +         n_addrs  : Integer;
770 +         buf      : System.Address;
771 +         len      : System.Address);
772 +      pragma Import (C, convert_addresses, "convert_addresses");
773 +      --  This is the procedure version of the Ada-aware addr2line. It places
774 +      --  in BUF a string representing the symbolic translation of the N_ADDRS
775 +      --  raw addresses provided in ADDRS, looked up in debug information from
776 +      --  FILENAME. LEN points to an integer which contains the size of the
777 +      --  BUF buffer at input and the result length at output.
778 +      --
779 +      --  Note that this procedure is *not* thread-safe.
780 +
781 +      type Argv_Array is array (0 .. 0) of System.Address;
782 +      gnat_argv : access Argv_Array;
783 +      pragma Import (C, gnat_argv, "gnat_argv");
784 +
785 +      function locate_exec_on_path
786 +        (c_exename : System.Address) return System.Address;
787 +      pragma Import (C, locate_exec_on_path, "__gnat_locate_exec_on_path");
788 +
789 +      B_Size : constant Integer := 256 * Traceback'Length;
790 +      Len    : Integer := B_Size;
791 +      Res    : String (1 .. B_Size);
792 +
793 +      use type System.Address;
794 +
795 +   begin
796 +      --  The symbolic translation of an empty set of addresses is an empty
797 +      --  string.
798 +
799 +      if Traceback'Length = 0 then
800 +         return "";
801 +      end if;
802 +
803 +      --  If our input set of raw addresses is not empty, resort to the
804 +      --  libaddr2line service to symbolize it all.
805 +
806 +      --  Compute, cache and provide the absolute path to our executable file
807 +      --  name as the binary file where the relevant debug information is to be
808 +      --  found. If the executable file name resolution fails, we have no
809 +      --  sensible basis to invoke the symbolizer at all.
810 +
811 +      --  Protect all this against concurrent accesses explicitly, as the
812 +      --  underlying services are potentially thread unsafe.
813 +
814 +      TSL.Lock_Task.all;
815 +
816 +      if not Exename_Resolved then
817 +         Exename := locate_exec_on_path (gnat_argv (0));
818 +         Exename_Resolved := True;
819 +      end if;
820 +
821 +      if Exename /= System.Null_Address then
822 +         Len := Res'Length;
823 +         convert_addresses
824 +           (Exename, Traceback'Address, Traceback'Length,
825 +            Res (1)'Address, Len'Address);
826 +      end if;
827 +
828 +      TSL.Unlock_Task.all;
829 +
830 +      --  Return what the addr2line symbolizer has produced if we have called
831 +      --  it (the executable name resolution succeeded), or an empty string
832 +      --  otherwise.
833 +
834 +      if Exename /= System.Null_Address then
835 +         return Res (1 .. Len);
836 +      else
837 +         return "";
838 +      end if;
839 +
840 +   end Symbolic_Traceback;
841 +
842 +   function Symbolic_Traceback
843 +     (E : Ada.Exceptions.Exception_Occurrence) return String is
844 +   begin
845 +      return Symbolic_Traceback (Tracebacks (E));
846 +   end Symbolic_Traceback;
847 +
848 +end System.Traceback.Symbolic;
849 --- gcc/ada/terminals.c.orig
850 +++ gcc/ada/terminals.c
851 @@ -32,7 +32,7 @@
852  /* First all usupported platforms. Add stubs for exported routines. */
853  
854  #if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \
855 -  || defined (__ANDROID__) || defined (__PikeOS__) || defined(__DJGPP__)
856 +  || defined (__PikeOS__) || defined(__DJGPP__)
857  
858  #define ATTRIBUTE_UNUSED __attribute__((unused))
859  
860 @@ -1052,7 +1052,7 @@
861   || defined (__OpenBSD__) \
862   || defined (__NetBSD__)  \
863   || defined (__DragonFly__)
864 -#   define BSD
865 +#   define FREEBSD
866  #endif
867  
868  /* Include every system header we need */
869 @@ -1063,8 +1063,8 @@
870  
871  /* On some system termio is either absent or including it will disable termios
872     (HP-UX) */
873 -#if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \
874 -  && !defined (__rtems__)
875 +#if ! defined (__hpux__) && ! defined (FREEBSD) && \
876 +    ! defined (__APPLE__) && ! defined(__rtems__)
877  #   include <termio.h>
878  #endif
879  
880 @@ -1076,10 +1076,10 @@
881  #include <sys/types.h>
882  #include <sys/wait.h>
883  #include <unistd.h>
884 -#if defined (__sun__)
885 +#if defined (sun)
886  #   include <sys/stropts.h>
887  #endif
888 -#if defined (BSD) || defined (__sun__)
889 +#if defined (FREEBSD) || defined (sun)
890  #   include <sys/signal.h>
891  #endif
892  #if defined (__hpux__)
893 @@ -1087,11 +1087,15 @@
894  #   include <sys/stropts.h>
895  #endif
896  
897 +#ifdef __ANDROID__
898 +#define CDISABLE _PC_VDISABLE
899 +#else
900  #define CDISABLE _POSIX_VDISABLE
901 +#endif
902  
903  /* On HP-UX and Sun system, there is a bzero function but with a different
904     signature. Use memset instead */
905 -#if defined (__hpux__) || defined (__sun__) || defined (_AIX)
906 +#if defined (__hpux__) || defined (sun) || defined (_AIX)
907  #   define bzero(s,n) memset (s,0,n)
908  #endif
909  
910 @@ -1109,11 +1113,11 @@
911  */
912  
913  /* Configurable part */
914 -#if defined (__APPLE__) || defined (BSD)
915 +#if defined (__APPLE__) || defined (FREEBSD)
916  #define USE_OPENPTY
917 -#elif defined (__linux__)
918 +#elif defined (linux)
919  #define USE_GETPT
920 -#elif defined (__sun__)
921 +#elif defined (sun)
922  #define USE_CLONE_DEVICE "/dev/ptmx"
923  #elif defined (_AIX)
924  #define USE_CLONE_DEVICE "/dev/ptc"
925 @@ -1399,7 +1403,7 @@
926      desc->slave_fd = open (desc->slave_name, O_RDWR, 0);
927  #endif
928  
929 -#if defined (__sun__) || defined (__hpux__)
930 +#if defined (sun) || defined (__hpux__)
931    /* On systems such as Solaris we are using stream. We need to push the right
932       "modules" in order to get the expected terminal behaviors. Otherwise
933       functionalities such as termios are not available.  */
934 --- /dev/null
935 +++ gcc/ada/traceback_symbolic.c
936 @@ -0,0 +1,201 @@
937 +/*
938 +  Copyright (C) 1999 by Juergen Pfeifer <juergen.pfeifer@gmx.net>
939 +  Ada for Linux Team (ALT)
940 +  Heavily modified by John Marino <http://www.dragonlace.net>
941 +
942 +  Permission is hereby granted, free of charge, to any person obtaining a
943 +  copy of this software and associated documentation files (the
944 +  "Software"), to deal in the Software without restriction, including
945 +  without limitation the rights to use, copy, modify, merge, publish,
946 +  distribute, distribute with modifications, sublicense, and/or sell
947 +  copies of the Software, and to permit persons to whom the Software is
948 +  furnished to do so, subject to the following conditions:
949 +
950 +  The above copyright notice and this permission notice shall be included
951 +  in all copies or substantial portions of the Software.
952 +
953 +  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
954 +  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
955 +  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
956 +  IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
957 +  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
958 +  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
959 +  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
960 +
961 +  Except as contained in this notice, the name(s) of the above copyright
962 +  holders shall not be used in advertising or otherwise to promote the
963 +  sale, use or other dealings in this Software without prior written
964 +  authorization.
965 +*/
966 +
967 +#ifdef IS_CROSS
968 +
969 +
970 +/*
971 + * Running addr2line doesn't make sense for cross-compiled objects.
972 + * Create a dummy function to satisfy g-trasym.o
973 + */
974 +
975 +void
976 +convert_addresses (const char *file_name ATTRIBUTE_UNUSED,
977 +                   void *addrs ATTRIBUTE_UNUSED,
978 +                   int n_addr ATTRIBUTE_UNUSED,
979 +                   void *buf ATTRIBUTE_UNUSED,
980 +                   int *len ATTRIBUTE_UNUSED)
981 +{
982 +  *len = 0;
983 +}
984 +
985 +#else
986 +
987 +
988 +/*
989 + * use the external program /usr/bin/addr2line to convert addresses
990 + * into file names and line numbers
991 + */
992 +
993 +#include <sys/types.h>
994 +#include <stdlib.h>
995 +#include <unistd.h>
996 +#include <string.h>
997 +#include <signal.h>
998 +
999 +#define CLOSE_SENDPIPE close(sendpipe[0]); close(sendpipe[1])
1000 +#define CLOSE_READPIPE close(readpipe[0]); close(readpipe[1])
1001 +#define DUP2CLOSE(oldfd, newfd) dup2(oldfd, newfd); close(oldfd);
1002 +#define RESTSIG sigaction(SIGPIPE,&oact,NULL)
1003 +
1004 +#define MAX_LINE     1024
1005 +#define PARENT_READ  readpipe[0]
1006 +#define CHILD_WRITE  readpipe[1]
1007 +#define CHILD_READ   sendpipe[0]
1008 +#define PARENT_WRITE sendpipe[1]
1009 +
1010 +#if defined (__sun__)
1011 +#define ADDR2LINE_PROG        "/usr/gnu/bin/addr2line"
1012 +#else
1013 +#define ADDR2LINE_PROG        "/usr/bin/addr2line"
1014 +#endif
1015 +
1016 +void
1017 +convert_addresses (const char *file_name,
1018 +                   void *addrs,
1019 +                   int   n_addr,
1020 +                   void *buf,
1021 +                   int  *len)
1022 +{
1023 +  int max_len = *len;
1024 +  pid_t childpid;
1025 +
1026 +  struct sigaction act, oact;
1027 +
1028 +  int sendpipe[2] = {-1,-1},        /* parent -> child */
1029 +      readpipe[2] = {-1,-1};        /* parent <- child */
1030 +
1031 +  *len = 0;
1032 +  act.sa_handler = SIG_IGN;
1033 +  sigemptyset(&act.sa_mask);
1034 +  act.sa_flags = 0;
1035 +  if (sigaction(SIGPIPE,&act,&oact) < 0)
1036 +    return;
1037 +
1038 +  if (pipe(sendpipe) < 0) { RESTSIG; return; }
1039 +  if (pipe(readpipe) < 0) { CLOSE_SENDPIPE; RESTSIG; return; }
1040 +  if ((childpid = fork()) < 0) {
1041 +    CLOSE_READPIPE;
1042 +    CLOSE_SENDPIPE;
1043 +    RESTSIG;
1044 +    return;
1045 +  }
1046 +
1047 +  if (childpid == 0) {    /* child process */
1048 +    close(PARENT_WRITE);
1049 +    close(PARENT_READ);
1050 +    if ((CHILD_READ != STDIN_FILENO) && (CHILD_WRITE != STDOUT_FILENO)) {
1051 +      if ((CHILD_READ == STDOUT_FILENO) && (CHILD_WRITE == STDIN_FILENO)) {
1052 +        const int temp_fd = dup(CHILD_WRITE);
1053 +        close (CHILD_WRITE);
1054 +        DUP2CLOSE (CHILD_READ, STDIN_FILENO);
1055 +        DUP2CLOSE (temp_fd,    STDOUT_FILENO);
1056 +      }
1057 +      else if ((CHILD_READ == STDIN_FILENO) && (CHILD_WRITE > 1)) {
1058 +        DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
1059 +      }
1060 +      else if ((CHILD_READ > 1) && (CHILD_WRITE == STDOUT_FILENO)) {
1061 +        DUP2CLOSE (CHILD_READ, STDIN_FILENO);
1062 +      }
1063 +      else if ((CHILD_READ > 1) && (CHILD_WRITE == STDIN_FILENO)) {
1064 +        DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
1065 +        DUP2CLOSE (CHILD_READ,  STDIN_FILENO);
1066 +      }
1067 +      else {
1068 +        /* CHILD_READ >= 1 and CHILD_WRITE > 1 */
1069 +        DUP2CLOSE (CHILD_READ,  STDIN_FILENO);
1070 +        DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
1071 +      }
1072 +    }
1073 +    /* As pointed out by Florian Weimer to JP, it is a security threat to call
1074 +       the script with a user defined environment and using the path. That
1075 +       would be Trojans pleasure.  Therefore the absolute path to addr2line
1076 +       and an empty environment is used. That should be safe.
1077 +    */
1078 +    char *const argv[] = { "addr2line",
1079 +                           "-e", file_name,
1080 +                           "--demangle=gnat",
1081 +                           "--functions",
1082 +                           "--basenames",
1083 +                           NULL };
1084 +    char *const envp[] = { NULL };
1085 +    if (execve(ADDR2LINE_PROG, argv, envp) < 0) {
1086 +      close (CHILD_WRITE);
1087 +      close (CHILD_READ);
1088 +      RESTSIG;
1089 +      exit (1);
1090 +    }
1091 +  }
1092 +
1093 +  /* Below this line is parent process */
1094 +  int i, n;
1095 +  char hex[16];
1096 +  char line[MAX_LINE + 1];
1097 +  char *p;
1098 +  char *s = buf;
1099 +  long *trace_address = addrs;
1100 +
1101 +  close(CHILD_WRITE);
1102 +  close(CHILD_READ);
1103 +
1104 +  for(i=0; i < n_addr; i++) {
1105 +    snprintf(hex,sizeof(hex),"%#lx\n",*trace_address);
1106 +    write(PARENT_WRITE,hex,strlen(hex));
1107 +    n = read(PARENT_READ,line,MAX_LINE);
1108 +    if (n<=0)
1109 +      break;
1110 +
1111 +    line[n]=0;
1112 +    /* We have approx. 16 additional chars for "%#lx in " clause.
1113 +       We use this info to prevent a buffer overrun. */
1114 +    if (n + 16 + (*len) > max_len)
1115 +      break;
1116 +
1117 +    p = strchr(line,'\n');
1118 +    if (p) {
1119 +      if (*(p+1)) {
1120 +        *p = 0;
1121 +        *len += snprintf(s, (max_len - (*len)), "%#lx in %s at %s",
1122 +                         *trace_address, line, p+1);
1123 +      }
1124 +      else {
1125 +        *len += snprintf(s, (max_len - (*len)), "%#lx at %s",
1126 +                         *trace_address, line);
1127 +      }
1128 +      s = buf + (*len);
1129 +    }
1130 +    trace_address += 1;
1131 +  }
1132 +  close (PARENT_WRITE);
1133 +  close (PARENT_READ);
1134 +  RESTSIG;
1135 +}
1136 +
1137 +#endif
1138 --- gcc/ada/gcc-interface/Makefile.in.orig
1139 +++ gcc/ada/gcc-interface/Makefile.in
1140 @@ -1227,6 +1227,7 @@
1141  ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),)
1142    LIBGNAT_TARGET_PAIRS = \
1143    a-intnam.ads<a-intnam-linux.ads \
1144 +  g-socthi.adb<g-socthi-bsd.adb \
1145    s-inmaop.adb<s-inmaop-posix.adb \
1146    s-intman.adb<s-intman-android.adb \
1147    s-linux.ads<s-linux-android.ads \
1148 @@ -1311,6 +1312,7 @@
1149    a-intnam.ads<a-intnam-solaris.ads \
1150    s-inmaop.adb<s-inmaop-posix.adb \
1151    s-intman.adb<s-intman-solaris.adb \
1152 +  s-trasym.adb<s-trasym-bsd.adb \
1153    s-mudido.adb<s-mudido-affinity.adb \
1154    s-osinte.adb<s-osinte-solaris.adb \
1155    s-osinte.ads<s-osinte-solaris.ads \
1156 @@ -1347,6 +1349,8 @@
1157    EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1158  
1159    EH_MECHANISM=-gcc
1160 +  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
1161 +  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
1162    THREADSLIB = -lposix4 -lthread
1163    MISCLIB = -lposix4 -lnsl -lsocket
1164    SO_OPTS = -Wl,-h,
1165 @@ -1495,10 +1499,45 @@
1166    LIBRARY_VERSION := $(LIB_VERSION)
1167  endif
1168  
1169 +# x86 android
1170 +ifeq ($(strip $(filter-out %86 linux-android,$(target_cpu) $(target_os))),)
1171 +  LIBGNAT_TARGET_PAIRS = \
1172 +  a-intnam.ads<a-intnam-linux.ads \
1173 +  g-socthi.adb<g-socthi-bsd.adb \
1174 +  s-inmaop.adb<s-inmaop-posix.adb \
1175 +  s-intman.adb<s-intman-posix.adb \
1176 +  s-linux.ads<s-linux-android.ads \
1177 +  s-osinte.adb<s-osinte-android.adb \
1178 +  s-osinte.ads<s-osinte-android.ads \
1179 +  s-osprim.adb<s-osprim-posix.adb \
1180 +  s-taprop.adb<s-taprop-posix.adb \
1181 +  s-taspri.ads<s-taspri-posix.ads \
1182 +  s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
1183 +  $(ATOMICS_TARGET_PAIRS) \
1184 +  $(X86_TARGET_PAIRS) \
1185 +  system.ads<system-linux-x86.ads
1186 +
1187 +  TOOLS_TARGET_PAIRS =  \
1188 +    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
1189 +    indepsw.adb<indepsw-gnu.adb
1190 +
1191 +  EXTRA_LIBGNAT_OBJS=
1192 +  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
1193 +  EXTRA_GNATRTL_NONTASKING_OBJS=
1194 +  EH_MECHANISM=-gcc
1195 +  THREADSLIB=
1196 +  MISCLIB=
1197 +  GMEM_LIB=
1198 +  GNATLIB_SHARED = gnatlib-shared-dual
1199 +  LIBRARY_VERSION := $(LIB_VERSION)
1200 +endif
1201 +
1202  # aarch64 FreeBSD
1203  ifeq ($(strip $(filter-out %aarch64 freebsd%,$(target_cpu) $(target_os))),)
1204    LIBGNAT_TARGET_PAIRS = \
1205    a-intnam.ads<a-intnam-freebsd.ads \
1206 +  g-socthi.adb<g-socthi-bsd.adb \
1207 +  s-trasym.adb<s-trasym-bsd.adb \
1208    s-inmaop.adb<s-inmaop-posix.adb \
1209    s-intman.adb<s-intman-posix.adb \
1210    s-mudido.adb<s-mudido-affinity.adb \
1211 @@ -1516,6 +1555,9 @@
1212    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
1213    GNATLIB_SHARED = gnatlib-shared-dual
1214  
1215 +  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
1216 +  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
1217 +
1218    EH_MECHANISM=-gcc
1219    THREADSLIB= -lpthread
1220    GMEM_LIB = gmemlib
1221 @@ -1527,6 +1569,8 @@
1222  ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
1223    LIBGNAT_TARGET_PAIRS = \
1224    a-intnam.ads<a-intnam-freebsd.ads \
1225 +  g-socthi.adb<g-socthi-bsd.adb \
1226 +  s-trasym.adb<s-trasym-bsd.adb \
1227    s-inmaop.adb<s-inmaop-posix.adb \
1228    s-intman.adb<s-intman-posix.adb \
1229    s-mudido.adb<s-mudido-affinity.adb \
1230 @@ -1544,6 +1588,8 @@
1231    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
1232    GNATLIB_SHARED = gnatlib-shared-dual
1233  
1234 +  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
1235 +  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
1236    EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1237  
1238    EH_MECHANISM=-gcc
1239 @@ -1557,6 +1603,8 @@
1240  ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
1241    LIBGNAT_TARGET_PAIRS = \
1242    a-intnam.ads<a-intnam-freebsd.ads \
1243 +  g-socthi.adb<g-socthi-bsd.adb \
1244 +  s-trasym.adb<s-trasym-bsd.adb \
1245    s-inmaop.adb<s-inmaop-posix.adb \
1246    s-intman.adb<s-intman-posix.adb \
1247    s-mudido.adb<s-mudido-affinity.adb \
1248 @@ -1574,6 +1622,8 @@
1249    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
1250    GNATLIB_SHARED = gnatlib-shared-dual
1251  
1252 +  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
1253 +  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
1254    EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
1255  
1256    EH_MECHANISM=-gcc
1257 @@ -1587,6 +1637,8 @@
1258  ifeq ($(strip $(filter-out %86_64 dragonfly%,$(target_cpu) $(target_os))),)
1259    LIBGNAT_TARGET_PAIRS = \
1260    a-intnam.ads<a-intnam-dragonfly.ads \
1261 +  g-socthi.adb<g-socthi-bsd.adb \
1262 +  s-trasym.adb<s-trasym-bsd.adb \
1263    s-inmaop.adb<s-inmaop-posix.adb \
1264    s-intman.adb<s-intman-posix.adb \
1265    s-mudido.adb<s-mudido-affinity.adb \
1266 @@ -1604,6 +1656,8 @@
1267    mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb
1268    GNATLIB_SHARED = gnatlib-shared-dual
1269  
1270 +  EXTRA_LIBGNAT_SRCS+= traceback_symbolic.c
1271 +  EXTRA_LIBGNAT_OBJS+= traceback_symbolic.o
1272    EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
1273  
1274    EH_MECHANISM=-gcc
1275 --- gcc/ada/gcc-interface/Make-lang.in.orig
1276 +++ gcc/ada/gcc-interface/Make-lang.in
1277 @@ -589,7 +589,7 @@
1278   ada/widechar.o
1279  
1280  # Language-independent object files.
1281 -ADA_BACKEND = $(BACKEND) attribs.o
1282 +ADA_BACKEND = $(BACKEND2) attribs.o
1283  
1284  # List of target dependent sources, overridden below as necessary
1285  TARGET_ADA_SRCS =
1286 --- gcc/ada/init.c.orig
1287 +++ gcc/ada/init.c
1288 @@ -2541,8 +2541,15 @@
1289  {
1290    mcontext_t *mcontext = &((ucontext_t *) ucontext)->uc_mcontext;
1291  
1292 +#if defined (__i386__)
1293 +  unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP];
1294 +  /* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode.  */
1295 +  if (signo == SIGSEGV && pc && *pc == 0x00240c83)
1296 +    mcontext->gregs[REG_ESP] += 4096 + 4 * sizeof (unsigned long);
1297 +#elif defined (__ARMEL__)
1298    /* ARM Bump has to be an even number because of odd/even architecture.  */
1299 -  ((mcontext_t *) mcontext)->arm_pc += 2;
1300 +  mcontext->arm_pc += 2;
1301 +#endif
1302  }
1303  
1304  static void
1305
1306
1307 [FILE:19397:patches/patch-diff-ada-testsuite]
1308 --- gcc/testsuite/ada/acats/run_acats.sh.orig
1309 +++ gcc/testsuite/ada/acats/run_acats.sh
1310 @@ -5,20 +5,6 @@
1311     exit 1
1312  fi
1313  
1314 -# Provide which replacement.
1315 -#
1316 -# type -p is missing from Solaris 2 /bin/sh and /bin/ksh (ksh88), but both
1317 -# ksh93 and bash have it.
1318 -# type output format differs between ksh88 and ksh93, so avoid it if
1319 -# type -p is present.  Unfortunately, HP-UX /bin/sh ignores -p with type.
1320 -# Fall back to whence which ksh88 and ksh93 provide, but bash does not.
1321 -
1322 -which () {
1323 -    path=`type -p $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; }
1324 -    path=`type $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; }
1325 -    path=`whence $* 2>/dev/null` && { echo $path; return 0; }
1326 -    return 1
1327 -}
1328  
1329  # Set up environment to use the Ada compiler from the object tree
1330  
1331 --- gcc/testsuite/ada/acats/run_all.sh.orig
1332 +++ gcc/testsuite/ada/acats/run_all.sh
1333 @@ -14,21 +14,6 @@
1334  
1335  # End of customization section.
1336  
1337 -# Perform arithmetic evaluation on the ARGs, and store the result in the
1338 -# global $as_val. Take advantage of shells that can avoid forks. The arguments
1339 -# must be portable across $(()) and expr.
1340 -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
1341 -  eval 'as_fn_arith ()
1342 -  {
1343 -    as_val=$(( $* ))
1344 -  }'
1345 -else
1346 -  as_fn_arith ()
1347 -  {
1348 -    as_val=`expr "$@" || test $? -eq 1`
1349 -  }
1350 -fi # as_fn_arith
1351 -
1352  display_noeol () {
1353    printf "$@"
1354    printf "$@" >> $dir/acats.sum
1355 @@ -46,6 +31,14 @@
1356    echo "$@" >> $dir/acats.log
1357  }
1358  
1359 +inform () {
1360 +  printf "%04d    %7s" $1 $2
1361 +}
1362 +
1363 +disinform () {
1364 +  printf "\r"
1365 +}
1366 +
1367  dir=`${PWDCMD-pwd}`
1368  
1369  if [ "$dir" = "$testdir" ]; then
1370 @@ -102,18 +95,6 @@
1371  gnatls -v >> $dir/acats.log
1372  display ""
1373  
1374 -if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
1375 -  dir_support=$dir/../acats/support
1376 -
1377 -  rm -rf $dir/run
1378 -  mv $dir/tests $dir/tests.$$ 2> /dev/null
1379 -  rm -rf $dir/tests.$$ &
1380 -  mkdir -p $dir/run
1381 -
1382 -  cp -pr $dir/../acats/tests $dir/
1383 -else
1384 -  dir_support=$dir/support
1385 -
1386  display "              === acats support ==="
1387  display_noeol "Generating support files..."
1388  
1389 @@ -214,9 +195,6 @@
1390  
1391  display " done."
1392  display ""
1393 -
1394 -fi
1395 -
1396  display "              === acats tests ==="
1397  
1398  if [ $# -eq 0 ]; then
1399 @@ -228,14 +206,20 @@
1400  glob_countn=0
1401  glob_countok=0
1402  glob_countu=0
1403 -par_count=0
1404 -par_countm=0
1405 -par_last=
1406 +countdown=0
1407  
1408  for chapter in $chapters; do
1409 -   # Used to generate support once and finish after that.
1410 -   [ "$chapter" = "NONE" ] && continue
1411 +   if [ -d $dir/tests/$chapter ]; then
1412 +      cd $dir/tests/$chapter
1413 +      ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
1414 +      cut -c1-7 | sort | uniq | comm -23 - $dir/support/norun.lst \
1415 +        > $dir/tests/$chapter/${chapter}.lst
1416 +      countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
1417 +      countdown=`expr $countdown + $countn`
1418 +   fi
1419 +done
1420  
1421 +for chapter in $chapters; do
1422     display Running chapter $chapter ...
1423  
1424     if [ ! -d $dir/tests/$chapter ]; then
1425 @@ -244,45 +228,11 @@
1426        continue
1427     fi
1428  
1429 -   cd $dir/tests/$chapter
1430 -   ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
1431 -   cut -c1-7 | sort | uniq | comm -23 - $dir_support/norun.lst \
1432 -     > $dir/tests/$chapter/${chapter}.lst 
1433     countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
1434 -   as_fn_arith $glob_countn + $countn
1435 -   glob_countn=$as_val
1436 +   glob_countn=`expr $glob_countn + $countn`
1437 +   counti=0
1438     for i in `cat $dir/tests/$chapter/${chapter}.lst`; do 
1439 -
1440 -      # If running multiple run_all.sh jobs in parallel, decide
1441 -      # if we should run this test in the current instance.
1442 -      if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
1443 -        case "$i" in
1444 -           # Ugh, some tests have inter-test dependencies, those
1445 -           # tests have to be scheduled on the same parallel instance
1446 -           # as previous test.
1447 -           ce2108f | ce2108h | ce3112d) ;;
1448 -           # All others can be hopefully scheduled freely.
1449 -           *)
1450 -              as_fn_arith $par_countm + 1
1451 -              par_countm=$as_val
1452 -              [ $par_countm -eq 10 ] && par_countm=0
1453 -              if [ $par_countm -eq 1 ]; then
1454 -                 as_fn_arith $par_count + 1
1455 -                 par_count=$as_val
1456 -                 if mkdir $GCC_RUNTEST_PARALLELIZE_DIR/$par_count 2>/dev/null; then
1457 -                    par_last=1
1458 -                 else
1459 -                    par_last=
1460 -                 fi
1461 -              fi;;
1462 -        esac
1463 -        if [ -z "$par_last" ]; then
1464 -           as_fn_arith $glob_countn - 1
1465 -           glob_countn=$as_val
1466 -           continue
1467 -        fi
1468 -      fi
1469 -
1470 +      counti=`expr $counti + 1`
1471        extraflags="-gnat95"
1472        grep $i $testdir/overflow.lst > /dev/null 2>&1
1473        if [ $? -eq 0 ]; then
1474 @@ -300,10 +250,13 @@
1475        if [ $? -eq 0 ]; then
1476           extraflags="$extraflags -fstack-check"
1477        fi
1478 +      inform $countdown $i
1479 +      countdown=`expr $countdown - 1`
1480        test=$dir/tests/$chapter/$i
1481        mkdir $test && cd $test >> $dir/acats.log 2>&1
1482  
1483        if [ $? -ne 0 ]; then
1484 +         disinform
1485           display "FAIL:        $i"
1486           failed="${failed}${i} "
1487           clean_dir
1488 @@ -321,19 +274,22 @@
1489        echo "BUILD $main" >> $dir/acats.log
1490        EXTERNAL_OBJECTS=""
1491        case $i in
1492 -        cxb30*) EXTERNAL_OBJECTS="$dir_support/cxb30040.o $dir_support/cxb30060.o $dir_support/cxb30130.o $dir_support/cxb30131.o";;
1493 +        cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
1494          ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
1495          ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
1496 +        cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
1497        esac
1498        if [ "$main" = "" ]; then
1499 +         disinform
1500           display "FAIL:        $i"
1501           failed="${failed}${i} "
1502           clean_dir
1503           continue
1504        fi
1505  
1506 -      target_gnatmake $extraflags -I$dir_support $main >> $dir/acats.log 2>&1
1507 +      target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
1508        if [ $? -ne 0 ]; then
1509 +         disinform
1510           display "FAIL:        $i"
1511           failed="${failed}${i} "
1512           clean_dir
1513 @@ -348,6 +304,7 @@
1514        target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
1515        cd $dir/tests/$chapter/$i
1516        cat ${i}.log >> $dir/acats.log
1517 +      disinform
1518        egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1
1519        if [ $? -ne 0 ]; then
1520           grep 'tasking not implemented' ${i}.log > /dev/null 2>&1
1521 @@ -357,15 +314,12 @@
1522              failed="${failed}${i} "
1523           else
1524              log "UNSUPPORTED:  $i"
1525 -            as_fn_arith $glob_countn - 1
1526 -            glob_countn=$as_val
1527 -            as_fn_arith $glob_countu + 1
1528 -            glob_countu=$as_val
1529 +            glob_countn=`expr $glob_countn - 1`
1530 +            glob_countu=`expr $glob_countu + 1`
1531           fi
1532        else
1533           log "PASS:    $i"
1534 -         as_fn_arith $glob_countok + 1
1535 -         glob_countok=$as_val
1536 +         glob_countok=`expr $glob_countok + 1`
1537        fi
1538        clean_dir
1539     done
1540 --- /dev/null
1541 +++ gcc/testsuite/ada/acats/run_remote.sh
1542 @@ -0,0 +1,412 @@
1543 +#!/bin/sh
1544 +# Run ACATS with the GNU Ada compiler
1545 +
1546 +# The following functions are to be customized if you run in cross
1547 +# environment or want to change compilation flags.  Note that for
1548 +# tests requiring checks not turned on by default, this script
1549 +# automatically adds the needed flags to pass (ie: -gnato or -gnatE).
1550 +
1551 +# gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions"
1552 +# gnatflags="-gnatN"
1553 +
1554 +gccflags="-O2"
1555 +gnatflags="-gnatws"
1556 +tabtarget="/data/local/testsuite"
1557 +STRIP="@REMOTE_TARGET@-strip"
1558 +
1559 +target_run () {
1560 +  # Run on rooted tablet (port 22 vs port 2222)
1561 +  BN=`basename $*`
1562 +  $STRIP_FOR_TARGET $*
1563 +  /usr/bin/scp -qp $* root@tablet:$tabtarget/
1564 +  /usr/bin/ssh -q tablet $tabtarget/$BN
1565 +}
1566 +
1567 +target_cmd () {
1568 +  /usr/bin/ssh -q tablet "$1"
1569 +}
1570 +
1571 +# End of customization section.
1572 +
1573 +display_noeol () {
1574 +  printf "$@"
1575 +  printf "$@" >> $dir/acats.sum
1576 +  printf "$@" >> $dir/acats.log
1577 +}
1578 +
1579 +display () {
1580 +  echo "$@"
1581 +  echo "$@" >> $dir/acats.sum
1582 +  echo "$@" >> $dir/acats.log
1583 +}
1584 +
1585 +log () {
1586 +  echo "$@" >> $dir/acats.sum
1587 +  echo "$@" >> $dir/acats.log
1588 +}
1589 +
1590 +inform () {
1591 +  printf "%04d    %7s" $1 $2
1592 +}
1593 +
1594 +disinform () {
1595 +  printf "\r"
1596 +}
1597 +
1598 +dir=`${PWDCMD-pwd}`
1599 +
1600 +if [ "$testdir" = "" ]; then
1601 +   echo You must use make check or make check-ada
1602 +   exit 1
1603 +fi
1604 +
1605 +if [ "$dir" = "$testdir" ]; then
1606 +  echo "error: srcdir must be different than objdir, exiting."
1607 +  exit 1
1608 +fi
1609 +
1610 +target_gnatmake () {
1611 +  echo gnatmake-cross --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\" -fPIE -pie
1612 +  gnatmake-cross --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC" -fPIE -pie
1613 +}
1614 +
1615 +target_gcc () {
1616 +  $GCC $gccflags $*
1617 +}
1618 +
1619 +clean_dir () {
1620 +  rm -f "$binmain" *.o *.ali > /dev/null 2>&1
1621 +}
1622 +
1623 +find_main () {
1624 +  ls ${i}?.adb > ${i}.lst 2> /dev/null
1625 +  ls ${i}*m.adb >> ${i}.lst 2> /dev/null
1626 +  ls ${i}.adb >> ${i}.lst 2> /dev/null
1627 +  main=`tail -1 ${i}.lst`
1628 +}
1629 +
1630 +split_testid () {
1631 +  local mysplit=`echo $1 | awk -F/ '{print "section=" $1 "; TN=" $2 "; prog=" $3 ";"}'`
1632 +  eval ${mysplit}
1633 +}
1634 +
1635 +EXTERNAL_OBJECTS=""
1636 +# Global variable to communicate external objects to link with.
1637 +
1638 +rm -f $dir/acats.sum $dir/acats.log $dir/transfer.lst
1639 +
1640 +display "Test Run By $USER on `date`"
1641 +
1642 +display "              === acats configuration ==="
1643 +
1644 +target=`$GCC -dumpmachine`
1645 +
1646 +display target gcc is $GCC
1647 +display `$GCC -v 2>&1`
1648 +display host=`gcc -dumpmachine`
1649 +display target=$target
1650 +display `type gnatmake-cross`
1651 +gnatls-cross -v >> $dir/acats.log
1652 +display ""
1653 +
1654 +# Let's be tidy and clear off the remote device first
1655 +target_cmd "cd ${tabtarget}; rm logs/*; rmdir logs; rm *"
1656 +
1657 +display "              === acats support ==="
1658 +display_noeol "Generating support files..."
1659 +
1660 +rm -rf $dir/support
1661 +mkdir -p $dir/support
1662 +cd $dir/support
1663 +
1664 +cp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support
1665 +
1666 +# Find out the size in bit of an address on the target
1667 +target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
1668 +target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
1669 +target_bit=`cat $dir/support/impbit.out`
1670 +echo target_bit="$target_bit" >> $dir/acats.log
1671 +
1672 +# Find out a suitable asm statement
1673 +# Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
1674 +case "$target" in
1675 +  ia64*-*-* | s390*-*-*)
1676 +    target_insn="nop 0"
1677 +    ;;
1678 +  mmix-*-*)
1679 +    target_insn="swym 0"
1680 +    ;;
1681 +  *)
1682 +    target_insn="nop"
1683 +    ;;
1684 +esac
1685 +echo target_insn="$target_insn" >> $dir/acats.log
1686 +
1687 +sed -e "s,ACATS4GNATDIR,$dir,g" \
1688 +  < $testdir/support/impdef.a > $dir/support/impdef.a
1689 +sed -e "s,ACATS4GNATDIR,$dir,g" \
1690 +  -e "s,ACATS4GNATBIT,$target_bit,g" \
1691 +  -e "s,ACATS4GNATINSN,$target_insn,g" \
1692 +  < $testdir/support/macro.dfs > $dir/support/MACRO.DFS
1693 +sed -e "s,ACATS4GNATDIR,$dir,g" \
1694 +  < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
1695 +
1696 +cp $testdir/tests/cd/*.c $dir/support
1697 +cp $testdir/tests/cxb/*.c $dir/support
1698 +grep -v '^#' $testdir/norun.lst | sort > $dir/support/norun.lst
1699 +
1700 +rm -rf $dir/run
1701 +mv $dir/tests $dir/tests.$$ 2> /dev/null
1702 +rm -rf $dir/tests.$$ &
1703 +mkdir -p $dir/run
1704 +
1705 +cp -pr $testdir/tests $dir/
1706 +
1707 +for i in $dir/support/*.ada $dir/support/*.a; do
1708 +   host_gnatchop $i >> $dir/acats.log 2>&1
1709 +done
1710 +
1711 +# These tools are used to preprocess some ACATS sources
1712 +# they need to be compiled native on the host.
1713 +
1714 +host_gnatmake -q -gnatws macrosub.adb
1715 +if [ $? -ne 0 ]; then
1716 +   display "**** Failed to compile macrosub"
1717 +   exit 1
1718 +fi
1719 +./macrosub > macrosub.out 2>&1
1720 +
1721 +gcc -c cd300051.c
1722 +host_gnatmake -q -gnatws widechr.adb
1723 +if [ $? -ne 0 ]; then
1724 +   display "**** Failed to compile widechr"
1725 +   exit 1
1726 +fi
1727 +./widechr > widechr.out 2>&1
1728 +
1729 +rm -f $dir/support/macrosub
1730 +rm -f $dir/support/widechr
1731 +rm -f $dir/support/*.ali
1732 +rm -f $dir/support/*.o
1733 +
1734 +display " done."
1735 +
1736 +# From here, all compilations will be made by the target compiler
1737 +
1738 +display_noeol "Compiling support files..."
1739 +
1740 +target_gcc -c *.c
1741 +if [ $? -ne 0 ]; then
1742 +   display "**** Failed to compile C code"
1743 +   exit 1
1744 +fi
1745 +
1746 +host_gnatchop *.adt >> $dir/acats.log 2>&1
1747 +
1748 +target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1
1749 +target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1
1750 +
1751 +display " done."
1752 +display ""
1753 +display "              === acats tests ==="
1754 +
1755 +if [ $# -eq 0 ]; then
1756 +   chapters=`cd $dir/tests; echo [a-z]*`
1757 +else
1758 +   chapters=$*
1759 +fi
1760 +
1761 +glob_countn=0
1762 +glob_countok=0
1763 +glob_countu=0
1764 +countdown=0
1765 +
1766 +for chapter in $chapters; do
1767 +   if [ -d $dir/tests/$chapter ]; then
1768 +      cd $dir/tests/$chapter
1769 +      ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \
1770 +      cut -c1-7 | sort | uniq | comm -23 - $dir/support/norun.lst \
1771 +        > $dir/tests/$chapter/${chapter}.lst
1772 +      countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
1773 +      countdown=`expr $countdown + $countn`
1774 +   fi
1775 +done
1776 +
1777 +cat > $dir/execute.sh << EOF
1778 +inform () {
1779 +  printf "left: %04d" \$1
1780 +}
1781 +disinform () {
1782 +  printf "\r"
1783 +}
1784 +cycle () {
1785 +  local countx=0
1786 +  local total=\$(echo \$testlist | awk '{print NF}')
1787 +  mkdir -p logs
1788 +  echo "Executing \$total tests on remote device"
1789 +  inform \$total
1790 +  for x in \$testlist; do
1791 +    timeout -t 30 ./\${x} > logs/\${x}.log 2>&1
1792 +    countx=\$(expr \$countx + 1)
1793 +    if [ \$countx -eq 25 ]; then
1794 +      total=\$(expr \$total - 25)
1795 +      countx=0
1796 +      disinform
1797 +      inform \$total
1798 +    fi
1799 +  done
1800 +  disinform
1801 +  tar -czf remote.logs.tar.gz logs
1802 +}
1803 +testlist=" \\
1804 +EOF
1805 +
1806 +display "All tests are being cross-compiled without execution first."
1807 +
1808 +for chapter in $chapters; do
1809 +   if [ ! -d $dir/tests/$chapter ]; then
1810 +      continue
1811 +   fi
1812 +
1813 +   countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`
1814 +   glob_countn=`expr $glob_countn + $countn`
1815 +   counti=0
1816 +   for i in `cat $dir/tests/$chapter/${chapter}.lst`; do
1817 +      counti=`expr $counti + 1`
1818 +      extraflags="-gnat95"
1819 +      grep $i $testdir/overflow.lst > /dev/null 2>&1
1820 +      if [ $? -eq 0 ]; then
1821 +         extraflags="$extraflags -gnato"
1822 +      fi
1823 +      grep $i $testdir/elabd.lst > /dev/null 2>&1
1824 +      if [ $? -eq 0 ]; then
1825 +         extraflags="$extraflags -gnatE"
1826 +      fi
1827 +      grep $i $testdir/floatstore.lst > /dev/null 2>&1
1828 +      if [ $? -eq 0 ]; then
1829 +         extraflags="$extraflags -ffloat-store"
1830 +      fi
1831 +      grep $i $testdir/stackcheck.lst > /dev/null 2>&1
1832 +      if [ $? -eq 0 ]; then
1833 +         extraflags="$extraflags -fstack-check"
1834 +      fi
1835 +      inform $countdown $i
1836 +      countdown=`expr $countdown - 1`
1837 +      test=$dir/tests/$chapter/$i
1838 +      mkdir $test && cd $test >> $dir/acats.log 2>&1
1839 +
1840 +      if [ $? -ne 0 ]; then
1841 +         disinform
1842 +         display "FAIL:        $i"
1843 +         failed="${failed}${i} "
1844 +         clean_dir
1845 +         continue
1846 +      fi
1847 +
1848 +      host_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1
1849 +      find_main
1850 +      if [ -z "$main" ]; then
1851 +         sync
1852 +         find_main
1853 +      fi
1854 +      binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`
1855 +      echo "BUILD $main" >> $dir/acats.log
1856 +      EXTERNAL_OBJECTS=""
1857 +      case $i in
1858 +        cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;
1859 +        ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;
1860 +        ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;
1861 +        cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc
1862 +      esac
1863 +      if [ "$main" = "" ]; then
1864 +         disinform
1865 +         display "FAIL:        $i"
1866 +         failed="${failed}${i} "
1867 +         clean_dir
1868 +         continue
1869 +      fi
1870 +
1871 +      target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
1872 +      if [ $? -ne 0 ]; then
1873 +         disinform
1874 +         display "FAIL:        $i"
1875 +         failed="${failed}${i} "
1876 +         clean_dir
1877 +         continue
1878 +      fi
1879 +      echo $chapter/$i/$binmain >> $dir/transfer.lst
1880 +      echo "$binmain \\" >> $dir/execute.sh
1881 +      $STRIP $binmain
1882 +      disinform
1883 +   done
1884 +done
1885 +echo '"' >> $dir/execute.sh
1886 +echo "cycle" >> $dir/execute.sh
1887 +
1888 +sync
1889 +display "Transfer files to remote device: root@tablet:$tabtarget/"
1890 +cd $dir/tests
1891 +cat $dir/transfer.lst | xargs tar --strip-components=2 -czf - |  \
1892 +  target_cmd "tar -C $tabtarget -xzf -"
1893 +cd $dir
1894 +tar -czf - execute.sh | target_cmd "tar -C $tabtarget -xzf -"
1895 +target_cmd "cd $tabtarget; sh execute.sh"
1896 +rm -rf $dir/logs $dir/remote.logs.tar.gz
1897 +/usr/bin/scp -q root@tablet:$tabtarget/remote.logs.tar.gz $dir/
1898 +tar -xzf $dir/remote.logs.tar.gz
1899 +
1900 +countdown=`wc -l < $dir/transfer.lst`
1901 +glob_countn=${countdown}
1902 +for i in `cat $dir/transfer.lst`; do
1903 +  split_testid $i
1904 +  if [ "$section" != "$savedsect" ]; then
1905 +   display Running chapter $section ...
1906 +  fi
1907 +  savedsect=$section
1908 +
1909 +  #inform $countdown $TN
1910 +  countdown=`expr $countdown - 1`
1911 +  proglog="$dir/logs/${prog}.log"
1912 +  echo "RUN $prog" >> $dir/acats.log
1913 +  if [ ! -f $proglog ]; then
1914 +    echo "LOG NOT FOUND!" >> $proglog
1915 +  fi
1916 +
1917 +  cat $proglog >> $dir/acats.log
1918 +
1919 +  egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' $proglog > /dev/null 2>&1
1920 +  if [ $? -ne 0 ]; then
1921 +     grep 'tasking not implemented' $proglog > /dev/null 2>&1
1922 +
1923 +     if [ $? -ne 0 ]; then
1924 +        display "FAIL: ${TN}"
1925 +        failed="${failed}${TN} "
1926 +     else
1927 +        log "UNSUPPORTED:      ${TN}"
1928 +        glob_countn=`expr $glob_countn - 1`
1929 +        glob_countu=`expr $glob_countu + 1`
1930 +     fi
1931 +  else
1932 +     log "PASS:        ${TN}"
1933 +     glob_countok=`expr $glob_countok + 1`
1934 +  fi
1935 +  cd $dir/tests/$section/$TN
1936 +  clean_dir
1937 +  #disinform
1938 +done
1939 +
1940 +display "              === acats Summary ==="
1941 +display "# of expected passes          $glob_countok"
1942 +display "# of unexpected failures      `expr $glob_countn - $glob_countok`"
1943 +
1944 +if [ $glob_countu -ne 0 ]; then
1945 +   display "# of unsupported tests             $glob_countu"
1946 +fi
1947 +
1948 +if [ $glob_countok -ne $glob_countn ]; then
1949 +   display "*** FAILURES: $failed"
1950 +fi
1951 +
1952 +display "$0 completed at `date`"
1953 +
1954 +exit 0
1955 --- gcc/testsuite/gnat.dg/test_raise_from_pure.adb.orig
1956 +++ gcc/testsuite/gnat.dg/test_raise_from_pure.adb
1957 @@ -1,4 +1,4 @@
1958 --- { dg-do run }
1959 +-- { dg-do run { xfail *-*-openbsd* } }
1960  -- { dg-options "-O2" }
1961  
1962  -- This is an optimization test and its failure is only a missed optimization.
1963 --- gcc/testsuite/gnat.dg/unchecked_convert5.adb.orig
1964 +++ gcc/testsuite/gnat.dg/unchecked_convert5.adb
1965 @@ -1,22 +0,0 @@
1966 --- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
1967 -
1968 -with Unchecked_Conversion;
1969 -
1970 -procedure Unchecked_Convert5 is
1971 -
1972 -  subtype c_1 is string(1..1);
1973 -
1974 -  function int2c1 is  -- { dg-warning "different sizes" }
1975 -    new unchecked_conversion (source => integer, target => c_1);
1976 -
1977 -  c1 : c_1;
1978 -
1979 -begin
1980 -
1981 -  c1 := int2c1(16#12#);
1982 -
1983 -  if c1 (1) /= ASCII.Nul then
1984 -    raise Program_Error;
1985 -  end if;
1986 -
1987 -end;
1988 --- gcc/testsuite/gnat.dg/unchecked_convert6.adb.orig
1989 +++ gcc/testsuite/gnat.dg/unchecked_convert6.adb
1990 @@ -1,22 +0,0 @@
1991 --- { dg-do run { target hppa*-*-* sparc*-*-* powerpc*-*-* } }
1992 -
1993 -with Unchecked_Conversion;
1994 -
1995 -procedure Unchecked_Convert6 is
1996 -
1997 -  subtype c_5 is string(1..5);
1998 -
1999 -  function int2c5 is  -- { dg-warning "different sizes" }
2000 -    new unchecked_conversion (source => integer, target => c_5);
2001 -
2002 -  c5 : c_5;
2003 -
2004 -begin
2005 -
2006 -  c5 := int2c5(16#12#);
2007 -
2008 -  if c5 (4) /= ASCII.DC2 then
2009 -    raise Program_Error;
2010 -  end if;
2011 -
2012 -end;
2013
2014
2015 [FILE:11296:patches/patch-diff-core]
2016 --- gcc/config/dragonfly.h.orig
2017 +++ gcc/config/dragonfly.h
2018 @@ -84,13 +84,13 @@
2019     } \
2020     %{static:-Bstatic} \
2021    } \
2022 -  %{!static:--hash-style=gnu} \
2023 +  %{!static:--hash-style=gnu --enable-new-dtags -rpath @PREFIX@/lib} \
2024    %{symbolic:-Bsymbolic}"
2025  
2026  #undef  LINK_SPEC
2027  #define LINK_SPEC DFBSD_LINK_SPEC
2028  
2029 -#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
2030 +#define DFBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.2"
2031  
2032  
2033  /* Use --as-needed -lgcc_s for eh support.  */
2034 --- gcc/config/aarch64/aarch64-freebsd.h.orig
2035 +++ gcc/config/aarch64/aarch64-freebsd.h
2036 @@ -41,6 +41,7 @@
2037      %{symbolic:-Bsymbolic}                                      \
2038      %{static:-Bstatic}                                          \
2039      %{!static:                                                  \
2040 +    %{!static:--hash-style=gnu --enable-new-dtags -rpath @PREFIX@/lib}   \
2041        %{rdynamic:-export-dynamic}                               \
2042        %{!shared:-dynamic-linker " FBSD_DYNAMIC_LINKER " }}      \
2043      -X" SUBTARGET_EXTRA_LINK_SPEC "                             \
2044 @@ -99,4 +100,6 @@
2045  #undef MCOUNT_NAME
2046  #define MCOUNT_NAME ".mcount"
2047  
2048 +/* Static stack checking is supported by means of probes.  */
2049 +#define STACK_CHECK_STATIC_BUILTIN 1
2050  #endif  /* GCC_AARCH64_FREEBSD_H */
2051 --- gcc/config/i386/freebsd.h.orig
2052 +++ gcc/config/i386/freebsd.h
2053 @@ -88,6 +88,7 @@
2054          %{rdynamic:-export-dynamic} \
2055          -dynamic-linker %(fbsd_dynamic_linker) } \
2056      %{static:-Bstatic}} \
2057 +  %{!static:--hash-style=gnu --enable-new-dtags -rpath @PREFIX@/lib} \
2058    %{symbolic:-Bsymbolic}"
2059  
2060  /* A C statement to output to the stdio stream FILE an assembler
2061 --- gcc/config/i386/freebsd64.h.orig
2062 +++ gcc/config/i386/freebsd64.h
2063 @@ -41,4 +41,5 @@
2064          %{rdynamic:-export-dynamic} \
2065         -dynamic-linker %(fbsd_dynamic_linker) } \
2066      %{static:-Bstatic}} \
2067 +  %{!static:--hash-style=gnu -rpath @PREFIX@/lib} \
2068    %{symbolic:-Bsymbolic}"
2069 --- gcc/Makefile.in.orig
2070 +++ gcc/Makefile.in
2071 @@ -1200,7 +1200,6 @@
2072         insn-emit.o \
2073         insn-extract.o \
2074         insn-latencytab.o \
2075 -       insn-modes.o \
2076         insn-opinit.o \
2077         insn-output.o \
2078         insn-peep.o \
2079 @@ -1597,6 +1596,7 @@
2080    $(OBJS-libcommon-target) main.o c-family/cppspec.o \
2081    $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
2082    $(GCOV_TOOL_OBJS) $(GENGTYPE_OBJS) gcc-ar.o gcc-nm.o gcc-ranlib.o \
2083 +  insn-modes.o insn-modes-ada.o \
2084    lto-wrapper.o collect-utils.o
2085  
2086  # for anything that is shared use the cc1plus profile data, as that
2087 @@ -1612,6 +1612,11 @@
2088  ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS)
2089  
2090  BACKEND = libbackend.a main.o libcommon-target.a libcommon.a \
2091 +       insn-modes.o \
2092 +       $(CPPLIB) $(LIBDECNUMBER)
2093 +
2094 +BACKEND2 = libbackend.a main.o libcommon-target.a libcommon.a \
2095 +       insn-modes-ada.o \
2096         $(CPPLIB) $(LIBDECNUMBER)
2097  
2098  # This is defined to "yes" if Tree checking is enabled, which roughly means
2099 @@ -2312,6 +2317,7 @@
2100  
2101  insn-modes.c: s-modes; @true
2102  insn-modes.h: s-modes-h; @true
2103 +insn-modes-ada.c: s-modes-ada; @true
2104  min-insn-modes.c: s-modes-m; @true
2105  
2106  s-modes: build/genmodes$(build_exeext)
2107 @@ -2329,6 +2335,12 @@
2108         $(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c
2109         $(STAMP) s-modes-m
2110  
2111 +s-modes-ada: s-modes
2112 +       $(shell sed -e 's/: TARGET_96_ROUND_53_LONG_DOUBLE \? &ieee_extended_intel_96_round_53_format //' \
2113 +               < insn-modes.c > tmp-modes-ada.c)
2114 +       $(SHELL) $(srcdir)/../move-if-change tmp-modes-ada.c insn-modes-ada.c
2115 +       $(STAMP) s-modes-ada
2116 +
2117  insn-preds.c: s-preds; @true
2118  tm-preds.h: s-preds-h; @true
2119  tm-constrs.h: s-constrs-h; @true
2120 @@ -3536,6 +3548,9 @@
2121             ( cd $(DESTDIR)$(bindir) && \
2122               $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
2123           fi; \
2124 +         if [ -f gnat1$(exeext) ] ; then \
2125 +           ( cd $(DESTDIR)$(bindir) && $(LN) $(GCC_INSTALL_NAME)$(exeext) ada$(exeext) ) \
2126 +         fi; \
2127           if [ ! -f gcc-cross$(exeext) ] \
2128               && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
2129             rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
2130 --- gcc/config/i386/gnu-user64.h.orig
2131 +++ gcc/config/i386/gnu-user64.h
2132 @@ -57,6 +57,7 @@
2133                     %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
2134                     %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
2135    %{shared:-shared} \
2136 +  %{!static:--enable-new-dtags -rpath @PREFIX@/lib64} \
2137    %{!shared: \
2138      %{!static: \
2139        %{rdynamic:-export-dynamic} \
2140 --- gcc/dwarf2out.c.orig
2141 +++ gcc/dwarf2out.c
2142 @@ -12514,6 +12514,15 @@
2143  
2144        if (qualified_type == dtype)
2145         {
2146 +         tree origin = decl_ultimate_origin (name);
2147 +
2148 +         /* Typedef variants that have an abstract origin don't get their own
2149 +            type DIE (see gen_typedef_die), so fall back on the ultimate
2150 +            abstract origin instead.  */
2151 +         if (origin != NULL)
2152 +           return modified_type_die (TREE_TYPE (origin), cv_quals, reverse,
2153 +                                     context_die);
2154 +
2155           /* For a named type, use the typedef.  */
2156           gen_type_die (qualified_type, context_die);
2157           return lookup_type_die (qualified_type);
2158 @@ -24346,7 +24355,7 @@
2159  gen_typedef_die (tree decl, dw_die_ref context_die)
2160  {
2161    dw_die_ref type_die;
2162 -  tree origin;
2163 +  tree type;
2164  
2165    if (TREE_ASM_WRITTEN (decl))
2166      {
2167 @@ -24355,75 +24364,71 @@
2168        return;
2169      }
2170  
2171 +  /* As we avoid creating DIEs for local typedefs (see decl_ultimate_origin
2172 +     checks in process_scope_var and modified_type_die), this should be called
2173 +     only for original types.  */
2174 +  gcc_assert (decl_ultimate_origin (decl) == NULL);
2175 +
2176    TREE_ASM_WRITTEN (decl) = 1;
2177    type_die = new_die (DW_TAG_typedef, context_die, decl);
2178 -  origin = decl_ultimate_origin (decl);
2179 -  if (origin != NULL)
2180 -    add_abstract_origin_attribute (type_die, origin);
2181 -  else
2182 +
2183 +  add_name_and_src_coords_attributes (type_die, decl);
2184 +  if (DECL_ORIGINAL_TYPE (decl))
2185      {
2186 -      tree type = TREE_TYPE (decl);
2187 +      type = DECL_ORIGINAL_TYPE (decl);
2188 +      if (type == error_mark_node)
2189 +       return;
2190  
2191 +      gcc_assert (type != TREE_TYPE (decl));
2192 +      equate_type_number_to_die (TREE_TYPE (decl), type_die);
2193 +    }
2194 +  else
2195 +    {
2196 +      type = TREE_TYPE (decl);
2197        if (type == error_mark_node)
2198         return;
2199  
2200 -      add_name_and_src_coords_attributes (type_die, decl);
2201 -      if (DECL_ORIGINAL_TYPE (decl))
2202 +      if (is_naming_typedef_decl (TYPE_NAME (type)))
2203         {
2204 -         type = DECL_ORIGINAL_TYPE (decl);
2205 -
2206 -         if (type == error_mark_node)
2207 -           return;
2208 -
2209 -         gcc_assert (type != TREE_TYPE (decl));
2210 -         equate_type_number_to_die (TREE_TYPE (decl), type_die);
2211 +         /* Here, we are in the case of decl being a typedef naming
2212 +            an anonymous type, e.g:
2213 +                typedef struct {...} foo;
2214 +            In that case TREE_TYPE (decl) is not a typedef variant
2215 +            type and TYPE_NAME of the anonymous type is set to the
2216 +            TYPE_DECL of the typedef. This construct is emitted by
2217 +            the C++ FE.
2218 +
2219 +            TYPE is the anonymous struct named by the typedef
2220 +            DECL. As we need the DW_AT_type attribute of the
2221 +            DW_TAG_typedef to point to the DIE of TYPE, let's
2222 +            generate that DIE right away. add_type_attribute
2223 +            called below will then pick (via lookup_type_die) that
2224 +            anonymous struct DIE.  */
2225 +         if (!TREE_ASM_WRITTEN (type))
2226 +           gen_tagged_type_die (type, context_die, DINFO_USAGE_DIR_USE);
2227 +
2228 +         /* This is a GNU Extension.  We are adding a
2229 +            DW_AT_linkage_name attribute to the DIE of the
2230 +            anonymous struct TYPE.  The value of that attribute
2231 +            is the name of the typedef decl naming the anonymous
2232 +            struct.  This greatly eases the work of consumers of
2233 +            this debug info.  */
2234 +         add_linkage_name_raw (lookup_type_die (type), decl);
2235         }
2236 -      else
2237 -       {
2238 -         if (is_naming_typedef_decl (TYPE_NAME (type)))
2239 -           {
2240 -             /* Here, we are in the case of decl being a typedef naming
2241 -                an anonymous type, e.g:
2242 -                    typedef struct {...} foo;
2243 -                In that case TREE_TYPE (decl) is not a typedef variant
2244 -                type and TYPE_NAME of the anonymous type is set to the
2245 -                TYPE_DECL of the typedef. This construct is emitted by
2246 -                the C++ FE.
2247 -
2248 -                TYPE is the anonymous struct named by the typedef
2249 -                DECL. As we need the DW_AT_type attribute of the
2250 -                DW_TAG_typedef to point to the DIE of TYPE, let's
2251 -                generate that DIE right away. add_type_attribute
2252 -                called below will then pick (via lookup_type_die) that
2253 -                anonymous struct DIE.  */
2254 -             if (!TREE_ASM_WRITTEN (type))
2255 -               gen_tagged_type_die (type, context_die, DINFO_USAGE_DIR_USE);
2256 -
2257 -             /* This is a GNU Extension.  We are adding a
2258 -                DW_AT_linkage_name attribute to the DIE of the
2259 -                anonymous struct TYPE.  The value of that attribute
2260 -                is the name of the typedef decl naming the anonymous
2261 -                struct.  This greatly eases the work of consumers of
2262 -                this debug info.  */
2263 -             add_linkage_name_raw (lookup_type_die (type), decl);
2264 -           }
2265 -       }
2266 -
2267 -      add_type_attribute (type_die, type, decl_quals (decl), false,
2268 -                         context_die);
2269 +    }
2270  
2271 -      if (is_naming_typedef_decl (decl))
2272 -       /* We want that all subsequent calls to lookup_type_die with
2273 -          TYPE in argument yield the DW_TAG_typedef we have just
2274 -          created.  */
2275 -       equate_type_number_to_die (type, type_die);
2276 +  add_type_attribute (type_die, type, decl_quals (decl), false,
2277 +                     context_die);
2278  
2279 -      type = TREE_TYPE (decl);
2280 +  if (is_naming_typedef_decl (decl))
2281 +    /* We want that all subsequent calls to lookup_type_die with
2282 +       TYPE in argument yield the DW_TAG_typedef we have just
2283 +       created.  */
2284 +    equate_type_number_to_die (type, type_die);
2285  
2286 -      add_alignment_attribute (type_die, type);
2287 +  add_alignment_attribute (type_die, TREE_TYPE (decl));
2288  
2289 -      add_accessibility_attribute (type_die, decl);
2290 -    }
2291 +  add_accessibility_attribute (type_die, decl);
2292  
2293    if (DECL_ABSTRACT_P (decl))
2294      equate_decl_number_to_die (decl, type_die);
2295 @@ -24535,15 +24540,23 @@
2296        if (TREE_ASM_WRITTEN (type))
2297         return;
2298  
2299 +      tree name = TYPE_NAME (type);
2300 +      tree origin = decl_ultimate_origin (name);
2301 +      if (origin != NULL)
2302 +       {
2303 +         gen_decl_die (origin, NULL, NULL, context_die);
2304 +         return;
2305 +       }
2306 +
2307        /* Prevent broken recursion; we can't hand off to the same type.  */
2308 -      gcc_assert (DECL_ORIGINAL_TYPE (TYPE_NAME (type)) != type);
2309 +      gcc_assert (DECL_ORIGINAL_TYPE (name) != type);
2310  
2311        /* Give typedefs the right scope.  */
2312        context_die = scope_die_for (type, context_die);
2313  
2314        TREE_ASM_WRITTEN (type) = 1;
2315  
2316 -      gen_decl_die (TYPE_NAME (type), NULL, NULL, context_die);
2317 +      gen_decl_die (name, NULL, NULL, context_die);
2318        return;
2319      }
2320  
2321 @@ -24862,6 +24875,22 @@
2322    else
2323      die = NULL;
2324  
2325 +  /* Avoid creating DIEs for local typedefs and concrete static variables that
2326 +     will only be pruned later.  */
2327 +  if ((origin || decl_ultimate_origin (decl))
2328 +      && (TREE_CODE (decl_or_origin) == TYPE_DECL
2329 +         || (VAR_P (decl_or_origin) && TREE_STATIC (decl_or_origin))))
2330 +    {
2331 +      origin = decl_ultimate_origin (decl_or_origin);
2332 +      if (decl && VAR_P (decl) && die != NULL)
2333 +       {
2334 +         die = lookup_decl_die (origin);
2335 +         if (die != NULL)
2336 +           equate_decl_number_to_die (decl, die);
2337 +       }
2338 +      return;
2339 +    }
2340 +
2341    if (die != NULL && die->die_parent == NULL)
2342      add_child_die (context_die, die);
2343    else if (TREE_CODE (decl_or_origin) == IMPORTED_DECL)
2344
2345
2346 [FILE:1498:patches/patch-diff-cxx]
2347 --- libstdc++-v3/configure.host.orig
2348 +++ libstdc++-v3/configure.host
2349 @@ -258,6 +258,9 @@
2350    freebsd*)
2351      os_include_dir="os/bsd/freebsd"
2352      ;;
2353 +  linux-android*)
2354 +    os_include_dir="os/bionic"
2355 +    ;;
2356    linux-musl*)
2357      os_include_dir="os/generic"
2358      ;;
2359 --- libstdc++-v3/config/os/bionic/ctype_base.h.orig
2360 +++ libstdc++-v3/config/os/bionic/ctype_base.h
2361 @@ -38,6 +38,18 @@
2362      // Non-standard typedefs.
2363      typedef const int*                 __to_type;
2364  
2365 +#ifdef _CTYPE_U
2366 +#define _U _CTYPE_U
2367 +#define _L _CTYPE_L
2368 +#define _D _CTYPE_D
2369 +#define _S _CTYPE_S
2370 +#define _P _CTYPE_P
2371 +#define _C _CTYPE_C
2372 +#define _X _CTYPE_X
2373 +#define _B _CTYPE_B
2374 +#define _N _CTYPE_D
2375 +#endif
2376 +
2377      // NB: Offsets into ctype<char>::_M_table force a particular size
2378      // on the mask type. Because of this, we don't use an enum.
2379      typedef char               mask;
2380 --- libstdc++-v3/src/c++11/futex.cc.orig
2381 +++ libstdc++-v3/src/c++11/futex.cc
2382 @@ -27,7 +27,11 @@
2383  #if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
2384  #include <chrono>
2385  #include <climits>
2386 +#ifdef __ANDROID__
2387 +#include <sys/syscall.h>
2388 +#else
2389  #include <syscall.h>
2390 +#endif
2391  #include <unistd.h>
2392  #include <sys/time.h>
2393  #include <errno.h>
2394 --- libstdc++-v3/src/filesystem/dir.cc.orig
2395 +++ libstdc++-v3/src/filesystem/dir.cc
2396 @@ -146,7 +146,13 @@
2397  
2398    int err = std::exchange(errno, 0);
2399    const auto entp = readdir(dirp);
2400 +#ifdef __ANDROID__
2401 +  int tmperr = errno;
2402 +  errno = err;
2403 +  err = tmperr;
2404 +#else
2405    std::swap(errno, err);
2406 +#endif
2407  
2408    if (entp)
2409      {
2410
2411
2412 [FILE:1612:patches/patch-diff-gcc-testsuite]
2413 --- gcc/testsuite/gcc.dg/format/ext-1.c.orig
2414 +++ gcc/testsuite/gcc.dg/format/ext-1.c
2415 @@ -8,7 +8,7 @@
2416  #include "format.h"
2417  
2418  void
2419 -foo (quad_t q, u_quad_t uq, quad_t *qn, size_t z, size_t *zn, long long int ll,
2420 +foo (quad2_t q, u_quad2_t uq, quad2_t *qn, size_t z, size_t *zn, long long int ll,
2421       unsigned long long int ull, int i, unsigned int u, double d,
2422       char *s, void *p, wchar_t *ls, wint_t lc, int *n, long int l)
2423  {
2424 --- gcc/testsuite/gcc.dg/format/ext-2.c.orig
2425 +++ gcc/testsuite/gcc.dg/format/ext-2.c
2426 @@ -8,7 +8,7 @@
2427  #include "format.h"
2428  
2429  void
2430 -foo (quad_t *qp, u_quad_t *uqp, quad_t *qn, long long int *llp,
2431 +foo (quad2_t *qp, u_quad2_t *uqp, quad2_t *qn, long long int *llp,
2432       unsigned long long int *ullp, float *fp, char *s, void **pp, wchar_t *ls,
2433       int *ip, unsigned int *up)
2434  {
2435 --- gcc/testsuite/gcc.dg/format/format.h.orig
2436 +++ gcc/testsuite/gcc.dg/format/format.h
2437 @@ -71,8 +71,8 @@
2438  #endif
2439  
2440  /* %q formats want a "quad"; GCC considers this to be a long long.  */
2441 -typedef llong quad_t;
2442 -typedef ullong u_quad_t;
2443 +typedef llong quad2_t;
2444 +typedef ullong u_quad2_t;
2445  
2446  __extension__ typedef __INTMAX_TYPE__ intmax_t;
2447  __extension__ typedef __UINTMAX_TYPE__ uintmax_t;
2448 --- gcc/testsuite/gcc.dg/pch/pch.exp.orig
2449 +++ gcc/testsuite/gcc.dg/pch/pch.exp
2450 @@ -44,6 +44,8 @@
2451  set test "largefile.c"
2452  set testh "largefile.hs"
2453  set f [open $test w]
2454 +puts $f "/* { dg-do run { target *-*-solaris* } } */"
2455 +puts $f "/* { dg-error \"dummy\" \"fool dejagnu\" { target { ! *-*-solaris* } 20 } } */"
2456  puts $f "/* { dg-timeout-factor 4.0 } */"
2457  set v 0
2458  for { set v 0 } { $v < 10000 } { incr v } {
2459
2460
2461 [FILE:121:files/pkg-message-single.in]
2462   Add to path: %%PREFIX%%/bin
2463   All binaries have prefix of %%TARGET%%-
2464   e.g. %%TARGET%%-gcc
2465        %%TARGET%%-gnatmake
2466