Fixup fromcvs/togit conversion
[pkgsrcv2.git] / lang / gcc-aux / files / diff-core
1 --- gcc/DEV-PHASE.orig
2 +++ gcc/DEV-PHASE
3 @@ -0,0 +1 @@
4 +release
5 --- gcc/config.gcc.orig
6 +++ gcc/config.gcc
7 @@ -573,6 +573,9 @@
8      "" | yes | posix)
9        thread_file='posix'
10        ;;
11 +    gnat | single)
12 +      # Let these non-posix thread selections fall through if requested
13 +      ;;
14      *)
15        echo 'Unknown thread configuration for FreeBSD'
16        exit 1
17 @@ -589,6 +592,26 @@
18    # need_64bit_hwint=yes # system compiler has this for all arch!
19    use_gcc_stdint=wrap
20    ;;
21 +*-*-dragonfly*)
22 +  gas=yes
23 +  gnu_ld=yes
24 +  tmake_file="t-slibgcc"
25 +  case ${enable_threads} in
26 +    "" | yes | posix)
27 +      thread_file='posix'
28 +      ;;
29 +    no | gnat | single)
30 +      # Let these non-posix thread selections fall through if requested
31 +      ;;
32 +    *)
33 +      echo 'Unknown thread configuration for DragonFly BSD'
34 +      exit 1
35 +      ;;
36 +  esac
37 +  extra_options="$extra_options rpath.opt dragonfly.opt"
38 +  default_use_cxa_atexit=yes
39 +  use_gcc_stdint=wrap
40 +  ;;
41  *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
42    extra_options="$extra_options gnu-user.opt"
43    gas=yes
44 @@ -644,6 +667,7 @@
45    esac
46    ;;
47  *-*-netbsd*)
48 +  use_gcc_stdint=wrap
49    tmake_file="t-slibgcc"
50    gas=yes
51    gnu_ld=yes
52 @@ -885,7 +909,32 @@
53         tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h"
54         tmake_file="arm/t-arm arm/t-arm-elf"
55         ;;
56 -arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*)
57 +arm*-android-eabi*)
58 +  gas=yes
59 +  gnu_ld=yes
60 +  case ${enable_threads} in
61 +    "" | yes | posix) thread_file='posix' ;;
62 +  esac
63 +  tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h"
64 +  tm_file="$tm_file arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/bpabi.h arm/linux-eabi.h"
65 +  tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h arm/aout.h arm/arm.h"
66 +
67 +  tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC ANDROID_DEFAULT=1"
68 +  case $target in
69 +  arm*b-*)
70 +    tm_defines="$tm_defines TARGET_BIG_ENDIAN_DEFAULT=1"
71 +    ;;
72 +  esac
73 +  extra_options="$extra_options linux.opt linux-android.opt"
74 +  default_use_cxa_atexit=yes
75 +  use_gcc_tgmath=no
76 +  use_gcc_stdint=wrap
77 +
78 +  # The BPABI long long divmod functions return a 128-bit value in registers r0-r3.
79 +  # Correctly modeling that requires the use of TImode.
80 +  need_64bit_hwint=yes
81 +  ;;
82 +arm*-*-symbianelf* | arm*-*-rtemseabi*)
83         # The BPABI long long divmod functions return a 128-bit value in
84         # registers r0-r3.  Correctly modeling that requires the use of
85         # TImode.
86 @@ -894,11 +943,6 @@
87         tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
88         tmake_file="arm/t-arm arm/t-arm-elf"
89         case ${target} in
90 -       arm*-*-eabi*)
91 -         tm_file="$tm_file newlib-stdint.h"
92 -         tmake_file="${tmake_file} arm/t-bpabi"
93 -         use_gcc_stdint=wrap
94 -         ;;
95         arm*-*-rtemseabi*)
96           tm_file="${tm_file} rtems.h arm/rtems-eabi.h newlib-stdint.h"
97           tmake_file="${tmake_file} arm/t-bpabi t-rtems arm/t-rtems-eabi"
98 @@ -1196,19 +1240,31 @@
99  x86_64-*-elf*)
100         tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
101         ;;
102 +i[34567]86-*-dragonfly*)
103 +       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
104 +       tmake_file="${tmake_file} i386/t-crtstuff"
105 +       ;;
106 +x86_64-*-dragonfly*)
107 +       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h"
108 +       tmake_file="${tmake_file} i386/t-crtstuff"
109 +       ;;
110  i[34567]86-*-freebsd*)
111         tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
112 +       tmake_file="${tmake_file} i386/t-crtstuff"
113         ;;
114  x86_64-*-freebsd*)
115         tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
116 +       tmake_file="${tmake_file} i386/t-crtstuff"
117         ;;
118  i[34567]86-*-netbsdelf*)
119 -       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
120 +       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h netbsd-stdint.h"
121         extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
122 +       tmake_file="${tmake_file} i386/t-crtstuff"
123         ;;
124  x86_64-*-netbsd*)
125 -       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
126 +       tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h netbsd-stdint.h"
127         extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
128 +       tmake_file="${tmake_file} i386/t-crtstuff"
129         ;;
130  i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
131         tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h"
132 @@ -3530,6 +3586,8 @@
133                 ;;
134         i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
135                 ;;
136 +       i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
137 +               ;;
138         i[34567]86-*-freebsd* | x86_64-*-freebsd*)
139                 ;;
140         ia64*-*-linux*)
141 --- /dev/null
142 +++ gcc/config/dragonfly-stdint.h
143 @@ -0,0 +1,56 @@
144 +/* Definitions for <stdint.h> types for DragonFly systems.
145 +   Copyright (C) 2009 Free Software Foundation, Inc.
146 +   Contributed by Gerald Pfeifer <gerald@pfeifer.com>.
147 +
148 +This file is part of GCC.
149 +
150 +GCC is free software; you can redistribute it and/or modify
151 +it under the terms of the GNU General Public License as published by
152 +the Free Software Foundation; either version 3, or (at your option)
153 +any later version.
154 +
155 +GCC is distributed in the hope that it will be useful,
156 +but WITHOUT ANY WARRANTY; without even the implied warranty of
157 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
158 +GNU General Public License for more details.
159 +
160 +Under Section 7 of GPL version 3, you are granted additional
161 +permissions described in the GCC Runtime Library Exception, version
162 +3.1, as published by the Free Software Foundation.
163 +
164 +You should have received a copy of the GNU General Public License and
165 +a copy of the GCC Runtime Library Exception along with this program;
166 +see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
167 +<http://www.gnu.org/licenses/>.  */
168 +
169 +#define SIG_ATOMIC_TYPE   "int"
170 +
171 +#define INT8_TYPE         "signed char"
172 +#define INT16_TYPE        "short int"
173 +#define INT32_TYPE        "int"
174 +#define INT64_TYPE        (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
175 +#define UINT8_TYPE        "unsigned char"
176 +#define UINT16_TYPE       "short unsigned int"
177 +#define UINT32_TYPE       "unsigned int"
178 +#define UINT64_TYPE       (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
179 +
180 +#define INT_LEAST8_TYPE   INT8_TYPE
181 +#define INT_LEAST16_TYPE  INT16_TYPE
182 +#define INT_LEAST32_TYPE  INT32_TYPE
183 +#define INT_LEAST64_TYPE  INT64_TYPE
184 +#define UINT_LEAST8_TYPE  UINT8_TYPE
185 +#define UINT_LEAST16_TYPE UINT16_TYPE
186 +#define UINT_LEAST32_TYPE UINT32_TYPE
187 +#define UINT_LEAST64_TYPE UINT64_TYPE
188 +
189 +#define INT_FAST8_TYPE    INT32_TYPE
190 +#define INT_FAST16_TYPE   INT32_TYPE
191 +#define INT_FAST32_TYPE   INT32_TYPE
192 +#define INT_FAST64_TYPE   INT64_TYPE
193 +#define UINT_FAST8_TYPE   UINT32_TYPE
194 +#define UINT_FAST16_TYPE  UINT32_TYPE
195 +#define UINT_FAST32_TYPE  UINT32_TYPE
196 +#define UINT_FAST64_TYPE  UINT64_TYPE
197 +
198 +#define INTPTR_TYPE       (LONG_TYPE_SIZE == 64 ?  INT64_TYPE :  INT32_TYPE)
199 +#define UINTPTR_TYPE      (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
200 --- /dev/null
201 +++ gcc/config/dragonfly.h
202 @@ -0,0 +1,136 @@
203 +/* Base configuration file for all DragonFly targets.
204 +   Copyright (C) 1999, 2000, 2001, 2007, 2008 Free Software Foundation, Inc.
205 +
206 +This file is part of GCC.
207 +
208 +GCC is free software; you can redistribute it and/or modify
209 +it under the terms of the GNU General Public License as published by
210 +the Free Software Foundation; either version 3, or (at your option)
211 +any later version.
212 +
213 +GCC is distributed in the hope that it will be useful,
214 +but WITHOUT ANY WARRANTY; without even the implied warranty of
215 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
216 +GNU General Public License for more details.
217 +
218 +You should have received a copy of the GNU General Public License
219 +along with GCC; see the file COPYING3.  If not see
220 +<http://www.gnu.org/licenses/>.  */
221 +
222 +/* Common DragonFly configuration.
223 +   All DragonFly architectures should include this file, which will specify
224 +   their commonalities.
225 +   Adapted from gcc/config/i386/freebsd-elf.h by
226 +   David O'Brien <obrien@FreeBSD.org>.
227 +   Further work by David O'Brien <obrien@FreeBSD.org> and
228 +   Loren J. Rittle <ljrittle@acm.org>.  */
229 +
230 +#undef  TARGET_OS_CPP_BUILTINS
231 +#define TARGET_OS_CPP_BUILTINS()            \
232 +  do                                        \
233 +    {                                       \
234 +       builtin_define_std ("unix");         \
235 +       builtin_define ("__DragonFly__");    \
236 +       builtin_assert ("system=unix");      \
237 +       builtin_assert ("system=bsd");       \
238 +       builtin_assert ("system=DragonFly"); \
239 +    }                                       \
240 +  while (0)
241 +
242 +#undef  CPP_SPEC
243 +#define CPP_SPEC \
244 + "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}"
245 +
246 +#undef  STARTFILE_SPEC
247 +#define STARTFILE_SPEC \
248 +  "%{!shared: \
249 +     %{pg:gcrt1.o%s} \
250 +     %{!pg: \
251 +       %{p:gcrt1.o%s} \
252 +       %{!p: \
253 +         %{profile: gcrt1.o%s} \
254 +         %{!profile: \
255 +           %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
256 +   crti.o%s \
257 +   %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
258 +
259 +#undef  ENDFILE_SPEC
260 +#define ENDFILE_SPEC \
261 +  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
262 +
263 +#undef  LIB_SPEC
264 +#define LIB_SPEC \
265 +  "%{pthread:-lpthread} -lc"
266 +
267 +#if defined(HAVE_LD_EH_FRAME_HDR)
268 +#define LINK_EH_SPEC "--eh-frame-hdr"
269 +#endif
270 +
271 +/* Provide a LINK_SPEC appropriate for DragonFly.  Here we provide support
272 +   for the special GCC options -static and -shared, which allow us to
273 +   link things in one of these three modes by applying the appropriate
274 +   combinations of options at link-time.
275 +
276 +   When the -shared link option is used a final link is not being
277 +   done.  */
278 +
279 +#define DFBSD_LINK_SPEC \
280 + "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
281 +  %{v:-V} \
282 +  %{assert*} %{R*} %{rpath*} %{defsym*} \
283 +  %{shared:-Bshareable %{h*} %{soname*}} \
284 +  %{!shared: \
285 +   %{!static: \
286 +    %{rdynamic:-export-dynamic} \
287 +    -dynamic-linker %(dfbsd_dynamic_linker) \
288 +   } \
289 +   %{static:-Bstatic} \
290 +  } \
291 +  %{!static:--hash-style=both -rpath @PREFIX@/gcc-aux/lib} \
292 +  %{symbolic:-Bsymbolic}"
293 +
294 +#undef  LINK_SPEC
295 +#define LINK_SPEC DFBSD_LINK_SPEC
296 +
297 +#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
298 +
299 +
300 +/* Use --as-needed -lgcc_s for eh support.  */
301 +#ifdef HAVE_LD_AS_NEEDED
302 +#define USE_LD_AS_NEEDED 1
303 +#endif
304 +
305 +/************************[  Target stuff  ]***********************************/
306 +
307 +/* All DragonFly Architectures support the ELF object file format.  */
308 +#undef  OBJECT_FORMAT_ELF
309 +#define OBJECT_FORMAT_ELF
310 +
311 +/* Don't assume anything about the header files.  */
312 +#undef  NO_IMPLICIT_EXTERN_C
313 +#define NO_IMPLICIT_EXTERN_C   1
314 +
315 +/* Follow DragonFly's standard headers (<machine/stdint.h>, etc...).  */
316 +
317 +#undef  WCHAR_TYPE
318 +#define WCHAR_TYPE "int"
319 +
320 +#undef  WINT_TYPE
321 +#define WINT_TYPE "int"
322 +
323 +/* 
324 + * Profile libraries are found at /usr/lib/profile with standard names
325 + * #define MATH_LIBRARY_PROFILE    "m_p" 
326 + */
327 +
328 +/* Code generation parameters.  */
329 +
330 +/* Use periods rather than dollar signs in special g++ assembler names.
331 +   This ensures the configuration knows our system correctly so we can link
332 +   with libraries compiled with the native cc.  */
333 +#undef NO_DOLLAR_IN_LABEL
334 +
335 +/* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
336 +   This enables the test coverage code to use file locking when exiting a
337 +   program, which avoids race conditions if the program has forked.  */
338 +#define TARGET_POSIX_IO
339 --- /dev/null
340 +++ gcc/config/dragonfly.opt
341 @@ -0,0 +1,65 @@
342 +; DragonFlyBSD options.
343 +
344 +; Copyright (C) 2010, 2011
345 +; Free Software Foundation, Inc.
346 +;
347 +; This file is part of GCC.
348 +;
349 +; GCC is free software; you can redistribute it and/or modify it under
350 +; the terms of the GNU General Public License as published by the Free
351 +; Software Foundation; either version 3, or (at your option) any later
352 +; version.
353 +;
354 +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
355 +; WARRANTY; without even the implied warranty of MERCHANTABILITY or
356 +; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
357 +; for more details.
358 +;
359 +; You should have received a copy of the GNU General Public License
360 +; along with GCC; see the file COPYING3.  If not see
361 +; <http://www.gnu.org/licenses/>.
362 +
363 +; See the GCC internals manual (options.texi) for a description of this file's format.
364 +
365 +; Please try to keep this file in ASCII collating order.
366 +
367 +assert
368 +Driver Separate
369 +
370 +assert=
371 +Driver JoinedOrMissing
372 +
373 +defsym
374 +Driver Separate
375 +
376 +defsym=
377 +Driver JoinedOrMissing
378 +
379 +posix
380 +Driver
381 +
382 +profile
383 +Driver
384 +
385 +pthread
386 +Driver
387 +
388 +rdynamic
389 +Driver
390 +
391 +rpath-link
392 +Driver Separate
393 +
394 +rpath-link=
395 +Driver JoinedOrMissing
396 +
397 +rpath=
398 +Driver JoinedOrMissing
399 +
400 +soname
401 +Driver Separate
402 +
403 +soname=
404 +Driver JoinedOrMissing
405 +
406 +; This comment is to ensure we retain the blank line above.
407 --- /dev/null
408 +++ gcc/config/netbsd-stdint.h
409 @@ -0,0 +1,56 @@
410 +/* Definitions for <stdint.h> types for NetBSD systems.
411 +   Copyright (C) 2009 Free Software Foundation, Inc.
412 +   Contributed by Gerald Pfeifer <gerald@pfeifer.com>.
413 +
414 +This file is part of GCC.
415 +
416 +GCC is free software; you can redistribute it and/or modify
417 +it under the terms of the GNU General Public License as published by
418 +the Free Software Foundation; either version 3, or (at your option)
419 +any later version.
420 +
421 +GCC is distributed in the hope that it will be useful,
422 +but WITHOUT ANY WARRANTY; without even the implied warranty of
423 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
424 +GNU General Public License for more details.
425 +
426 +Under Section 7 of GPL version 3, you are granted additional
427 +permissions described in the GCC Runtime Library Exception, version
428 +3.1, as published by the Free Software Foundation.
429 +
430 +You should have received a copy of the GNU General Public License and
431 +a copy of the GCC Runtime Library Exception along with this program;
432 +see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
433 +<http://www.gnu.org/licenses/>.  */
434 +
435 +#define SIG_ATOMIC_TYPE   "int"
436 +
437 +#define INT8_TYPE         "signed char"
438 +#define INT16_TYPE        "short int"
439 +#define INT32_TYPE        "int"
440 +#define INT64_TYPE        (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
441 +#define UINT8_TYPE        "unsigned char"
442 +#define UINT16_TYPE       "short unsigned int"
443 +#define UINT32_TYPE       "unsigned int"
444 +#define UINT64_TYPE       (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
445 +
446 +#define INT_LEAST8_TYPE   "signed char"
447 +#define INT_LEAST16_TYPE  "short int"
448 +#define INT_LEAST32_TYPE  "int"
449 +#define INT_LEAST64_TYPE  (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
450 +#define UINT_LEAST8_TYPE  "unsigned char"
451 +#define UINT_LEAST16_TYPE "short unsigned int"
452 +#define UINT_LEAST32_TYPE "unsigned int"
453 +#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
454 +
455 +#define INT_FAST8_TYPE    "int"
456 +#define INT_FAST16_TYPE   "int"
457 +#define INT_FAST32_TYPE   "int"
458 +#define INT_FAST64_TYPE   (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
459 +#define UINT_FAST8_TYPE   "unsigned int"
460 +#define UINT_FAST16_TYPE  "unsigned int"
461 +#define UINT_FAST32_TYPE  "unsigned int"
462 +#define UINT_FAST64_TYPE  (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
463 +
464 +#define INTPTR_TYPE       (LONG_TYPE_SIZE == 64 ? "long int" : "int")
465 +#define UINTPTR_TYPE      (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
466 --- /dev/null
467 +++ gcc/config/i386/dragonfly.h
468 @@ -0,0 +1,105 @@
469 +/* Definitions for Intel 386 running DragonFly with ELF format
470 +   Copyright (C) 1996, 2000, 2002, 2004, 2007, 2010, 2011
471 +   Free Software Foundation, Inc.
472 +   Contributed by Eric Youngdale.
473 +   Modified for stabs-in-ELF by H.J. Lu.
474 +   Adapted from GNU/Linux version by John Polstra.
475 +   Continued development by David O'Brien <obrien@freebsd.org>
476 +
477 +This file is part of GCC.
478 +
479 +GCC is free software; you can redistribute it and/or modify
480 +it under the terms of the GNU General Public License as published by
481 +the Free Software Foundation; either version 3, or (at your option)
482 +any later version.
483 +
484 +GCC is distributed in the hope that it will be useful,
485 +but WITHOUT ANY WARRANTY; without even the implied warranty of
486 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
487 +GNU General Public License for more details.
488 +
489 +You should have received a copy of the GNU General Public License
490 +along with GCC; see the file COPYING3.  If not see
491 +<http://www.gnu.org/licenses/>.  */
492 +
493 +
494 +/* Override the default comment-starter of "/".  */
495 +#undef  ASM_COMMENT_START
496 +#define ASM_COMMENT_START "#"
497 +
498 +#undef  ASM_APP_ON
499 +#define ASM_APP_ON "#APP\n"
500 +
501 +#undef  ASM_APP_OFF
502 +#define ASM_APP_OFF "#NO_APP\n"
503 +
504 +#undef  DBX_REGISTER_NUMBER
505 +#define DBX_REGISTER_NUMBER(n) \
506 +  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
507 +
508 +#undef  NO_PROFILE_COUNTERS
509 +#define NO_PROFILE_COUNTERS    1
510 +
511 +/* Tell final.c that we don't need a label passed to mcount.  */
512 +
513 +#undef  MCOUNT_NAME
514 +#define MCOUNT_NAME ".mcount"
515 +
516 +/* Make gcc agree with <machine/ansi.h>.  */
517 +
518 +#undef  SIZE_TYPE
519 +#define SIZE_TYPE      (TARGET_64BIT ? "long unsigned int" : "unsigned int")
520 +
521 +#undef  PTRDIFF_TYPE
522 +#define PTRDIFF_TYPE   (TARGET_64BIT ? "long int" : "int")
523 +
524 +#undef  WCHAR_TYPE_SIZE
525 +#define WCHAR_TYPE_SIZE        (TARGET_64BIT ? 32 : BITS_PER_WORD)
526 +
527 +#undef  SUBTARGET_EXTRA_SPECS  /* i386.h bogusly defines it.  */
528 +#define SUBTARGET_EXTRA_SPECS \
529 +  { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
530 +
531 +
532 +/* A C statement to output to the stdio stream FILE an assembler
533 +   command to advance the location counter to a multiple of 1<<LOG
534 +   bytes if it is within MAX_SKIP bytes.
535 +
536 +   This is used to align code labels according to Intel recommendations.  */
537 +
538 +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
539 +#undef  ASM_OUTPUT_MAX_SKIP_ALIGN
540 +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)                                 \
541 +  if ((LOG) != 0) {                                                                                                            \
542 +    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));   \
543 +    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));   \
544 +  }
545 +#endif
546 +
547 +/* Don't default to pcc-struct-return, we want to retain compatibility with
548 +   older gcc versions AND pcc-struct-return is nonreentrant.
549 +   (even though the SVR4 ABI for the i386 says that records and unions are
550 +   returned in memory).  */
551 +
552 +#undef  DEFAULT_PCC_STRUCT_RETURN
553 +#define DEFAULT_PCC_STRUCT_RETURN 0
554 +
555 +/* DragonFly sets the rounding precision of the FPU to 53 bits.  Let the
556 +   compiler get the contents of <float.h> and std::numeric_limits correct.  */
557 +#undef TARGET_96_ROUND_53_LONG_DOUBLE
558 +#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
559 +
560 +/* Put all *tf routines in libgcc.  */
561 +#undef LIBGCC2_HAS_TF_MODE
562 +#define LIBGCC2_HAS_TF_MODE 1
563 +#define LIBGCC2_TF_CEXT q
564 +#define TF_SIZE 113
565 +
566 +/* Static stack checking is supported by means of probes.  */
567 +#define STACK_CHECK_STATIC_BUILTIN 1
568 +
569 +/* Support for i386 has been removed from DragonFly for several releases  */
570 +#define SUBTARGET32_DEFAULT_CPU "i486"
571 +
572 +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
573 +
574 --- gcc/config/i386/freebsd.h.orig
575 +++ gcc/config/i386/freebsd.h
576 @@ -102,6 +102,7 @@
577          %{rdynamic:-export-dynamic} \
578          -dynamic-linker %(fbsd_dynamic_linker) } \
579      %{static:-Bstatic}} \
580 +  %{!static:--hash-style=both -rpath @PREFIX@/gcc-aux/lib} \
581    %{symbolic:-Bsymbolic}"
582  
583  /* A C statement to output to the stdio stream FILE an assembler
584 @@ -148,3 +149,5 @@
585  
586  #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
587  
588 +/* Compile in __enable_execute_stack (void *) (see config.host) */
589 +#define HAVE_ENABLE_EXECUTE_STACK
590 --- gcc/config/i386/netbsd-elf.h.orig
591 +++ gcc/config/i386/netbsd-elf.h
592 @@ -38,7 +38,8 @@
593  /* Provide a LINK_SPEC appropriate for a NetBSD/i386 ELF target.  */
594  
595  #undef LINK_SPEC
596 -#define LINK_SPEC NETBSD_LINK_SPEC_ELF
597 +#define LINK_SPEC NETBSD_LINK_SPEC_ELF \
598 +"%{!static:-rpath @PREFIX@/gcc-aux/lib}"
599  
600  #define NETBSD_ENTRY_POINT "__start"
601  
602 @@ -119,3 +120,9 @@
603  #define DEFAULT_PCC_STRUCT_RETURN 1
604  
605  #define HAVE_ENABLE_EXECUTE_STACK
606 +/* Define this to be nonzero if static stack checking is supported. */
607 +#define STACK_CHECK_STATIC_BUILTIN 1
608 +
609 +#if defined(HAVE_LD_EH_FRAME_HDR)
610 +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
611 +#endif
612 --- gcc/config/i386/netbsd64.h.orig
613 +++ gcc/config/i386/netbsd64.h
614 @@ -67,3 +67,10 @@
615  }
616  
617  #define HAVE_ENABLE_EXECUTE_STACK
618 +
619 +/* Define this to be nonzero if static stack checking is supported. */
620 +#define STACK_CHECK_STATIC_BUILTIN 1
621 +
622 +#if defined(HAVE_LD_EH_FRAME_HDR)
623 +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
624 +#endif
625 --- gcc/ginclude/stddef.h.orig
626 +++ gcc/ginclude/stddef.h
627 @@ -53,12 +53,21 @@
628     one less case to deal with in the following.  */
629  #if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
630  #include <machine/ansi.h>
631 +#if !defined(_MACHINE_ANSI_H_)
632 +#if defined(_I386_ANSI_H_) || defined(_X86_64_ANSI_H_)
633 +#define _MACHINE_ANSI_H_
634 +#endif
635 +#endif
636  #endif
637  /* On FreeBSD 5, machine/ansi.h does not exist anymore... */
638  #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
639  #include <sys/_types.h>
640  #endif
641  
642 +#if defined(__DragonFly__)
643 +#include <sys/types.h>
644 +#endif
645 +
646  /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
647     defined if the corresponding type is *not* defined.
648     FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
649 @@ -136,6 +145,7 @@
650  #ifndef _BSD_PTRDIFF_T_
651  #ifndef ___int_ptrdiff_t_h
652  #ifndef _GCC_PTRDIFF_T
653 +#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
654  #define _PTRDIFF_T
655  #define _T_PTRDIFF_
656  #define _T_PTRDIFF
657 @@ -144,10 +154,12 @@
658  #define _BSD_PTRDIFF_T_
659  #define ___int_ptrdiff_t_h
660  #define _GCC_PTRDIFF_T
661 +#define _PTRDIFF_T_DECLARED
662  #ifndef __PTRDIFF_TYPE__
663  #define __PTRDIFF_TYPE__ long int
664  #endif
665  typedef __PTRDIFF_TYPE__ ptrdiff_t;
666 +#endif /* _PTRDIFF_T_DECLARED */
667  #endif /* _GCC_PTRDIFF_T */
668  #endif /* ___int_ptrdiff_t_h */
669  #endif /* _BSD_PTRDIFF_T_ */
670 @@ -201,6 +213,7 @@
671  #define _GCC_SIZE_T
672  #define _SIZET_
673  #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
674 +  || defined(__DragonFly__) \
675    || defined(__FreeBSD_kernel__)
676  /* __size_t is a typedef on FreeBSD 5, must not trash it. */
677  #else
678 @@ -307,7 +320,7 @@
679  /* FreeBSD 5 can't be handled well using "traditional" logic above
680     since it no longer defines _BSD_RUNE_T_ yet still desires to export
681     rune_t in some cases... */
682 -#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
683 +#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5))
684  #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
685  #if __BSD_VISIBLE
686  #ifndef _RUNE_T_DECLARED
687 --- include/libiberty.h.orig
688 +++ include/libiberty.h
689 @@ -106,7 +106,16 @@
690     to find the declaration so provide a fully prototyped one.  If it
691     is 1, we found it so don't provide any declaration at all.  */
692  #if !HAVE_DECL_BASENAME
693 -#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
694 +#if defined (__GNU_LIBRARY__ ) \
695 + || defined (__linux__) \
696 + || defined (__DragonFly__) \
697 + || defined (__FreeBSD__) \
698 + || defined (__OpenBSD__) \
699 + || defined (__NetBSD__) \
700 + || defined (__CYGWIN__) \
701 + || defined (__CYGWIN32__) \
702 + || defined (__MINGW32__) \
703 + || defined (HAVE_DECL_BASENAME)
704  extern char *basename (const char *);
705  #else
706  /* Do not allow basename to be used if there is no prototype seen.  We
707 --- libgcc/config.host.orig
708 +++ libgcc/config.host
709 @@ -174,6 +174,17 @@
710    tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin"
711    extra_parts="crt3.o crttms.o crttme.o"
712    ;;
713 +arm*-android-eabi*)
714 +  tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm"
715 +  tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
716 +  tmake_file="$tmake_file arm/t-linux-androideabi arm/t-arm-softfp soft-fp/t-softfp"
717 +  extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
718 +  ;;
719 +*-*-dragonfly*)
720 +  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
721 +  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
722 +  extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
723 +  ;;
724  *-*-freebsd*)
725    # This is the generic ELF configuration of FreeBSD.  Later
726    # machine-specific sections may refine and add to this
727 @@ -202,7 +213,8 @@
728    extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
729    ;;
730  *-*-netbsd*)
731 -  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
732 +  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
733 +  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
734    # NetBSD 1.7 and later are set up to use GCC's crtstuff for
735    # ELF configurations.  We will clear extra_parts in the
736    # a.out configurations.
737 @@ -266,8 +278,10 @@
738  esac
739  
740  case ${host} in
741 -*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2* | \
742 -  alpha*-dec-osf5.1*)
743 +*-*-freebsd* | *-*-dragonfly* | *-*-netbsd* | *-*-openbsd*)
744 +  enable_execute_stack=enable-execute-stack-freebsd.c
745 +  ;;
746 +*-*-darwin* | *-*-solaris2* | alpha*-dec-osf5.1*)
747    enable_execute_stack=enable-execute-stack-mprotect.c
748    ;;
749  i[34567]86-*-mingw* | x86_64-*-mingw*)
750 @@ -354,11 +368,11 @@
751         tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
752         extra_parts="$extra_parts crti.o crtn.o"
753         ;;
754 -arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*)
755 +arm*-*-symbianelf* | arm*-*-rtemseabi*)
756         tmake_file="${tmake_file} arm/t-arm arm/t-elf t-fixedpoint-gnu-prefix"
757         tm_file="$tm_file arm/bpabi-lib.h"
758         case ${host} in
759 -       arm*-*-eabi* | arm*-*-rtemseabi*)
760 +       arm*-*-rtemseabi*)
761           tmake_file="${tmake_file} arm/t-bpabi"
762           extra_parts="crtbegin.o crtend.o crti.o crtn.o"
763           ;;
764 @@ -523,16 +537,29 @@
765  x86_64-*-elf*)
766         tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
767         ;;
768 +i[34567]86-*-dragonfly*)
769 +       tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
770 +       md_unwind_header=i386/dragonfly-unwind.h
771 +       ;;
772 +x86_64-*-dragonfly*)
773 +       tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
774 +       md_unwind_header=i386/dragonfly-unwind.h
775 +       ;;
776  i[34567]86-*-freebsd*)
777         tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
778 +       md_unwind_header=i386/freebsd-unwind.h
779         ;;
780  x86_64-*-freebsd*)
781         tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
782 +       md_unwind_header=i386/freebsd-unwind.h
783         ;;
784  i[34567]86-*-netbsdelf*)
785 +       tmake_file="${tmake_file} i386/t-crtstuff"
786 +       md_unwind_header=i386/netbsd-unwind.h
787         ;;
788  x86_64-*-netbsd*)
789         tmake_file="${tmake_file} i386/t-crtstuff"
790 +       md_unwind_header=i386/netbsd-unwind.h
791         ;;
792  i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
793         ;;
794 @@ -1160,6 +1187,7 @@
795    i[34567]86-*-gnu* | \
796    i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
797    i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw* | \
798 +  i[34567]86-*-dragonfly* | x86_64-*-dragonfly* | \
799    i[34567]86-*-freebsd* | x86_64-*-freebsd*)
800         tmake_file="${tmake_file} t-softfp-tf"
801         if test "${host_address}" = 32; then
802 --- libgcc/crtstuff.c.orig
803 +++ libgcc/crtstuff.c
804 @@ -81,11 +81,19 @@
805  }
806  #endif
807  
808 +#if defined(TARGET_DL_ITERATE_PHDR) && \
809 +   ( defined(__FreeBSD__)              \
810 +  || defined(__OpenBSD__)              \
811 +  || defined(__NetBSD__)               \
812 +  || defined(__DragonFly__))
813 +#define BSD_DL_ITERATE_PHDR_AVAILABLE
814 +#endif
815 +
816  #if defined(OBJECT_FORMAT_ELF) \
817      && !defined(OBJECT_FORMAT_FLAT) \
818      && defined(HAVE_LD_EH_FRAME_HDR) \
819      && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
820 -    && defined(__FreeBSD__) && __FreeBSD__ >= 7
821 +    && defined(BSD_DL_ITERATE_PHDR_AVAILABLE)
822  #include <link.h>
823  # define USE_PT_GNU_EH_FRAME
824  #endif
825 --- /dev/null
826 +++ libgcc/enable-execute-stack-freebsd.c
827 @@ -0,0 +1,58 @@
828 +/* Implement __enable_execute_stack using mprotect(2).
829 +   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
830 +
831 +   This file is part of GCC.
832 +
833 +   GCC is free software; you can redistribute it and/or modify it under
834 +   the terms of the GNU General Public License as published by the Free
835 +   Software Foundation; either version 3, or (at your option) any later
836 +   version.
837 +
838 +   GCC is distributed in the hope that it will be useful, but WITHOUT ANY
839 +   WARRANTY; without even the implied warranty of MERCHANTABILITY or
840 +   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
841 +   for more details.
842 +
843 +   Under Section 7 of GPL version 3, you are granted additional
844 +   permissions described in the GCC Runtime Library Exception, version
845 +   3.1, as published by the Free Software Foundation.
846 +
847 +   You should have received a copy of the GNU General Public License and
848 +   a copy of the GCC Runtime Library Exception along with this program;
849 +   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
850 +   <http://www.gnu.org/licenses/>.  */
851 +
852 +#include <sys/mman.h>
853 +#include <unistd.h>
854 +#include <stdlib.h>
855 +
856 +#define STACK_PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC)
857 +
858 +extern void __enable_execute_stack (void *);
859 +
860 +void
861 +__enable_execute_stack (void *addr)
862 +{
863 +  static int size;
864 +  static long mask;
865 +  char *page, *ends;
866 +  long page_addr, ends_addr;
867 +
868 +  if (size == 0)
869 +  {
870 +    size = getpagesize ();
871 +    mask = ~((long) size - 1);
872 +  }
873 +  page_addr = (long) addr;
874 +  ends_addr = (long) (addr + __LIBGCC_TRAMPOLINE_SIZE__);
875 +
876 +  page = (char *) (page_addr & mask);
877 +  ends = (char *) ((ends_addr & mask) + size);
878 +
879 +  /*
880 +   * Note that no errors should be emitted by mprotect; it is considered
881 +   * dangerous for library calls to send messages to stdout/stderr.
882 +   */
883 +  if (mprotect (page, ends - page, STACK_PROT_RWX) < 0)
884 +    abort ();
885 +}
886 --- libgcc/unwind-dw2-fde-dip.c.orig
887 +++ libgcc/unwind-dw2-fde-dip.c
888 @@ -54,11 +54,19 @@
889  #endif
890  
891  #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
892 -    && defined(__FreeBSD__) && __FreeBSD__ >= 7
893 +    && defined(TARGET_DL_ITERATE_PHDR) \
894 +    && (defined(__FreeBSD__) || defined(__DragonFly__))
895  # define ElfW __ElfN
896  # define USE_PT_GNU_EH_FRAME
897  #endif
898  
899 +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
900 +    && defined(TARGET_DL_ITERATE_PHDR) \
901 +    && (defined(__OpenBSD__) || defined(__NetBSD__))
902 +# define ElfW(n) Elf_##n
903 +# define USE_PT_GNU_EH_FRAME
904 +#endif
905 +
906  #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
907      && defined(TARGET_DL_ITERATE_PHDR) \
908      && defined(__sun__) && defined(__svr4__)
909 --- /dev/null
910 +++ libgcc/config/i386/dragonfly-unwind.h
911 @@ -0,0 +1,158 @@
912 +/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
913 +   Copyright (C) 2010 John Marino <draco@marino.st> */
914 +
915 +/* Do code reading to identify a signal frame, and set the frame
916 +   state data appropriately.  See unwind-dw2.c for the structs. */
917 +
918 +#include <sys/types.h>
919 +#include <sys/sysctl.h>
920 +#include <signal.h>
921 +#include <sys/ucontext.h>
922 +#include <machine/sigframe.h>
923 +
924 +
925 +#define REG_NAME(reg)  sf_uc.uc_mcontext.mc_## reg
926 +
927 +#ifdef __x86_64__
928 +#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
929 +
930 +
931 +static void
932 +x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
933 +{
934 +  unsigned long ps_strings;
935 +  int mib[2];
936 +  size_t len;
937 +
938 +  mib[0] = CTL_KERN;
939 +  mib[1] = KERN_PS_STRINGS;
940 +  len = sizeof (ps_strings);
941 +  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
942 +
943 +  *start = (unsigned char *)ps_strings - 32;
944 +  *end   = (unsigned char *)ps_strings;
945 +}
946 +
947 +
948 +static _Unwind_Reason_Code
949 +x86_64_dragonfly_fallback_frame_state
950 +(struct _Unwind_Context *context, _Unwind_FrameState *fs)
951 +{
952 +  unsigned char *pc = context->ra;
953 +  unsigned char *sigtramp_start, *sigtramp_end;
954 +  struct sigframe *sf;
955 +  long new_cfa;
956 +
957 +  x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
958 +  if (pc >= sigtramp_end || pc < sigtramp_start)
959 +    return _URC_END_OF_STACK;
960 +
961 +  sf = (struct sigframe *) context->cfa;
962 +  new_cfa = sf->REG_NAME(rsp);
963 +  fs->regs.cfa_how = CFA_REG_OFFSET;
964 +  /* Register 7 is rsp  */
965 +  fs->regs.cfa_reg = 7;
966 +  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
967 +
968 +  /* The SVR4 register numbering macros aren't usable in libgcc.  */
969 +  fs->regs.reg[0].how = REG_SAVED_OFFSET;
970 +  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
971 +  fs->regs.reg[1].how = REG_SAVED_OFFSET;
972 +  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
973 +  fs->regs.reg[2].how = REG_SAVED_OFFSET;
974 +  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
975 +  fs->regs.reg[3].how = REG_SAVED_OFFSET;
976 +  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
977 +  fs->regs.reg[4].how = REG_SAVED_OFFSET;
978 +  fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
979 +  fs->regs.reg[5].how = REG_SAVED_OFFSET;
980 +  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
981 +  fs->regs.reg[6].how = REG_SAVED_OFFSET;
982 +  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
983 +  fs->regs.reg[8].how = REG_SAVED_OFFSET;
984 +  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
985 +  fs->regs.reg[9].how = REG_SAVED_OFFSET;
986 +  fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
987 +  fs->regs.reg[10].how = REG_SAVED_OFFSET;
988 +  fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
989 +  fs->regs.reg[11].how = REG_SAVED_OFFSET;
990 +  fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
991 +  fs->regs.reg[12].how = REG_SAVED_OFFSET;
992 +  fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
993 +  fs->regs.reg[13].how = REG_SAVED_OFFSET;
994 +  fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
995 +  fs->regs.reg[14].how = REG_SAVED_OFFSET;
996 +  fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
997 +  fs->regs.reg[15].how = REG_SAVED_OFFSET;
998 +  fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
999 +  fs->regs.reg[16].how = REG_SAVED_OFFSET;
1000 +  fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
1001 +  fs->retaddr_column = 16;
1002 +  fs->signal_frame = 1;
1003 +  return _URC_NO_REASON;
1004 +}
1005 +
1006 +#else /* Next section is for i386  */
1007 +
1008 +#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
1009 +
1010 +
1011 +static void
1012 +x86_sigtramp_range (unsigned char **start, unsigned char **end)
1013 +{
1014 +  unsigned long ps_strings;
1015 +  int mib[2];
1016 +  size_t len;
1017 +
1018 +  mib[0] = CTL_KERN;
1019 +  mib[1] = KERN_PS_STRINGS;
1020 +  len = sizeof (ps_strings);
1021 +  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
1022 +
1023 +  *start = (unsigned char *)ps_strings - 128;
1024 +  *end   = (unsigned char *)ps_strings;
1025 +}
1026 +
1027 +
1028 +static _Unwind_Reason_Code
1029 +x86_dragonfly_fallback_frame_state
1030 +(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1031 +{
1032 +  unsigned char *pc = context->ra;
1033 +  unsigned char *sigtramp_start, *sigtramp_end;
1034 +  struct sigframe *sf;
1035 +  long new_cfa;
1036 +
1037 +  x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
1038 +
1039 +  if (pc >= sigtramp_end || pc < sigtramp_start)
1040 +    return _URC_END_OF_STACK;
1041 +
1042 +  sf = (struct sigframe *) context->cfa;
1043 +  new_cfa = sf->REG_NAME(esp);
1044 +  fs->regs.cfa_how = CFA_REG_OFFSET;
1045 +  fs->regs.cfa_reg = 4;
1046 +  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1047 +
1048 +  /* The SVR4 register numbering macros aren't usable in libgcc.  */
1049 +  fs->regs.reg[0].how = REG_SAVED_OFFSET;
1050 +  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
1051 +  fs->regs.reg[3].how = REG_SAVED_OFFSET;
1052 +  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
1053 +  fs->regs.reg[1].how = REG_SAVED_OFFSET;
1054 +  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
1055 +  fs->regs.reg[2].how = REG_SAVED_OFFSET;
1056 +  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
1057 +  fs->regs.reg[6].how = REG_SAVED_OFFSET;
1058 +  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
1059 +  fs->regs.reg[7].how = REG_SAVED_OFFSET;
1060 +  fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
1061 +  fs->regs.reg[5].how = REG_SAVED_OFFSET;
1062 +  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
1063 +  fs->regs.reg[8].how = REG_SAVED_OFFSET;
1064 +  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
1065 +  fs->retaddr_column = 8;
1066 +  fs->signal_frame = 1;
1067 +  return _URC_NO_REASON;
1068 +}
1069 +#endif /* ifdef __x86_64__  */
1070 --- /dev/null
1071 +++ libgcc/config/i386/freebsd-unwind.h
1072 @@ -0,0 +1,179 @@
1073 +/* DWARF2 EH unwinding support for FreeBSD: AMD x86-64 and x86.
1074 +   Copyright (C) 2010, 2012 John Marino <draco@marino.st>
1075 +
1076 +/* Do code reading to identify a signal frame, and set the frame
1077 +   state data appropriately.  See unwind-dw2.c for the structs. */
1078 +
1079 +#include <sys/types.h>
1080 +#include <signal.h>
1081 +#include <sys/ucontext.h>
1082 +#include <machine/sigframe.h>
1083 +
1084 +#define REG_NAME(reg)  sf_uc.uc_mcontext.mc_## reg
1085 +
1086 +#ifdef __x86_64__
1087 +#define MD_FALLBACK_FRAME_STATE_FOR x86_64_freebsd_fallback_frame_state
1088 +
1089 +#if (__FreeBSD__ < 9)
1090 +#include <sys/sysctl.h>
1091 +static void
1092 +x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
1093 +{
1094 +  unsigned long ps_strings;
1095 +  int mib[2];
1096 +  size_t len;
1097 +
1098 +  mib[0] = CTL_KERN;
1099 +  mib[1] = KERN_PS_STRINGS;
1100 +  len = sizeof (ps_strings);
1101 +  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
1102 +
1103 +  *start = (unsigned char *)ps_strings - 32;
1104 +  *end   = (unsigned char *)ps_strings;
1105 +}
1106 +#endif
1107 +
1108 +
1109 +static _Unwind_Reason_Code
1110 +x86_64_freebsd_fallback_frame_state
1111 +(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1112 +{
1113 +  unsigned char *pc = context->ra;
1114 +  unsigned char *sigtramp_start, *sigtramp_end;
1115 +  struct sigframe *sf;
1116 +  long new_cfa;
1117 +
1118 +#if (__FreeBSD__ < 9)
1119 +  x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
1120 +  if (pc >= sigtramp_end || pc < sigtramp_start)
1121 +    return _URC_END_OF_STACK;
1122 +#else
1123 +  /* Prior to FreeBSD 9, the signal trampoline was located immediately
1124 +     before the ps_strings.  To support non-executable stacks on AMD64,
1125 +     the sigtramp was moved to a shared page for FreeBSD 9.  We are
1126 +     stuck looking for frame patterns again (sys/amd64/amd64/sigtramp.S):
1127 +
1128 +     <pc + 00>:  lea     0x10(%rsp),%rdi
1129 +     <pc + 05>:  pushq   $0x0
1130 +     <pc + 17>:  mov     $0x1a1,%rax
1131 +     <pc + 14>:  syscall
1132 +
1133 +     If we can't find this pattern, we're at the end of the stack.
1134 +  */
1135 +
1136 +  if (!(   *(unsigned int *)(context->ra)      == 0x247c8d48
1137 +        && *(unsigned int *)(context->ra +  4) == 0x48006a10
1138 +        && *(unsigned int *)(context->ra +  8) == 0x01a1c0c7
1139 +        && *(unsigned int *)(context->ra + 12) == 0x050f0000 ))
1140 +    return _URC_END_OF_STACK;
1141 +#endif
1142 +
1143 +  sf = (struct sigframe *) context->cfa;
1144 +  new_cfa = sf->REG_NAME(rsp);
1145 +  fs->regs.cfa_how = CFA_REG_OFFSET;
1146 +  /* Register 7 is rsp  */
1147 +  fs->regs.cfa_reg = 7;
1148 +  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1149 +
1150 +  /* The SVR4 register numbering macros aren't usable in libgcc.  */
1151 +  fs->regs.reg[0].how = REG_SAVED_OFFSET;
1152 +  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
1153 +  fs->regs.reg[1].how = REG_SAVED_OFFSET;
1154 +  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
1155 +  fs->regs.reg[2].how = REG_SAVED_OFFSET;
1156 +  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
1157 +  fs->regs.reg[3].how = REG_SAVED_OFFSET;
1158 +  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
1159 +  fs->regs.reg[4].how = REG_SAVED_OFFSET;
1160 +  fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
1161 +  fs->regs.reg[5].how = REG_SAVED_OFFSET;
1162 +  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
1163 +  fs->regs.reg[6].how = REG_SAVED_OFFSET;
1164 +  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
1165 +  fs->regs.reg[8].how = REG_SAVED_OFFSET;
1166 +  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
1167 +  fs->regs.reg[9].how = REG_SAVED_OFFSET;
1168 +  fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
1169 +  fs->regs.reg[10].how = REG_SAVED_OFFSET;
1170 +  fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
1171 +  fs->regs.reg[11].how = REG_SAVED_OFFSET;
1172 +  fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
1173 +  fs->regs.reg[12].how = REG_SAVED_OFFSET;
1174 +  fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
1175 +  fs->regs.reg[13].how = REG_SAVED_OFFSET;
1176 +  fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
1177 +  fs->regs.reg[14].how = REG_SAVED_OFFSET;
1178 +  fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
1179 +  fs->regs.reg[15].how = REG_SAVED_OFFSET;
1180 +  fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
1181 +  fs->regs.reg[16].how = REG_SAVED_OFFSET;
1182 +  fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
1183 +  fs->retaddr_column = 16;
1184 +  fs->signal_frame = 1;
1185 +  return _URC_NO_REASON;
1186 +}
1187 +
1188 +#else /* Next section is for i386  */
1189 +
1190 +#define MD_FALLBACK_FRAME_STATE_FOR x86_freebsd_fallback_frame_state
1191 +
1192 +#include <sys/sysctl.h>
1193 +static void
1194 +x86_sigtramp_range (unsigned char **start, unsigned char **end)
1195 +{
1196 +  unsigned long ps_strings;
1197 +  int mib[2];
1198 +  size_t len;
1199 +
1200 +  mib[0] = CTL_KERN;
1201 +  mib[1] = KERN_PS_STRINGS;
1202 +  len = sizeof (ps_strings);
1203 +  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
1204 +
1205 +  *start = (unsigned char *)ps_strings - 128;
1206 +  *end   = (unsigned char *)ps_strings;
1207 +}
1208 +
1209 +
1210 +static _Unwind_Reason_Code
1211 +x86_freebsd_fallback_frame_state
1212 +(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1213 +{
1214 +  unsigned char *pc = context->ra;
1215 +  unsigned char *sigtramp_start, *sigtramp_end;
1216 +  struct sigframe *sf;
1217 +  long new_cfa;
1218 +
1219 +  x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
1220 +
1221 +  if (pc >= sigtramp_end || pc < sigtramp_start)
1222 +    return _URC_END_OF_STACK;
1223 +
1224 +  sf = (struct sigframe *) context->cfa;
1225 +  new_cfa = sf->REG_NAME(esp);
1226 +  fs->regs.cfa_how = CFA_REG_OFFSET;
1227 +  fs->regs.cfa_reg = 4;
1228 +  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1229 +
1230 +  /* The SVR4 register numbering macros aren't usable in libgcc.  */
1231 +  fs->regs.reg[0].how = REG_SAVED_OFFSET;
1232 +  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
1233 +  fs->regs.reg[3].how = REG_SAVED_OFFSET;
1234 +  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
1235 +  fs->regs.reg[1].how = REG_SAVED_OFFSET;
1236 +  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
1237 +  fs->regs.reg[2].how = REG_SAVED_OFFSET;
1238 +  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
1239 +  fs->regs.reg[6].how = REG_SAVED_OFFSET;
1240 +  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
1241 +  fs->regs.reg[7].how = REG_SAVED_OFFSET;
1242 +  fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
1243 +  fs->regs.reg[5].how = REG_SAVED_OFFSET;
1244 +  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
1245 +  fs->regs.reg[8].how = REG_SAVED_OFFSET;
1246 +  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
1247 +  fs->retaddr_column = 8;
1248 +  fs->signal_frame = 1;
1249 +  return _URC_NO_REASON;
1250 +}
1251 +#endif /* ifdef __x86_64__  */
1252 --- /dev/null
1253 +++ libgcc/config/i386/netbsd-unwind.h
1254 @@ -0,0 +1,169 @@
1255 +/* DWARF2 EH unwinding support for x86 NetBSD
1256 +   Copyright (C) 2010 John Marino (www.dragonlace.net) */
1257 +
1258 +/* Do code reading to identify a signal frame, and set the frame
1259 +   state data appropriately.  See unwind-dw2.c for the structs. */
1260 +
1261 +#include <sys/ucontext.h>
1262 +#include <machine/frame.h>
1263 +
1264 +#define REG_NAME(reg)   sf_uc.uc_mcontext.__gregs[_REG_## reg]
1265 +
1266 +#ifdef __x86_64__
1267 +
1268 +
1269 +
1270 +
1271 +#define MD_FALLBACK_FRAME_STATE_FOR x86_64_netbsd_fallback_frame_state
1272 +
1273 +static _Unwind_Reason_Code
1274 +x86_64_netbsd_fallback_frame_state
1275 +(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1276 +{
1277 +  /* signal_frame is sigframe_siginfo minus sf_ra handler return address */
1278 +  struct signal_frame {
1279 +         siginfo_t    sf_si;   /* actual saved siginfo  */
1280 +         ucontext_t   sf_uc;   /* actual saved ucontext */
1281 +  };
1282 +  struct signal_frame *sf;
1283 +  long new_cfa;
1284 +
1285 +  /*  We are looking for the following signal trampoline pattern. If we don't
1286 +      find it, we are at the end of the stack and can't unwind.
1287 +
1288 +      <__sigtramp_siginfo_2+12>:  mov     $0xffffffffffffffff,%rdi
1289 +      <__sigtramp_siginfo_2+19>:  mov     $0x1,%rax
1290 +      <__sigtramp_siginfo_2+26>:  syscall
1291 +  */
1292 +
1293 +  if (   *(unsigned int   *) (context->ra + 12) == 0xffc7c748
1294 +      && *(unsigned int   *) (context->ra + 16) == 0x48ffffff
1295 +      && *(unsigned int   *) (context->ra + 20) == 0x0001c0c7
1296 +      && *(unsigned int   *) (context->ra + 24) == 0x050f0000 )
1297 +  {
1298 +    sf = (struct signal_frame *) context->cfa;
1299 +    new_cfa = sf->REG_NAME(RSP);
1300 +    fs->regs.cfa_how = CFA_REG_OFFSET;
1301 +    fs->regs.cfa_reg = 7;
1302 +    fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1303 +  }
1304 +  else
1305 +  {
1306 +    return _URC_END_OF_STACK;
1307 +  }
1308 +
1309 +  /* The SVR4 register numbering macros aren't usable in libgcc.  */
1310 +  fs->regs.reg[ 0].how = REG_SAVED_OFFSET;
1311 +  fs->regs.reg[ 0].loc.offset = (long)&sf->REG_NAME(RAX) - new_cfa;
1312 +  fs->regs.reg[ 1].how = REG_SAVED_OFFSET;
1313 +  fs->regs.reg[ 1].loc.offset = (long)&sf->REG_NAME(RDX) - new_cfa;
1314 +  fs->regs.reg[ 2].how = REG_SAVED_OFFSET;
1315 +  fs->regs.reg[ 2].loc.offset = (long)&sf->REG_NAME(RCX) - new_cfa;
1316 +  fs->regs.reg[ 3].how = REG_SAVED_OFFSET;
1317 +  fs->regs.reg[ 3].loc.offset = (long)&sf->REG_NAME(RBX) - new_cfa;
1318 +  fs->regs.reg[ 4].how = REG_SAVED_OFFSET;
1319 +  fs->regs.reg[ 4].loc.offset = (long)&sf->REG_NAME(RSI) - new_cfa;
1320 +  fs->regs.reg[ 5].how = REG_SAVED_OFFSET;
1321 +  fs->regs.reg[ 5].loc.offset = (long)&sf->REG_NAME(RDI) - new_cfa;
1322 +  fs->regs.reg[ 6].how = REG_SAVED_OFFSET;
1323 +  fs->regs.reg[ 6].loc.offset = (long)&sf->REG_NAME(RBP) - new_cfa;
1324 +  fs->regs.reg[ 8].how = REG_SAVED_OFFSET;
1325 +  fs->regs.reg[ 8].loc.offset = (long)&sf->REG_NAME(R8)  - new_cfa;
1326 +  fs->regs.reg[ 9].how = REG_SAVED_OFFSET;
1327 +  fs->regs.reg[ 9].loc.offset = (long)&sf->REG_NAME(R9)  - new_cfa;
1328 +  fs->regs.reg[10].how = REG_SAVED_OFFSET;
1329 +  fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(R10) - new_cfa;
1330 +  fs->regs.reg[11].how = REG_SAVED_OFFSET;
1331 +  fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(R11) - new_cfa;
1332 +  fs->regs.reg[12].how = REG_SAVED_OFFSET;
1333 +  fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(R12) - new_cfa;
1334 +  fs->regs.reg[13].how = REG_SAVED_OFFSET;
1335 +  fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(R13) - new_cfa;
1336 +  fs->regs.reg[14].how = REG_SAVED_OFFSET;
1337 +  fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(R14) - new_cfa;
1338 +  fs->regs.reg[15].how = REG_SAVED_OFFSET;
1339 +  fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(R15) - new_cfa;
1340 +  fs->regs.reg[16].how = REG_SAVED_OFFSET;
1341 +  fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(RIP) - new_cfa;
1342 +  fs->retaddr_column = 16;
1343 +  fs->signal_frame = 1;
1344 +  return _URC_NO_REASON;
1345 +}
1346 +
1347 +
1348 +
1349 +
1350 +#else /* Next section is for i386  */
1351 +
1352 +
1353 +
1354 +
1355 +#define MD_FALLBACK_FRAME_STATE_FOR x86_netbsd_fallback_frame_state
1356 +
1357 +static _Unwind_Reason_Code
1358 +x86_netbsd_fallback_frame_state
1359 +(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1360 +{
1361 +  /* signal_frame is sigframe_siginfo minus sf_ra handler return address */
1362 +  struct signal_frame {
1363 +         int          sf_signum;  /* "signum" argument for handler" */
1364 +         siginfo_t   *sf_sip;     /* "sip"    argument for handler" */
1365 +         ucontext_t  *sf_ucp;     /* "ucp"    argument for handler" */
1366 +         siginfo_t    sf_si;      /* actual saved siginfo  */
1367 +         ucontext_t   sf_uc;      /* actual saved ucontext */
1368 +  };
1369 +  struct signal_frame *sf;
1370 +  long new_cfa;
1371 +
1372 +  /*  We are looking for the following signal trampoline pattern. If we don't
1373 +      find it, we are at the end of the stack and can't unwind.
1374 +
1375 +      <__sigtramp_siginfo_2+18>:  movl   $0xffffffff,0x4(%esp)
1376 +      <__sigtramp_siginfo_2+26>:  mov    $0x1,%eax
1377 +      <__sigtramp_siginfo_2+31>:  int    $0x80
1378 +  */
1379 +
1380 +  if (   *(unsigned int   *) (context->ra + 18) == 0x042444c7
1381 +      && *(unsigned int   *) (context->ra + 22) == 0xffffffff
1382 +      && *(unsigned char  *) (context->ra + 26) == 0xb8
1383 +      && *(unsigned int   *) (context->ra + 27) == 0x00000001
1384 +      && *(unsigned short *) (context->ra + 31) == 0x80cd     )
1385 +  {
1386 +    sf = (struct signal_frame *) context->cfa;
1387 +    new_cfa = sf->REG_NAME(ESP);
1388 +    fs->regs.cfa_how = CFA_REG_OFFSET;
1389 +    fs->regs.cfa_reg = 4;
1390 +    fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1391 +  }
1392 +  else
1393 +  {
1394 +    return _URC_END_OF_STACK;
1395 +  }
1396 +
1397 +  /* The SVR4 register numbering macros aren't usable in libgcc.  */
1398 +  fs->regs.reg[0].how = REG_SAVED_OFFSET;
1399 +  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(EAX) - new_cfa;
1400 +  fs->regs.reg[3].how = REG_SAVED_OFFSET;
1401 +  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(EBX) - new_cfa;
1402 +  fs->regs.reg[1].how = REG_SAVED_OFFSET;
1403 +  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ECX) - new_cfa;
1404 +  fs->regs.reg[2].how = REG_SAVED_OFFSET;
1405 +  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(EDX) - new_cfa;
1406 +  fs->regs.reg[6].how = REG_SAVED_OFFSET;
1407 +  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(ESI) - new_cfa;
1408 +  fs->regs.reg[7].how = REG_SAVED_OFFSET;
1409 +  fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(EDI) - new_cfa;
1410 +  fs->regs.reg[5].how = REG_SAVED_OFFSET;
1411 +  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(EBP) - new_cfa;
1412 +  fs->regs.reg[8].how = REG_SAVED_OFFSET;
1413 +  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(EIP) - new_cfa;
1414 +  fs->retaddr_column = 8;
1415 +  fs->signal_frame = 1;
1416 +  return _URC_NO_REASON;
1417 +}
1418 +
1419 +
1420 +
1421 +
1422 +#endif /* ifdef __x86_64__  */
1423 +
1424 --- libiberty/getpagesize.c.orig
1425 +++ libiberty/getpagesize.c
1426 @@ -20,6 +20,7 @@
1427  
1428  */
1429  
1430 +#ifndef __ANDROID__
1431  #ifndef VMS
1432  
1433  #include "config.h"
1434 @@ -88,3 +89,4 @@
1435  }
1436  
1437  #endif /* VMS */
1438 +#endif /* __ANDROID__ */
1439 --- libiberty/setproctitle.c.orig
1440 +++ libiberty/setproctitle.c
1441 @@ -40,9 +40,11 @@
1442  void
1443  setproctitle (const char *name ATTRIBUTE_UNUSED, ...)
1444  {
1445 +#ifndef __ANDROID__
1446  #ifdef PR_SET_NAME
1447    /* On GNU/Linux this sets the top visible "comm", but not
1448       necessarily the name visible in ps. */
1449    prctl (PR_SET_NAME, name);
1450  #endif
1451 +#endif
1452  }
1453 --- gcc/configure.orig
1454 +++ gcc/configure
1455 @@ -26810,6 +26810,20 @@
1456        gcc_cv_target_dl_iterate_phdr=no
1457      fi
1458      ;;
1459 +  *-*-dragonfly* | *-*-freebsd*)
1460 +  if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
1461 +      gcc_cv_target_dl_iterate_phdr=yes
1462 +    else
1463 +      gcc_cv_target_dl_iterate_phdr=no
1464 +    fi
1465 +  ;;
1466 +  *-*-netbsd*)
1467 +  if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then
1468 +      gcc_cv_target_dl_iterate_phdr=yes
1469 +    else
1470 +      gcc_cv_target_dl_iterate_phdr=no
1471 +    fi
1472 +  ;;
1473  esac
1474  
1475  if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
1476 --- gcc/Makefile.in.orig
1477 +++ gcc/Makefile.in
1478 @@ -1150,7 +1150,6 @@
1479         insn-automata.o \
1480         insn-emit.o \
1481         insn-extract.o \
1482 -       insn-modes.o \
1483         insn-opinit.o \
1484         insn-output.o \
1485         insn-peep.o \
1486 @@ -1469,13 +1468,18 @@
1487  ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
1488    $(OBJS-libcommon-target) @TREEBROWSER@ main.o gccspec.o cppspec.o \
1489    $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) mips-tfile.o mips-tdump.o \
1490 -  $(GCOV_OBJS) $(GCOV_DUMP_OBJS)
1491 +  $(GCOV_OBJS) $(GCOV_DUMP_OBJS) insn-modes.o insn-modes-ada.o
1492  
1493  # This lists all host object files, whether they are included in this
1494  # compilation or not.
1495  ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS)
1496  
1497 -BACKEND = main.o @TREEBROWSER@ libbackend.a libcommon-target.a libcommon.a \
1498 +BACKEND = main.o @TREEBROWSER@ insn-modes.o libbackend.a \
1499 +       libcommon-target.a libcommon.a \
1500 +       $(CPPLIB) $(LIBDECNUMBER)
1501 +
1502 +BACKEND2 = main.o @TREEBROWSER@ insn-modes-ada.o libbackend.a \
1503 +       libcommon-target.a libcommon.a \
1504         $(CPPLIB) $(LIBDECNUMBER)
1505  
1506  MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
1507 @@ -3506,6 +3510,8 @@
1508    $(TM_H) $(RTL_H) $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H)
1509  insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h        $(TM_H) \
1510    $(MACHMODE_H)
1511 +insn-modes-ada.o : insn-modes-ada.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
1512 +  $(TM_H) $(MACHMODE_H)
1513  insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h      \
1514    $(TM_H) $(RTL_H) $(TM_P_H) insn-config.h $(FLAGS_H) $(RECOG_H)       \
1515    $(EXPR_H) $(OPTABS_H) reload.h
1516 @@ -3599,6 +3605,7 @@
1517  
1518  insn-modes.c: s-modes; @true
1519  insn-modes.h: s-modes-h; @true
1520 +insn-modes-ada.c: s-modes-ada; @true
1521  min-insn-modes.c: s-modes-m; @true
1522  
1523  s-modes: build/genmodes$(build_exeext)
1524 @@ -3616,6 +3623,12 @@
1525         $(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c
1526         $(STAMP) s-modes-m
1527  
1528 +s-modes-ada: s-modes
1529 +       $(shell sed -e 's/: TARGET_96_ROUND_53_LONG_DOUBLE \? &ieee_extended_intel_96_round_53_format //'  \
1530 +               < insn-modes.c > tmp-modes-ada.c)
1531 +       $(SHELL) $(srcdir)/../move-if-change tmp-modes-ada.c insn-modes-ada.c
1532 +       $(STAMP) s-modes-ada
1533 +
1534  insn-preds.c: s-preds; @true
1535  tm-preds.h: s-preds-h; @true
1536  tm-constrs.h: s-constrs-h; @true
1537 @@ -4378,7 +4391,7 @@
1538         DESTDIR=$(@D) \
1539         $(SHELL) $(srcdir)/doc/install.texi2html
1540  
1541 -MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 doc/fsf-funding.7
1542 +MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1
1543  
1544  generated-manpages: man
1545  
1546 @@ -4530,7 +4543,7 @@
1547  # Install the driver last so that the window when things are
1548  # broken is small.
1549  install: install-common $(INSTALL_HEADERS) \
1550 -    install-cpp install-man install-info install-@POSUB@ \
1551 +    install-cpp install-man install-@POSUB@ \
1552      install-driver install-lto-wrapper install-gcc-ar
1553  
1554  ifeq ($(enable_plugin),yes)
1555 @@ -4655,6 +4668,9 @@
1556         -rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext)
1557         -( cd $(DESTDIR)$(bindir) && \
1558            $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) )
1559 +       -if [ -f gnat1$(exeext) ] ; then \
1560 +         ( cd $(DESTDIR)$(bindir) && $(LN) $(GCC_INSTALL_NAME)$(exeext) ada$(exeext) ) \
1561 +       fi
1562         -if [ -f gcc-cross$(exeext) ] ; then \
1563           if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
1564             rm -f $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \
1565 @@ -4728,10 +4744,7 @@
1566  install-man: lang.install-man \
1567         $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \
1568         $(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \
1569 -       $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \
1570 -       $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \
1571 -       $(DESTDIR)$(man7dir)/gfdl$(man7ext) \
1572 -       $(DESTDIR)$(man7dir)/gpl$(man7ext)
1573 +       $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext)
1574  
1575  $(DESTDIR)$(man7dir)/%$(man7ext): doc/%.7 installdirs
1576         -rm -f $@
1577 --- configure.orig
1578 +++ configure
1579 @@ -14412,7 +14412,7 @@
1580  _ACEOF
1581  if ac_fn_c_try_compile "$LINENO"; then :
1582    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1583 -$as_echo "yes" >&6; }; stage1_cflags="$stage1_cflags -fkeep-inline-functions"
1584 +$as_echo "yes" >&6; };
1585  else
1586    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1587  $as_echo "no" >&6; }