public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
@ 2014-04-19 19:41 John Marino
  2014-04-20 19:05 ` Jonathan Wakely
  2014-05-01 23:03 ` Joseph S. Myers
  0 siblings, 2 replies; 25+ messages in thread
From: John Marino @ 2014-04-19 19:41 UTC (permalink / raw)
  To: gcc-patches
  Cc: Jonathan Wakely, Gerald Pfeifer, manu, Eric Botcazou (gnu.org)

[-- Attachment #1: Type: text/plain, Size: 7069 bytes --]

Hello GCC developers,

For the last few years, I have been maintaining a large set of patches
that add support for the DragonFly BSD target and also complete Ada
frontend support on all four major BSDs among other things.  Before I
can submit patches for Ada or testsuite cases, DragonFly must be a
recognized, working target.  The patches attached here will provide
out-of-the-box support for the C, C++, Objective-C and Fortran frontends.

Most of the changes should be self-explanatory except for the following:

dl_iterate_phr: This was hard-coded to FreeBSD version, but
dl_iterate_phdr support is easily detected the same way on FreeBSD and
DragonFly (if/when NetBSD/OpenBSD get dl_iterate_phdr functionality then
it can be detected similarly with different headers).  So I piggy-backed
on existing functionality in place for solaris, and then adjusted
crtstuff.c and unwind-dw2-fde-dip.c to use TARGET_DL_ITERATE_PHDR
instead of the hardcode versioning.

enable_execute_stack=enable-execute-stack-mprotect.c: This never worked
correctly on FreeBSD, at least it did not the last time I checked this
in the GCC 4.7 time-frame and I don't think anything changed since then.
 I added a different version (enable-execute-stack-bsd.c) that does work
and assigned all the BSDs to use this version instead of the mprotect.c
version.  It's been almost 2 years since I did those so I can't remember
exactly what was failing with the mprotect.c version, but the effects
were clearly seen with Ada testsuite failures (and subsequently fixed
with my new version).

unwind support:  Unwind supports works great for DragonFly.  I also have
a patch to add unwind support for FreeBSD, but I did not include it here
because it is out of scope.  The FreeBSD version is *not* the same, and
the FreeBSD version is made more complicated because signal trampolines
are handled differently on i386 platforms and amd64 platforms running in
32-bit compat mode (meaning a program would work perfectly fine on a
"real" i386 but fail on amd64 in 32-bit compatibility mode).  Anyway, a
follow-up to this patch submission is adding the FreeBSD unwind support
as a separate submission.

I ran (modified) testsuites on FreeBSD-10-amd64 and DragonFly-dev-86_64.
 A summary of both is as follows:

g++ Summary                FreeBSD     DragonFly
================================================
# of expected passes       83178       82367
# of unexpected failures   18          305
# of unexpected successes  2
# of expected failures     443         445
# of unresolved testcases  48          326
# of unsupported tests     3000        2963


gcc Summary                FreeBSD     DragonFly
================================================
# of expected passes       101595      98822
# of unexpected failures   72          346
# of expected failures     251         251
# of unresolved testcases  24          234
# of unsupported tests     1511        1457


gfortran Summary           FreeBSD     DragonFly
================================================
# of expected passes       45496       45512
# of unexpected successes  7           9
# of expected failures     47          38
# of unresolved testcases  8           8
# of unsupported tests     79          70


libgomp Summary            FreeBSD     DragonFly
================================================
# of expected passes       2363        2357
# of unsupported tests                 3


libitm Summary             FreeBSD     DragonFly
================================================
# of expected passes       26          26
# of expected failures     3           3
# of unsupported tests     1           1


libstdc++ Summary          FreeBSD     DragonFly
================================================
# of expected passes       8764        9198
# of unexpected failures   25          178
# of expected failures     40          41
# of unsupported tests     645         351
# of unexpected successes              1


objc Summary               FreeBSD     DragonFly
================================================
# of expected passes       2988        2988
# of expected failures     6           6
# of unsupported tests     74          74


In some tests, DragonFly actually does better than FreeBSD.  Some of the
differences are caused by dejagnu instructions (e.g. the unsupported
libgomp tests).  All in all, a pretty good showing for a baseline in my
opinion.  Here is my suggested commit message:

2014-04-20  John Marino <gnugcc@marino.st>

	* gcc/config.gcc (*-*-dragonfly*): New target
	* gcc/configure.ac: detect dl_iterate_phdr (*freebsd*, *dragonfly*)
	* gcc/configure: regenerate
	* gcc/config/dragonfly-stdint.h: new
	* gcc/config/dragonfly.h: new
	* gcc/config/dragonfly.opt: new
	* gcc/config/i386/dragonfly.h: new
	* gcc/ginclude/stddef: detect _PTRDIFF_T_DECLARED and include
	  <sys/types> for DragonFly
	* include/liberty.h: use basename function on DragonFly
	* libcilkrts/runtime/os-unix.c (__DragonFly__): New target
	* libgcc/config.host (*-*-dragonfly*): New target
	* libgcc/crtstuff.c: Make dl_iterate_support generic on *bsd
	* libgcc/enable-execute-stack-bsd.c: new
	* libgcc/unwind-dw2-fde-dip.c: dl_iterate_phr support for DragonFly
	* libgcc/config/i386/dragonfly-unwind.h: new
	* libitm/configure.tgt (*-*-dragonfly*): New target
	* libstdc++-v3/acinclude.m4 (*-*-dragonfly*): New target
	* libstdc++-v3/configure: regenerate
	* libstdc++-v3/configure.host (*-*-dragonfly*): New target
	* libstdc++-v3/config/locale/dragonfly/c_locale.cc: new
	* libstdc++-v3/config/locale/dragonfly/ctype_members.cc: new
	* libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h: new
	* libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc: new
	* libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h: new
	* libstdc++-v3/config/os/bsd/dragonfly/os_defines.h

The individual Changelog entries can be obtained (see list below).

It would be great these patches could be reviewed and approved quickly
for addition to trunk.  Most of the changes clearly affect only
DragonFly, but there are a few changes that affect many platforms.

Regards,
John Marino (DragonFly, FreeBSD, and NetBSD committer)
FSF Assignment: RT658681 (18 FEB 2011)


Resource list:
1. Entries for 6 change logs:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/
2. Proposed commit message:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/proposed_commit-msg.txt
3. Full set of test logs for FreeBSD:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/test-results/freebsd10-amd64/
4. Full set of test logs for DragonFly:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/test-results/df-dev-x86_64/
5. Shar file to create test port (FreeBSD ports and DragonFly dports):
http://leaf.dragonflybsd.org/~marino/gcc-df-target/gcc410.shar.txt
6. Detail list of testsuite modifications for those results:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/patches/additional_testsuite_mods.txt
7. Testsuite patches (will submit later):
http://leaf.dragonflybsd.org/~marino/gcc-df-target/patches/patch-testsuite

[-- Attachment #2: patch-dragonfly-target.txt --]
[-- Type: text/plain, Size: 56406 bytes --]

--- gcc/config.gcc.orig
+++ gcc/config.gcc
@@ -643,6 +643,26 @@
     "" | yes | posix) thread_file='posix' ;;
   esac
   ;;
+*-*-dragonfly*)
+  gas=yes
+  gnu_ld=yes
+  tmake_file="t-slibgcc"
+  case ${enable_threads} in
+    "" | yes | posix)
+      thread_file='posix'
+      ;;
+    no | gnat | single)
+      # Let these non-posix thread selections fall through if requested
+      ;;
+    *)
+      echo 'Unknown thread configuration for DragonFly BSD'
+      exit 1
+      ;;
+  esac
+  extra_options="$extra_options rpath.opt dragonfly.opt"
+  default_use_cxa_atexit=yes
+  use_gcc_stdint=wrap
+  ;;
 *-*-freebsd*)
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
@@ -1352,6 +1372,14 @@
     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
     tmake_file="i386/t-i386elf t-svr4"
     ;;
+i[34567]86-*-dragonfly*)
+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
+	tmake_file="${tmake_file} i386/t-crtstuff"
+	;;
+x86_64-*-dragonfly*)
+	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"
+	tmake_file="${tmake_file} i386/t-crtstuff"
+	;;
 i[34567]86-*-freebsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
 	;;
@@ -4109,6 +4137,8 @@
 		;;
 	i[34567]86-*-mingw* | x86_64-*-mingw*)
 		;;
+	i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
+		;;
 	i[34567]86-*-freebsd* | x86_64-*-freebsd*)
 		;;
 	ia64*-*-linux*)
--- gcc/configure.orig
+++ gcc/configure
@@ -27470,6 +27470,13 @@
       gcc_cv_target_dl_iterate_phdr=no
     fi
     ;;
+  *-*-dragonfly* | *-*-freebsd*)
+    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
+      gcc_cv_target_dl_iterate_phdr=yes
+    else
+      gcc_cv_target_dl_iterate_phdr=no
+    fi
+    ;;
 esac
 
 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
--- gcc/configure.ac.orig
+++ gcc/configure.ac
@@ -5100,6 +5100,13 @@
       gcc_cv_target_dl_iterate_phdr=no
     fi
     ;;
+  *-*-dragonfly* | *-*-freebsd*)
+    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
+      gcc_cv_target_dl_iterate_phdr=yes
+    else
+      gcc_cv_target_dl_iterate_phdr=no
+    fi
+    ;;
 esac
 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
--- /dev/null
+++ gcc/config/dragonfly-stdint.h
@@ -0,0 +1,56 @@
+/* Definitions for <stdint.h> types for DragonFly systems.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#define SIG_ATOMIC_TYPE   "int"
+
+#define INT8_TYPE         "signed char"
+#define INT16_TYPE        "short int"
+#define INT32_TYPE        "int"
+#define INT64_TYPE        (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
+#define UINT8_TYPE        "unsigned char"
+#define UINT16_TYPE       "short unsigned int"
+#define UINT32_TYPE       "unsigned int"
+#define UINT64_TYPE       (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
+
+#define INT_LEAST8_TYPE   INT8_TYPE
+#define INT_LEAST16_TYPE  INT16_TYPE
+#define INT_LEAST32_TYPE  INT32_TYPE
+#define INT_LEAST64_TYPE  INT64_TYPE
+#define UINT_LEAST8_TYPE  UINT8_TYPE
+#define UINT_LEAST16_TYPE UINT16_TYPE
+#define UINT_LEAST32_TYPE UINT32_TYPE
+#define UINT_LEAST64_TYPE UINT64_TYPE
+
+#define INT_FAST8_TYPE    INT32_TYPE
+#define INT_FAST16_TYPE   INT32_TYPE
+#define INT_FAST32_TYPE   INT32_TYPE
+#define INT_FAST64_TYPE   INT64_TYPE
+#define UINT_FAST8_TYPE   UINT32_TYPE
+#define UINT_FAST16_TYPE  UINT32_TYPE
+#define UINT_FAST32_TYPE  UINT32_TYPE
+#define UINT_FAST64_TYPE  UINT64_TYPE
+
+#define INTPTR_TYPE       (LONG_TYPE_SIZE == 64 ?  INT64_TYPE :  INT32_TYPE)
+#define UINTPTR_TYPE      (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
--- /dev/null
+++ gcc/config/dragonfly.h
@@ -0,0 +1,129 @@
+/* Base configuration file for all DragonFly targets.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#undef  TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()            \
+  do                                        \
+    {                                       \
+       builtin_define_std ("unix");         \
+       builtin_define ("__DragonFly__");    \
+       builtin_assert ("system=unix");      \
+       builtin_assert ("system=bsd");       \
+       builtin_assert ("system=DragonFly"); \
+    }                                       \
+  while (0)
+
+#undef  CPP_SPEC
+#define CPP_SPEC \
+ "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}"
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC	\
+  "%{!shared: \
+     %{pg:gcrt1.o%s} \
+     %{!pg: \
+       %{p:gcrt1.o%s} \
+       %{!p: \
+         %{profile: gcrt1.o%s} \
+         %{!profile: \
+           %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
+   crti.o%s \
+   %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
+#undef  LIB_SPEC
+#define LIB_SPEC \
+  "%{pthread:-lpthread} -lc"
+
+#if defined(HAVE_LD_EH_FRAME_HDR)
+#define LINK_EH_SPEC "--eh-frame-hdr"
+#endif
+
+/* Provide a LINK_SPEC appropriate for DragonFly.  Here we provide support
+   for the special GCC options -static and -shared, which allow us to
+   link things in one of these three modes by applying the appropriate
+   combinations of options at link-time.
+
+   When the -shared link option is used a final link is not being
+   done.  */
+
+#define DFBSD_LINK_SPEC \
+ "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+  %{v:-V} \
+  %{assert*} %{R*} %{rpath*} %{defsym*} \
+  %{shared:-Bshareable %{h*} %{soname*}} \
+  %{!shared: \
+   %{!static: \
+    %{rdynamic:-export-dynamic} \
+    -dynamic-linker %(dfbsd_dynamic_linker) \
+   } \
+   %{static:-Bstatic} \
+  } \
+  %{!static:--hash-style=gnu -rpath /usr/local/gcc-aux/lib} \
+  %{symbolic:-Bsymbolic}"
+
+#undef  LINK_SPEC
+#define LINK_SPEC DFBSD_LINK_SPEC
+
+#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
+
+
+/* Use --as-needed -lgcc_s for eh support.  */
+#ifdef HAVE_LD_AS_NEEDED
+#define USE_LD_AS_NEEDED 1
+#endif
+
+/************************[  Target stuff  ]***********************************/
+
+/* All DragonFly Architectures support the ELF object file format.  */
+#undef  OBJECT_FORMAT_ELF
+#define OBJECT_FORMAT_ELF
+
+/* Don't assume anything about the header files.  */
+#undef  NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C	1
+
+/* Follow DragonFly's standard headers (<machine/stdint.h>, etc...).  */
+
+#undef  WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef  WINT_TYPE
+#define WINT_TYPE "int"
+
+/* Code generation parameters.  */
+
+/* Use periods rather than dollar signs in special g++ assembler names.
+   This ensures the configuration knows our system correctly so we can link
+   with libraries compiled with the native cc.  */
+#undef NO_DOLLAR_IN_LABEL
+
+/* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
+   This enables the test coverage code to use file locking when exiting a
+   program, which avoids race conditions if the program has forked.  */
+#define TARGET_POSIX_IO
--- /dev/null
+++ gcc/config/dragonfly.opt
@@ -0,0 +1,64 @@
+; DragonFly BSD options.
+
+; Copyright (C) 2014 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+
+; See the GCC internals manual (options.texi) for a description of this file's format.
+
+; Please try to keep this file in ASCII collating order.
+
+assert
+Driver Separate
+
+assert=
+Driver JoinedOrMissing
+
+defsym
+Driver Separate
+
+defsym=
+Driver JoinedOrMissing
+
+posix
+Driver
+
+profile
+Driver
+
+pthread
+Driver
+
+rdynamic
+Driver
+
+rpath-link
+Driver Separate
+
+rpath-link=
+Driver JoinedOrMissing
+
+rpath=
+Driver JoinedOrMissing
+
+soname
+Driver Separate
+
+soname=
+Driver JoinedOrMissing
+
+; This comment is to ensure we retain the blank line above.
--- /dev/null
+++ gcc/config/i386/dragonfly.h
@@ -0,0 +1,104 @@
+/* Definitions for Intel 386 running DragonFly with ELF format
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+
+/* Override the default comment-starter of "/".  */
+#undef  ASM_COMMENT_START
+#define ASM_COMMENT_START "#"
+
+#undef  ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef  ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#undef  DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) \
+  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
+
+#undef  NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS	1
+
+/* Tell final.c that we don't need a label passed to mcount.  */
+
+#undef  MCOUNT_NAME
+#define MCOUNT_NAME ".mcount"
+
+/* Make gcc agree with <machine/ansi.h>.  */
+
+#undef  SIZE_TYPE
+#define SIZE_TYPE	(TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+#undef  PTRDIFF_TYPE
+#define PTRDIFF_TYPE	(TARGET_64BIT ? "long int" : "int")
+
+#undef  WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE	(TARGET_64BIT ? 32 : BITS_PER_WORD)
+
+#undef  SUBTARGET_EXTRA_SPECS	/* i386.h bogusly defines it.  */
+#define SUBTARGET_EXTRA_SPECS \
+  { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
+
+/* A C statement to output to the stdio stream FILE an assembler
+   command to advance the location counter to a multiple of 1<<LOG
+   bytes if it is within MAX_SKIP bytes.
+
+   This is used to align code labels according to Intel recommendations.  */
+
+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#undef  ASM_OUTPUT_MAX_SKIP_ALIGN
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)					\
+  if ((LOG) != 0) {														\
+    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
+    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
+  }
+#endif
+
+/* Don't default to pcc-struct-return, we want to retain compatibility with
+   older gcc versions AND pcc-struct-return is nonreentrant.
+   (even though the SVR4 ABI for the i386 says that records and unions are
+   returned in memory).  */
+
+#undef  DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* DragonFly sets the rounding precision of the FPU to 53 bits.  Let the
+   compiler get the contents of <float.h> and std::numeric_limits correct.  */
+#undef TARGET_96_ROUND_53_LONG_DOUBLE
+#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
+
+/* Put all *tf routines in libgcc.  */
+#undef LIBGCC2_HAS_TF_MODE
+#define LIBGCC2_HAS_TF_MODE 1
+#define LIBGCC2_TF_CEXT q
+#define TF_SIZE 113
+
+/* Static stack checking is supported by means of probes.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* Support for i386 was removed from DragonFly in 2007  */
+#define SUBTARGET32_DEFAULT_CPU "i486"
+
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
--- gcc/ginclude/stddef.h.orig
+++ gcc/ginclude/stddef.h
@@ -56,6 +56,11 @@
 #include <sys/_types.h>
 #endif
 
+/* Like FreeBSD, DragonFly does not have machine/ansi.h */
+#if defined(__DragonFly__)
+#include <sys/types.h>
+#endif
+
 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
    defined if the corresponding type is *not* defined.
    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
@@ -133,6 +138,7 @@
 #ifndef _BSD_PTRDIFF_T_
 #ifndef ___int_ptrdiff_t_h
 #ifndef _GCC_PTRDIFF_T
+#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
 #define _PTRDIFF_T
 #define _T_PTRDIFF_
 #define _T_PTRDIFF
@@ -141,10 +147,12 @@
 #define _BSD_PTRDIFF_T_
 #define ___int_ptrdiff_t_h
 #define _GCC_PTRDIFF_T
+#define _PTRDIFF_T_DECLARED
 #ifndef __PTRDIFF_TYPE__
 #define __PTRDIFF_TYPE__ long int
 #endif
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#endif /* _PTRDIFF_T_DECLARED */
 #endif /* _GCC_PTRDIFF_T */
 #endif /* ___int_ptrdiff_t_h */
 #endif /* _BSD_PTRDIFF_T_ */
@@ -198,6 +206,7 @@
 #define _GCC_SIZE_T
 #define _SIZET_
 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+  || defined(__DragonFly__) \
   || defined(__FreeBSD_kernel__)
 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
 #elif defined (__VMS__)
@@ -306,7 +315,7 @@
 /* FreeBSD 5 can't be handled well using "traditional" logic above
    since it no longer defines _BSD_RUNE_T_ yet still desires to export
    rune_t in some cases... */
-#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
+#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5))
 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
 #if __BSD_VISIBLE
 #ifndef _RUNE_T_DECLARED
--- include/libiberty.h.orig
+++ include/libiberty.h
@@ -106,7 +106,10 @@
    to find the declaration so provide a fully prototyped one.  If it
    is 1, we found it so don't provide any declaration at all.  */
 #if !HAVE_DECL_BASENAME
-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
+ || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
+ || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
+ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) 
 extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
 #else
 /* Do not allow basename to be used if there is no prototype seen.  We
--- libcilkrts/runtime/os-unix.c.orig
+++ libcilkrts/runtime/os-unix.c
@@ -54,6 +54,8 @@
 #elif defined __APPLE__
 #   include <sys/sysctl.h>
     // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
+#elif defined  __DragonFly__
+// No additional include files
 #elif defined  __FreeBSD__
 // No additional include files
 #elif defined __CYGWIN__
@@ -374,7 +376,7 @@
     assert((unsigned)count == count);
 
     return count;
-#elif defined  __FreeBSD__ || defined __CYGWIN__
+#elif defined  __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__
     int ncores = sysconf(_SC_NPROCESSORS_ONLN);
 
     return ncores;
@@ -402,6 +404,9 @@
     // On MacOS, call sched_yield to yield quantum.  I'm not sure why we
     // don't do this on Linux also.
     sched_yield();
+#elif defined(__DragonFly__)
+    // On DragonFly BSD, call sched_yield to yield quantum.
+    sched_yield();
 #elif defined(__MIC__)
     // On MIC, pthread_yield() really trashes things.  Arch's measurements
     // showed that calling _mm_delay_32() (or doing nothing) was a better
--- libgcc/config.host.orig
+++ libgcc/config.host
@@ -207,6 +207,11 @@
   tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin"
   extra_parts="crt3.o crttms.o crttme.o"
   ;;
+*-*-dragonfly*)
+  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
+  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
+  extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
+  ;;
 *-*-freebsd*)
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
@@ -302,7 +307,10 @@
 esac
 
 case ${host} in
-*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2*)
+*-*-dragonfly* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
+  enable_execute_stack=enable-execute-stack-bsd.c
+  ;;
+*-*-darwin* | *-*-solaris2*)
   enable_execute_stack=enable-execute-stack-mprotect.c
   ;;
 i[34567]86-*-mingw* | x86_64-*-mingw*)
@@ -545,6 +553,14 @@
 x86_64-*-elf*)
 	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
 	;;
+i[34567]86-*-dragonfly*)
+	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
+	md_unwind_header=i386/dragonfly-unwind.h
+	;;
+x86_64-*-dragonfly*)
+	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
+	md_unwind_header=i386/dragonfly-unwind.h
+	;;
 i[34567]86-*-freebsd*)
 	tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
 	;;
@@ -1262,6 +1278,7 @@
   i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
   i[34567]86-*-cygwin* | x86_64-*-cygwin* | \
   i[34567]86-*-mingw* | x86_64-*-mingw* | \
+  i[34567]86-*-dragonfly* | x86_64-*-dragonfly* | \
   i[34567]86-*-freebsd* | x86_64-*-freebsd* | \
   i[34567]86-*-openbsd* | x86_64-*-openbsd*)
   	tmake_file="${tmake_file} t-softfp-tf"
--- libgcc/crtstuff.c.orig
+++ libgcc/crtstuff.c
@@ -79,11 +79,16 @@
 }
 #endif
 
+#if defined(TARGET_DL_ITERATE_PHDR) && \
+   (defined(__DragonFly__) || defined(__FreeBSD__))
+#define BSD_DL_ITERATE_PHDR_AVAILABLE
+#endif
+ 
 #if defined(OBJECT_FORMAT_ELF) \
     && !defined(OBJECT_FORMAT_FLAT) \
     && defined(HAVE_LD_EH_FRAME_HDR) \
     && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
+    && defined(BSD_DL_ITERATE_PHDR_AVAILABLE)
 #include <link.h>
 # define USE_PT_GNU_EH_FRAME
 #endif
--- /dev/null
+++ libgcc/enable-execute-stack-bsd.c
@@ -0,0 +1,59 @@
+/* Implement __enable_execute_stack using mprotect(2).
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#define STACK_PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC)
+
+extern void __enable_execute_stack (void *);
+
+void
+__enable_execute_stack (void *addr)
+{
+  static int size;
+  static long mask;
+  char *page, *ends;
+  long page_addr, ends_addr;
+
+  if (size == 0)
+  {
+    size = getpagesize ();
+    mask = ~((long) size - 1);
+  }
+  page_addr = (long) addr;
+  ends_addr = (long) (addr + __LIBGCC_TRAMPOLINE_SIZE__);
+
+  page = (char *) (page_addr & mask);
+  ends = (char *) ((ends_addr & mask) + size);
+
+  /*
+   * Note that no errors should be emitted by mprotect; it is considered
+   * dangerous for library calls to send messages to stdout/stderr.
+   */
+  if (mprotect (page, ends - page, STACK_PROT_RWX) < 0)
+    abort ();
+}
--- libgcc/unwind-dw2-fde-dip.c.orig
+++ libgcc/unwind-dw2-fde-dip.c
@@ -58,7 +58,8 @@
 #endif
 
 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
+    && defined(TARGET_DL_ITERATE_PHDR) \
+    && (defined(__DragonFly__) || defined(__FreeBSD__))
 # define ElfW __ElfN
 # define USE_PT_GNU_EH_FRAME
 #endif
--- /dev/null
+++ libgcc/config/i386/dragonfly-unwind.h
@@ -0,0 +1,180 @@
+/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* Do code reading to identify a signal frame, and set the frame
+   state data appropriately.  See unwind-dw2.c for the structs. */
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+#include <machine/sigframe.h>
+
+
+#define REG_NAME(reg)	sf_uc.uc_mcontext.mc_## reg
+
+#ifdef __x86_64__
+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
+
+
+static void
+x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 32;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_64_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(rsp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  /* Register 7 is rsp  */
+  fs->regs.cfa_reg = 7;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
+  fs->regs.reg[4].how = REG_SAVED_OFFSET;
+  fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
+  fs->regs.reg[9].how = REG_SAVED_OFFSET;
+  fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
+  fs->regs.reg[10].how = REG_SAVED_OFFSET;
+  fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
+  fs->regs.reg[11].how = REG_SAVED_OFFSET;
+  fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
+  fs->regs.reg[12].how = REG_SAVED_OFFSET;
+  fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
+  fs->regs.reg[13].how = REG_SAVED_OFFSET;
+  fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
+  fs->regs.reg[14].how = REG_SAVED_OFFSET;
+  fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
+  fs->regs.reg[15].how = REG_SAVED_OFFSET;
+  fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
+  fs->regs.reg[16].how = REG_SAVED_OFFSET;
+  fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
+  fs->retaddr_column = 16;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+
+#else /* Next section is for i386  */
+
+#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
+
+
+static void
+x86_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 128;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
+
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(esp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  fs->regs.cfa_reg = 4;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
+  fs->regs.reg[7].how = REG_SAVED_OFFSET;
+  fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
+  fs->retaddr_column = 8;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+#endif /* ifdef __x86_64__  */
--- libitm/configure.tgt.orig
+++ libitm/configure.tgt
@@ -140,7 +140,7 @@
   *-*-gnu* | *-*-k*bsd*-gnu \
   | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
   | *-*-solaris2* | *-*-sysv4* | *-*-hpux11* \
-  | *-*-darwin* | *-*-aix*)
+  | *-*-darwin* | *-*-aix* | *-*-dragonfly*)
 	# POSIX system.  The OS is supported.
 	;;
 
--- libstdc++-v3/acinclude.m4.orig
+++ libstdc++-v3/acinclude.m4
@@ -1989,6 +1989,9 @@
       darwin* | freebsd*)
 	enable_clocale_flag=darwin
 	;;
+      dragonfly*)
+	enable_clocale_flag=dragonfly
+	;;
       openbsd*)
 	enable_clocale_flag=newlib
 	;;
@@ -2075,6 +2078,23 @@
       CMESSAGES_H=config/locale/generic/messages_members.h
       CMESSAGES_CC=config/locale/generic/messages_members.cc
       CMONEY_CC=config/locale/generic/monetary_members.cc
+      CNUMERIC_CC=config/locale/generic/numeric_members.cc
+      CTIME_H=config/locale/generic/time_members.h
+      CTIME_CC=config/locale/generic/time_members.cc
+      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+      ;;
+
+    dragonfly)
+      AC_MSG_RESULT(dragonfly)
+
+      CLOCALE_H=config/locale/generic/c_locale.h
+      CLOCALE_CC=config/locale/dragonfly/c_locale.cc
+      CCODECVT_CC=config/locale/generic/codecvt_members.cc
+      CCOLLATE_CC=config/locale/generic/collate_members.cc
+      CCTYPE_CC=config/locale/dragonfly/ctype_members.cc
+      CMESSAGES_H=config/locale/generic/messages_members.h
+      CMESSAGES_CC=config/locale/generic/messages_members.cc
+      CMONEY_CC=config/locale/generic/monetary_members.cc
       CNUMERIC_CC=config/locale/generic/numeric_members.cc
       CTIME_H=config/locale/generic/time_members.h
       CTIME_CC=config/locale/generic/time_members.cc
--- libstdc++-v3/configure.orig
+++ libstdc++-v3/configure
@@ -15849,6 +15849,9 @@
       darwin* | freebsd*)
 	enable_clocale_flag=darwin
 	;;
+      dragonfly*)
+	enable_clocale_flag=dragonfly
+	;;
       openbsd*)
 	enable_clocale_flag=newlib
 	;;
@@ -15988,6 +15991,24 @@
       CMESSAGES_H=config/locale/generic/messages_members.h
       CMESSAGES_CC=config/locale/generic/messages_members.cc
       CMONEY_CC=config/locale/generic/monetary_members.cc
+      CNUMERIC_CC=config/locale/generic/numeric_members.cc
+      CTIME_H=config/locale/generic/time_members.h
+      CTIME_CC=config/locale/generic/time_members.cc
+      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+      ;;
+
+    dragonfly)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: dragonfly" >&5
+$as_echo "dragonfly" >&6; }
+
+      CLOCALE_H=config/locale/generic/c_locale.h
+      CLOCALE_CC=config/locale/dragonfly/c_locale.cc
+      CCODECVT_CC=config/locale/generic/codecvt_members.cc
+      CCOLLATE_CC=config/locale/generic/collate_members.cc
+      CCTYPE_CC=config/locale/dragonfly/ctype_members.cc
+      CMESSAGES_H=config/locale/generic/messages_members.h
+      CMESSAGES_CC=config/locale/generic/messages_members.cc
+      CMONEY_CC=config/locale/generic/monetary_members.cc
       CNUMERIC_CC=config/locale/generic/numeric_members.cc
       CTIME_H=config/locale/generic/time_members.h
       CTIME_CC=config/locale/generic/time_members.cc
--- libstdc++-v3/configure.host.orig
+++ libstdc++-v3/configure.host
@@ -260,6 +260,9 @@
     os_include_dir="os/djgpp"
     error_constants_dir="os/djgpp"
     ;;
+  dragonfly*)
+    os_include_dir="os/bsd/dragonfly"
+    ;;
   freebsd*)
     os_include_dir="os/bsd/freebsd"
     ;;
--- /dev/null
+++ libstdc++-v3/config/locale/dragonfly/c_locale.cc
@@ -0,0 +1,299 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.8  Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <cerrno>  // For errno
+#include <cmath>  // For isinf, finite, finitef, fabs
+#include <cstdlib>  // For strof, strtold
+#include <cstring>
+#include <cstdio>
+#include <locale>
+#include <limits>
+
+#ifdef _GLIBCXX_HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<>
+    void
+    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
+		   const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+      char* __sanity;
+      bool __overflow = false;
+
+#if !__FLT_HAS_INFINITY__
+      errno = 0;
+#endif
+
+#ifdef _GLIBCXX_HAVE_STRTOF
+      __v = strtof(__s, &__sanity);
+#else
+      double __d = strtod(__s, &__sanity);
+      __v = static_cast<float>(__d);
+#ifdef _GLIBCXX_HAVE_FINITEF
+      if (!finitef (__v))
+	__overflow = true;
+#elif defined (_GLIBCXX_HAVE_FINITE)
+      if (!finite (static_cast<double> (__v)))
+	__overflow = true;
+#elif defined (_GLIBCXX_HAVE_ISINF)
+      if (isinf (static_cast<double> (__v)))
+	__overflow = true;
+#else
+      if (fabs(__d) > numeric_limits<float>::max())
+	__overflow = true;
+#endif
+#endif // _GLIBCXX_HAVE_STRTOF
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+	{
+	  __v = 0.0f;
+	  __err = ios_base::failbit;
+	}
+      else if (__overflow
+#if __FLT_HAS_INFINITY__
+	       || __v == numeric_limits<float>::infinity()
+	       || __v == -numeric_limits<float>::infinity()
+#else
+	       || ((__v > 1.0f || __v < -1.0f) && errno == ERANGE)
+#endif
+	      )
+	{
+	  if (__v > 0.0f)
+	    __v = numeric_limits<float>::max();
+	  else
+	    __v = -numeric_limits<float>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+  template<>
+    void
+    __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
+		   const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+      char* __sanity;
+
+#if !__DBL_HAS_INFINITY__
+      errno = 0;
+#endif
+
+      __v = strtod(__s, &__sanity);
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+	{
+	  __v = 0.0;
+	  __err = ios_base::failbit;
+	}
+      else if (
+#if __DBL_HAS_INFINITY__
+	       __v == numeric_limits<double>::infinity()
+	       || __v == -numeric_limits<double>::infinity())
+#else
+	       (__v > 1.0 || __v < -1.0) && errno == ERANGE)
+#endif
+	{
+	  if (__v > 0.0)
+	    __v = numeric_limits<double>::max();
+	  else
+	    __v = -numeric_limits<double>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+  template<>
+    void
+    __convert_to_v(const char* __s, long double& __v,
+		   ios_base::iostate& __err, const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+
+#if !__LDBL_HAS_INFINITY__
+      errno = 0;
+#endif
+
+#if defined(_GLIBCXX_HAVE_STRTOLD) && !defined(_GLIBCXX_HAVE_BROKEN_STRTOLD)
+      char* __sanity;
+      __v = strtold(__s, &__sanity);
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+#else
+      typedef char_traits<char>::int_type int_type;
+      int __p = sscanf(__s, "%Lf", &__v);
+
+      if (!__p || static_cast<int_type>(__p) == char_traits<char>::eof())
+#endif
+	{
+	  __v = 0.0l;
+	  __err = ios_base::failbit;
+	}
+       else if (
+#if __LDBL_HAS_INFINITY__
+		__v == numeric_limits<long double>::infinity()
+		|| __v == -numeric_limits<long double>::infinity())
+#else
+		(__v > 1.0l || __v < -1.0l) && errno == ERANGE)
+#endif
+	{
+	  if (__v > 0.0l)
+	    __v = numeric_limits<long double>::max();
+	  else
+	    __v = -numeric_limits<long double>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+
+  /*  DragonFly's implementation of setlocale won't accept something like
+      "de_DE".  According to nls manpage, the expected format is:
+      language[_territory][.codeset][@modifier], but it seems that both
+      the _territory and .codeset components are required.
+      
+      As an attempt to correct for this, we'll tack on ".UTF-8" if 
+      a period is not detected in the locale string.  
+
+      There are no locales with modifiers on DragonFly so if found, they
+      will just be stripped off silently.  e.g "de_DE@euro" will be reduced
+      to "de_DE".  The UTF-8 default would be added after that.
+  */
+
+  void
+  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
+				    __c_locale)
+  {
+    const size_t size__s = (__s == NULL) ? 1 : strlen (__s);
+    const char UTF8[] = ".UTF-8";
+    char localspec[size__s + 6 + 1];
+    
+    if (__s == NULL) {
+       localspec[0] = NULL;
+    } else {
+       strcpy (localspec, __s);
+       char * pch = strchr (localspec, '@');
+       if (pch != NULL)
+          *pch = 0;
+
+       if (  (strchr (__s, '.') == NULL)
+          && (strcmp (__s, "C") != 0)
+          && (strcmp (__s, "POSIX") != 0))
+          strncat (localspec, UTF8, 6);
+    }
+
+    const char * result = std::setlocale(LC_ALL, localspec);
+    
+    if ((strcmp(result, "C") != 0) && (strcmp (result, localspec) != 0))
+      __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
+			    "name not valid"));
+    __cloc = 0;
+  }
+
+  void
+  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
+  { __cloc = 0; }
+
+  __c_locale
+  locale::facet::_S_clone_c_locale(__c_locale&) throw()
+  { return __c_locale(); }
+
+  __c_locale
+  locale::facet::_S_lc_ctype_c_locale(__c_locale, const char*)
+  { return __c_locale(); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
+    {
+      "LC_CTYPE",
+      "LC_NUMERIC",
+      "LC_TIME",
+      "LC_COLLATE",
+      "LC_MONETARY",
+      "LC_MESSAGES"
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  const char* const* const locale::_S_categories = __gnu_cxx::category_names;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+// XXX GLIBCXX_ABI Deprecated
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
+  extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- /dev/null
+++ libstdc++-v3/config/locale/dragonfly/ctype_members.cc
@@ -0,0 +1,173 @@
+// std::ctype implementation details, GNU version -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+#include <bits/c++locale_internal.h>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  // NB: The other ctype<char> specializations are in src/locale.cc and
+  // various /config/os/* files.
+
+  ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+  : ctype<char>(0, false, __refs) 
+  { 		
+    if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+      {
+	this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+	this->_S_create_c_locale(this->_M_c_locale_ctype, __s); 
+      }
+  }
+
+  ctype_byname<char>::~ctype_byname()
+  { }
+
+#ifdef _GLIBCXX_USE_WCHAR_T  
+  ctype<wchar_t>::__wmask_type
+  ctype<wchar_t>::_M_convert_to_wmask(
+    const mask __attribute__((__unused__)) __m) const throw()
+  {
+    // DragonFly uses the same codes for 'char' as 'wchar_t', so this routine
+    // never gets called.
+    return __wmask_type();
+  };
+  
+  wchar_t
+  ctype<wchar_t>::do_toupper(wchar_t __c) const
+  { return towupper(__c); }
+
+  const wchar_t*
+  ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi)
+      {
+        *__lo = towupper(*__lo);
+        ++__lo;
+      }
+    return __hi;
+  }
+  
+  wchar_t
+  ctype<wchar_t>::do_tolower(wchar_t __c) const
+  { return towlower(__c); }
+  
+  const wchar_t*
+  ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi)
+      {
+        *__lo = towlower(*__lo);
+        ++__lo;
+      }
+    return __hi;
+  }
+
+  wchar_t
+  ctype<wchar_t>::
+  do_widen(char __c) const
+  { return _M_widen[static_cast<unsigned char>(__c)]; }
+
+  const char* 
+  ctype<wchar_t>::
+  do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
+  {
+    while (__lo < __hi)
+      {
+	*__dest = _M_widen[static_cast<unsigned char>(*__lo)];
+	++__lo;
+	++__dest;
+      }
+    return __hi;
+  }
+
+  char
+  ctype<wchar_t>::
+  do_narrow(wchar_t __wc, char __dfault) const
+  { 
+    if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
+      return _M_narrow[__wc];
+    const int __c = wctob(__wc);
+    return (__c == EOF ? __dfault : static_cast<char>(__c)); 
+  }
+
+  const wchar_t*
+  ctype<wchar_t>::
+  do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, 
+	    char* __dest) const
+  {
+    if (_M_narrow_ok)
+      while (__lo < __hi)
+	{
+	  if (*__lo >= 0 && *__lo < 128)
+	    *__dest = _M_narrow[*__lo];
+	  else
+	    {
+	      const int __c = wctob(*__lo);
+	      *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+	    }
+	  ++__lo;
+	  ++__dest;
+	}
+    else
+      while (__lo < __hi)
+	{
+	  const int __c = wctob(*__lo);
+	  *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+	  ++__lo;
+	  ++__dest;
+	}
+    return __hi;
+  }
+
+  void
+  ctype<wchar_t>::_M_initialize_ctype() throw()
+  {
+    wint_t __i;
+    for (__i = 0; __i < 128; ++__i)
+      {
+	const int __c = wctob(__i);
+	if (__c == EOF)
+	  break;
+	else
+	  _M_narrow[__i] = static_cast<char>(__c);
+      }
+    if (__i == 128)
+      _M_narrow_ok = true;
+    else
+      _M_narrow_ok = false;
+    for (size_t __i = 0;
+	 __i < sizeof(_M_widen) / sizeof(wint_t); ++__i)
+      _M_widen[__i] = btowc(__i);
+  }
+#endif //  _GLIBCXX_USE_WCHAR_T
+}
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h
@@ -0,0 +1,58 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h on DragonFly.
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef const int*		__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef unsigned long	mask;
+    static const mask upper	= _CTYPE_U;
+    static const mask lower 	= _CTYPE_L;
+    static const mask alpha 	= _CTYPE_A;
+    static const mask digit 	= _CTYPE_D;
+    static const mask xdigit 	= _CTYPE_X;
+    static const mask space 	= _CTYPE_S;
+    static const mask print 	= _CTYPE_R;
+    static const mask graph 	= _CTYPE_A | _CTYPE_D | _CTYPE_P;
+    static const mask cntrl 	= _CTYPE_C;
+    static const mask punct 	= _CTYPE_P;
+    static const mask alnum 	= _CTYPE_A | _CTYPE_D;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc
@@ -0,0 +1,99 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ctype_configure_char.cc */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+// Information as gleaned from /usr/include/ctype.h
+  
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  { return 0; }
+
+  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
+		     size_t __refs) 
+  : facet(__refs), _M_del(__table != 0 && __del), 
+  _M_toupper(NULL), _M_tolower(NULL), 
+  _M_table(__table ? __table : classic_table()) 
+  { 
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
+  : facet(__refs), _M_del(__table != 0 && __del), 
+  _M_toupper(NULL), _M_tolower(NULL), 
+  _M_table(__table ? __table : classic_table()) 
+  { 
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  { return ::toupper((int) __c); }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = ::toupper((int) *__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  { return ::tolower((int) __c); }
+
+  const char* 
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = ::tolower((int) *__low);
+	++__low;
+      }
+    return __high;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h
@@ -0,0 +1,133 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/ctype_inline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  {
+    if (_M_table)
+      return _M_table[static_cast<unsigned char>(__c)] & __m;
+    else
+      return __istype(__c, __m);
+  }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    if (_M_table)
+      while (__low < __high)
+	*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    else
+      for (;__low < __high; ++__vec, ++__low)
+	{
+	  *__vec = __maskrune (*__low, upper | lower | alpha | digit | xdigit
+			       | space | print | graph | cntrl | punct | alnum);
+	}
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    if (_M_table)
+      while (__low < __high
+	     && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
+	++__low;
+    else
+      while (__low < __high && !this->is(__m, *__low))
+	++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    if (_M_table)
+      while (__low < __high
+	     && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
+	++__low;
+    else
+      while (__low < __high && this->is(__m, *__low) != 0)
+	++__low;
+    return __low;
+  }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  inline bool
+  ctype<wchar_t>::
+  do_is(mask __m, wchar_t __c) const
+  {
+    return __istype (__c, __m);
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
+  {
+    for (; __lo < __hi; ++__vec, ++__lo)
+      *__vec = __maskrune (*__lo, upper | lower | alpha | digit | xdigit
+			   | space | print | graph | cntrl | punct | alnum);
+    return __hi;
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi && ! __istype (*__lo, __m))
+      ++__lo;
+    return __lo;
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
+  {
+    while (__lo < __hi && __istype (*__lo, __m))
+      ++__lo;
+    return __lo;
+  }
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
@@ -0,0 +1,32 @@
+// Specific definitions for BSD  -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here.  This
+// file will come before all others.
+
+#endif

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-04-19 19:41 Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly John Marino
@ 2014-04-20 19:05 ` Jonathan Wakely
  2014-04-21  4:41   ` John Marino
  2014-05-01 23:03 ` Joseph S. Myers
  1 sibling, 1 reply; 25+ messages in thread
From: Jonathan Wakely @ 2014-04-20 19:05 UTC (permalink / raw)
  To: John Marino
  Cc: gcc-patches, Gerald Pfeifer, manu at gcc dot gnu.org,
	Eric Botcazou (gnu.org), libstdc++

On 19 April 2014 20:39, John Marino wrote:
> Hello GCC developers,
>
> For the last few years, I have been maintaining a large set of patches
> that add support for the DragonFly BSD target and also complete Ada
> frontend support on all four major BSDs among other things.  Before I
> can submit patches for Ada or testsuite cases, DragonFly must be a
> recognized, working target.  The patches attached here will provide
> out-of-the-box support for the C, C++, Objective-C and Fortran frontends.

Thanks for the patch - I only have a few general, minor comments. As
noted at http://gcc.gnu.org/lists.html C++ library patches should go
to the libstdc++ list as well as gcc-patches, so I've CC'd that list
(original mail and patch are at
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01128.html)

Patches should not include generated files such as configure, as the
diffs don't always apply cleanly and the changes are implied by the
patches to files such as acinclude.m4 and configure.ac. The
regenerated versions should of course be committed, and the ChangeLog
should mention they are regenerated, as you've done.

The changelog text should be correctly capitalised and sentences ended
with a period (e.g. "New target." and "New." not "New target" and
"new"). The individual ChangeLog entries at
http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/
would generally be used as the commit message, grouped and prefixed by
the name of the sub-directory:

gcc/
        * config.gcc (*-*-dragonfly*): New target
        etc. etc.

libcilkrts/
        * runtime/os-unix.c (__DragonFly__): New target
        etc. etc.

libgcc/
        * libgcc/config.host (*-*-dragonfly*): New target
        etc. etc.


The libstdc++ changes are OK for trunk if the rest gets approved.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-04-20 19:05 ` Jonathan Wakely
@ 2014-04-21  4:41   ` John Marino
  2014-04-29 15:39     ` [PING] " John Marino
  0 siblings, 1 reply; 25+ messages in thread
From: John Marino @ 2014-04-21  4:41 UTC (permalink / raw)
  To: Jonathan Wakely
  Cc: gcc-patches, Gerald Pfeifer, manu at gcc dot gnu.org,
	Eric Botcazou (gnu.org), libstdc++,
	binutils, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2329 bytes --]

On 4/20/2014 14:51, Jonathan Wakely wrote:
> On 19 April 2014 20:39, John Marino wrote:
>> Hello GCC developers,
>>
>> For the last few years, I have been maintaining a large set of patches
>> that add support for the DragonFly BSD target and also complete Ada
>> frontend support on all four major BSDs among other things.  Before I
>> can submit patches for Ada or testsuite cases, DragonFly must be a
>> recognized, working target.  The patches attached here will provide
>> out-of-the-box support for the C, C++, Objective-C and Fortran frontends.
> 
> Thanks for the patch - I only have a few general, minor comments. As
> noted at http://gcc.gnu.org/lists.html C++ library patches should go
> to the libstdc++ list as well as gcc-patches, so I've CC'd that list
> (original mail and patch are at
> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01128.html)
> 
> Patches should not include generated files such as configure, as the
> diffs don't always apply cleanly and the changes are implied by the
> patches to files such as acinclude.m4 and configure.ac. The
> regenerated versions should of course be committed, and the ChangeLog
> should mention they are regenerated, as you've done.

Thanks for your advice, Jonathan.
I've updated the patch to remove the two "configure" file patches.  I
also removed an errant "-rpath" from the dragonfly.h specs that crept in
from FreeBSD ports.  I've attached the updated patch to this email.

> 
> The changelog text should be correctly capitalised and sentences ended
> with a period (e.g. "New target." and "New." not "New target" and
> "new"). The individual ChangeLog entries at
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/
> would generally be used as the commit message, grouped and prefixed by
> the name of the sub-directory:
> 


I have updated the six entry files at
http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/ to
conform to this style.  I updated the proposed commit message
accordingly:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/proposed_commit-msg.txt


> 
> The libstdc++ changes are OK for trunk if the rest gets approved.

Thanks!
I see from the critique of another submitted patch that also touches
liberty that I'm supposed to cross-post to gdb and binutils, so I've
cc'd them as well.

Regards,
John

[-- Attachment #2: patch-dragonfly-target.revA.txt --]
[-- Type: text/plain, Size: 54514 bytes --]

--- gcc/config.gcc.orig
+++ gcc/config.gcc
@@ -643,6 +643,26 @@
     "" | yes | posix) thread_file='posix' ;;
   esac
   ;;
+*-*-dragonfly*)
+  gas=yes
+  gnu_ld=yes
+  tmake_file="t-slibgcc"
+  case ${enable_threads} in
+    "" | yes | posix)
+      thread_file='posix'
+      ;;
+    no | gnat | single)
+      # Let these non-posix thread selections fall through if requested
+      ;;
+    *)
+      echo 'Unknown thread configuration for DragonFly BSD'
+      exit 1
+      ;;
+  esac
+  extra_options="$extra_options rpath.opt dragonfly.opt"
+  default_use_cxa_atexit=yes
+  use_gcc_stdint=wrap
+  ;;
 *-*-freebsd*)
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
@@ -1352,6 +1372,14 @@
     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
     tmake_file="i386/t-i386elf t-svr4"
     ;;
+i[34567]86-*-dragonfly*)
+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
+	tmake_file="${tmake_file} i386/t-crtstuff"
+	;;
+x86_64-*-dragonfly*)
+	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"
+	tmake_file="${tmake_file} i386/t-crtstuff"
+	;;
 i[34567]86-*-freebsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
 	;;
@@ -4109,6 +4137,8 @@
 		;;
 	i[34567]86-*-mingw* | x86_64-*-mingw*)
 		;;
+	i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
+		;;
 	i[34567]86-*-freebsd* | x86_64-*-freebsd*)
 		;;
 	ia64*-*-linux*)
--- gcc/configure.ac.orig
+++ gcc/configure.ac
@@ -5100,6 +5100,13 @@
       gcc_cv_target_dl_iterate_phdr=no
     fi
     ;;
+  *-*-dragonfly* | *-*-freebsd*)
+    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
+      gcc_cv_target_dl_iterate_phdr=yes
+    else
+      gcc_cv_target_dl_iterate_phdr=no
+    fi
+    ;;
 esac
 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
--- /dev/null
+++ gcc/config/dragonfly-stdint.h
@@ -0,0 +1,56 @@
+/* Definitions for <stdint.h> types for DragonFly systems.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#define SIG_ATOMIC_TYPE   "int"
+
+#define INT8_TYPE         "signed char"
+#define INT16_TYPE        "short int"
+#define INT32_TYPE        "int"
+#define INT64_TYPE        (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
+#define UINT8_TYPE        "unsigned char"
+#define UINT16_TYPE       "short unsigned int"
+#define UINT32_TYPE       "unsigned int"
+#define UINT64_TYPE       (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
+
+#define INT_LEAST8_TYPE   INT8_TYPE
+#define INT_LEAST16_TYPE  INT16_TYPE
+#define INT_LEAST32_TYPE  INT32_TYPE
+#define INT_LEAST64_TYPE  INT64_TYPE
+#define UINT_LEAST8_TYPE  UINT8_TYPE
+#define UINT_LEAST16_TYPE UINT16_TYPE
+#define UINT_LEAST32_TYPE UINT32_TYPE
+#define UINT_LEAST64_TYPE UINT64_TYPE
+
+#define INT_FAST8_TYPE    INT32_TYPE
+#define INT_FAST16_TYPE   INT32_TYPE
+#define INT_FAST32_TYPE   INT32_TYPE
+#define INT_FAST64_TYPE   INT64_TYPE
+#define UINT_FAST8_TYPE   UINT32_TYPE
+#define UINT_FAST16_TYPE  UINT32_TYPE
+#define UINT_FAST32_TYPE  UINT32_TYPE
+#define UINT_FAST64_TYPE  UINT64_TYPE
+
+#define INTPTR_TYPE       (LONG_TYPE_SIZE == 64 ?  INT64_TYPE :  INT32_TYPE)
+#define UINTPTR_TYPE      (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
--- /dev/null
+++ gcc/config/dragonfly.h
@@ -0,0 +1,129 @@
+/* Base configuration file for all DragonFly targets.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#undef  TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()            \
+  do                                        \
+    {                                       \
+       builtin_define_std ("unix");         \
+       builtin_define ("__DragonFly__");    \
+       builtin_assert ("system=unix");      \
+       builtin_assert ("system=bsd");       \
+       builtin_assert ("system=DragonFly"); \
+    }                                       \
+  while (0)
+
+#undef  CPP_SPEC
+#define CPP_SPEC \
+ "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}"
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC	\
+  "%{!shared: \
+     %{pg:gcrt1.o%s} \
+     %{!pg: \
+       %{p:gcrt1.o%s} \
+       %{!p: \
+         %{profile: gcrt1.o%s} \
+         %{!profile: \
+           %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
+   crti.o%s \
+   %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
+#undef  LIB_SPEC
+#define LIB_SPEC \
+  "%{pthread:-lpthread} -lc"
+
+#if defined(HAVE_LD_EH_FRAME_HDR)
+#define LINK_EH_SPEC "--eh-frame-hdr"
+#endif
+
+/* Provide a LINK_SPEC appropriate for DragonFly.  Here we provide support
+   for the special GCC options -static and -shared, which allow us to
+   link things in one of these three modes by applying the appropriate
+   combinations of options at link-time.
+
+   When the -shared link option is used a final link is not being
+   done.  */
+
+#define DFBSD_LINK_SPEC \
+ "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+  %{v:-V} \
+  %{assert*} %{R*} %{rpath*} %{defsym*} \
+  %{shared:-Bshareable %{h*} %{soname*}} \
+  %{!shared: \
+   %{!static: \
+    %{rdynamic:-export-dynamic} \
+    -dynamic-linker %(dfbsd_dynamic_linker) \
+   } \
+   %{static:-Bstatic} \
+  } \
+  %{!static:--hash-style=gnu} \
+  %{symbolic:-Bsymbolic}"
+
+#undef  LINK_SPEC
+#define LINK_SPEC DFBSD_LINK_SPEC
+
+#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
+
+
+/* Use --as-needed -lgcc_s for eh support.  */
+#ifdef HAVE_LD_AS_NEEDED
+#define USE_LD_AS_NEEDED 1
+#endif
+
+/************************[  Target stuff  ]***********************************/
+
+/* All DragonFly Architectures support the ELF object file format.  */
+#undef  OBJECT_FORMAT_ELF
+#define OBJECT_FORMAT_ELF
+
+/* Don't assume anything about the header files.  */
+#undef  NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C	1
+
+/* Follow DragonFly's standard headers (<machine/stdint.h>, etc...).  */
+
+#undef  WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef  WINT_TYPE
+#define WINT_TYPE "int"
+
+/* Code generation parameters.  */
+
+/* Use periods rather than dollar signs in special g++ assembler names.
+   This ensures the configuration knows our system correctly so we can link
+   with libraries compiled with the native cc.  */
+#undef NO_DOLLAR_IN_LABEL
+
+/* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
+   This enables the test coverage code to use file locking when exiting a
+   program, which avoids race conditions if the program has forked.  */
+#define TARGET_POSIX_IO
--- /dev/null
+++ gcc/config/dragonfly.opt
@@ -0,0 +1,64 @@
+; DragonFly BSD options.
+
+; Copyright (C) 2014 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+
+; See the GCC internals manual (options.texi) for a description of this file's format.
+
+; Please try to keep this file in ASCII collating order.
+
+assert
+Driver Separate
+
+assert=
+Driver JoinedOrMissing
+
+defsym
+Driver Separate
+
+defsym=
+Driver JoinedOrMissing
+
+posix
+Driver
+
+profile
+Driver
+
+pthread
+Driver
+
+rdynamic
+Driver
+
+rpath-link
+Driver Separate
+
+rpath-link=
+Driver JoinedOrMissing
+
+rpath=
+Driver JoinedOrMissing
+
+soname
+Driver Separate
+
+soname=
+Driver JoinedOrMissing
+
+; This comment is to ensure we retain the blank line above.
--- /dev/null
+++ gcc/config/i386/dragonfly.h
@@ -0,0 +1,104 @@
+/* Definitions for Intel 386 running DragonFly with ELF format
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+
+/* Override the default comment-starter of "/".  */
+#undef  ASM_COMMENT_START
+#define ASM_COMMENT_START "#"
+
+#undef  ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef  ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#undef  DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) \
+  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
+
+#undef  NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS	1
+
+/* Tell final.c that we don't need a label passed to mcount.  */
+
+#undef  MCOUNT_NAME
+#define MCOUNT_NAME ".mcount"
+
+/* Make gcc agree with <machine/ansi.h>.  */
+
+#undef  SIZE_TYPE
+#define SIZE_TYPE	(TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+#undef  PTRDIFF_TYPE
+#define PTRDIFF_TYPE	(TARGET_64BIT ? "long int" : "int")
+
+#undef  WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE	(TARGET_64BIT ? 32 : BITS_PER_WORD)
+
+#undef  SUBTARGET_EXTRA_SPECS	/* i386.h bogusly defines it.  */
+#define SUBTARGET_EXTRA_SPECS \
+  { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
+
+/* A C statement to output to the stdio stream FILE an assembler
+   command to advance the location counter to a multiple of 1<<LOG
+   bytes if it is within MAX_SKIP bytes.
+
+   This is used to align code labels according to Intel recommendations.  */
+
+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#undef  ASM_OUTPUT_MAX_SKIP_ALIGN
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)					\
+  if ((LOG) != 0) {														\
+    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
+    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
+  }
+#endif
+
+/* Don't default to pcc-struct-return, we want to retain compatibility with
+   older gcc versions AND pcc-struct-return is nonreentrant.
+   (even though the SVR4 ABI for the i386 says that records and unions are
+   returned in memory).  */
+
+#undef  DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* DragonFly sets the rounding precision of the FPU to 53 bits.  Let the
+   compiler get the contents of <float.h> and std::numeric_limits correct.  */
+#undef TARGET_96_ROUND_53_LONG_DOUBLE
+#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
+
+/* Put all *tf routines in libgcc.  */
+#undef LIBGCC2_HAS_TF_MODE
+#define LIBGCC2_HAS_TF_MODE 1
+#define LIBGCC2_TF_CEXT q
+#define TF_SIZE 113
+
+/* Static stack checking is supported by means of probes.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* Support for i386 was removed from DragonFly in 2007  */
+#define SUBTARGET32_DEFAULT_CPU "i486"
+
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
--- gcc/ginclude/stddef.h.orig
+++ gcc/ginclude/stddef.h
@@ -56,6 +56,11 @@
 #include <sys/_types.h>
 #endif
 
+/* Like FreeBSD, DragonFly does not have machine/ansi.h */
+#if defined(__DragonFly__)
+#include <sys/types.h>
+#endif
+
 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
    defined if the corresponding type is *not* defined.
    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
@@ -133,6 +138,7 @@
 #ifndef _BSD_PTRDIFF_T_
 #ifndef ___int_ptrdiff_t_h
 #ifndef _GCC_PTRDIFF_T
+#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
 #define _PTRDIFF_T
 #define _T_PTRDIFF_
 #define _T_PTRDIFF
@@ -141,10 +147,12 @@
 #define _BSD_PTRDIFF_T_
 #define ___int_ptrdiff_t_h
 #define _GCC_PTRDIFF_T
+#define _PTRDIFF_T_DECLARED
 #ifndef __PTRDIFF_TYPE__
 #define __PTRDIFF_TYPE__ long int
 #endif
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#endif /* _PTRDIFF_T_DECLARED */
 #endif /* _GCC_PTRDIFF_T */
 #endif /* ___int_ptrdiff_t_h */
 #endif /* _BSD_PTRDIFF_T_ */
@@ -198,6 +206,7 @@
 #define _GCC_SIZE_T
 #define _SIZET_
 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+  || defined(__DragonFly__) \
   || defined(__FreeBSD_kernel__)
 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
 #elif defined (__VMS__)
@@ -306,7 +315,7 @@
 /* FreeBSD 5 can't be handled well using "traditional" logic above
    since it no longer defines _BSD_RUNE_T_ yet still desires to export
    rune_t in some cases... */
-#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
+#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5))
 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
 #if __BSD_VISIBLE
 #ifndef _RUNE_T_DECLARED
--- include/libiberty.h.orig
+++ include/libiberty.h
@@ -106,7 +106,10 @@
    to find the declaration so provide a fully prototyped one.  If it
    is 1, we found it so don't provide any declaration at all.  */
 #if !HAVE_DECL_BASENAME
-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
+ || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
+ || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
+ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) 
 extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
 #else
 /* Do not allow basename to be used if there is no prototype seen.  We
--- libcilkrts/runtime/os-unix.c.orig
+++ libcilkrts/runtime/os-unix.c
@@ -54,6 +54,8 @@
 #elif defined __APPLE__
 #   include <sys/sysctl.h>
     // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
+#elif defined  __DragonFly__
+// No additional include files
 #elif defined  __FreeBSD__
 // No additional include files
 #elif defined __CYGWIN__
@@ -374,7 +376,7 @@
     assert((unsigned)count == count);
 
     return count;
-#elif defined  __FreeBSD__ || defined __CYGWIN__
+#elif defined  __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__
     int ncores = sysconf(_SC_NPROCESSORS_ONLN);
 
     return ncores;
@@ -402,6 +404,9 @@
     // On MacOS, call sched_yield to yield quantum.  I'm not sure why we
     // don't do this on Linux also.
     sched_yield();
+#elif defined(__DragonFly__)
+    // On DragonFly BSD, call sched_yield to yield quantum.
+    sched_yield();
 #elif defined(__MIC__)
     // On MIC, pthread_yield() really trashes things.  Arch's measurements
     // showed that calling _mm_delay_32() (or doing nothing) was a better
--- libgcc/config.host.orig
+++ libgcc/config.host
@@ -207,6 +207,11 @@
   tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin"
   extra_parts="crt3.o crttms.o crttme.o"
   ;;
+*-*-dragonfly*)
+  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
+  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
+  extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
+  ;;
 *-*-freebsd*)
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
@@ -302,7 +307,10 @@
 esac
 
 case ${host} in
-*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2*)
+*-*-dragonfly* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
+  enable_execute_stack=enable-execute-stack-bsd.c
+  ;;
+*-*-darwin* | *-*-solaris2*)
   enable_execute_stack=enable-execute-stack-mprotect.c
   ;;
 i[34567]86-*-mingw* | x86_64-*-mingw*)
@@ -545,6 +553,14 @@
 x86_64-*-elf*)
 	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
 	;;
+i[34567]86-*-dragonfly*)
+	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
+	md_unwind_header=i386/dragonfly-unwind.h
+	;;
+x86_64-*-dragonfly*)
+	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
+	md_unwind_header=i386/dragonfly-unwind.h
+	;;
 i[34567]86-*-freebsd*)
 	tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
 	;;
@@ -1262,6 +1278,7 @@
   i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
   i[34567]86-*-cygwin* | x86_64-*-cygwin* | \
   i[34567]86-*-mingw* | x86_64-*-mingw* | \
+  i[34567]86-*-dragonfly* | x86_64-*-dragonfly* | \
   i[34567]86-*-freebsd* | x86_64-*-freebsd* | \
   i[34567]86-*-openbsd* | x86_64-*-openbsd*)
   	tmake_file="${tmake_file} t-softfp-tf"
--- libgcc/crtstuff.c.orig
+++ libgcc/crtstuff.c
@@ -79,11 +79,16 @@
 }
 #endif
 
+#if defined(TARGET_DL_ITERATE_PHDR) && \
+   (defined(__DragonFly__) || defined(__FreeBSD__))
+#define BSD_DL_ITERATE_PHDR_AVAILABLE
+#endif
+ 
 #if defined(OBJECT_FORMAT_ELF) \
     && !defined(OBJECT_FORMAT_FLAT) \
     && defined(HAVE_LD_EH_FRAME_HDR) \
     && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
+    && defined(BSD_DL_ITERATE_PHDR_AVAILABLE)
 #include <link.h>
 # define USE_PT_GNU_EH_FRAME
 #endif
--- /dev/null
+++ libgcc/enable-execute-stack-bsd.c
@@ -0,0 +1,59 @@
+/* Implement __enable_execute_stack using mprotect(2).
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#define STACK_PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC)
+
+extern void __enable_execute_stack (void *);
+
+void
+__enable_execute_stack (void *addr)
+{
+  static int size;
+  static long mask;
+  char *page, *ends;
+  long page_addr, ends_addr;
+
+  if (size == 0)
+  {
+    size = getpagesize ();
+    mask = ~((long) size - 1);
+  }
+  page_addr = (long) addr;
+  ends_addr = (long) (addr + __LIBGCC_TRAMPOLINE_SIZE__);
+
+  page = (char *) (page_addr & mask);
+  ends = (char *) ((ends_addr & mask) + size);
+
+  /*
+   * Note that no errors should be emitted by mprotect; it is considered
+   * dangerous for library calls to send messages to stdout/stderr.
+   */
+  if (mprotect (page, ends - page, STACK_PROT_RWX) < 0)
+    abort ();
+}
--- libgcc/unwind-dw2-fde-dip.c.orig
+++ libgcc/unwind-dw2-fde-dip.c
@@ -58,7 +58,8 @@
 #endif
 
 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
+    && defined(TARGET_DL_ITERATE_PHDR) \
+    && (defined(__DragonFly__) || defined(__FreeBSD__))
 # define ElfW __ElfN
 # define USE_PT_GNU_EH_FRAME
 #endif
--- /dev/null
+++ libgcc/config/i386/dragonfly-unwind.h
@@ -0,0 +1,180 @@
+/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* Do code reading to identify a signal frame, and set the frame
+   state data appropriately.  See unwind-dw2.c for the structs. */
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+#include <machine/sigframe.h>
+
+
+#define REG_NAME(reg)	sf_uc.uc_mcontext.mc_## reg
+
+#ifdef __x86_64__
+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
+
+
+static void
+x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 32;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_64_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(rsp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  /* Register 7 is rsp  */
+  fs->regs.cfa_reg = 7;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
+  fs->regs.reg[4].how = REG_SAVED_OFFSET;
+  fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
+  fs->regs.reg[9].how = REG_SAVED_OFFSET;
+  fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
+  fs->regs.reg[10].how = REG_SAVED_OFFSET;
+  fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
+  fs->regs.reg[11].how = REG_SAVED_OFFSET;
+  fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
+  fs->regs.reg[12].how = REG_SAVED_OFFSET;
+  fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
+  fs->regs.reg[13].how = REG_SAVED_OFFSET;
+  fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
+  fs->regs.reg[14].how = REG_SAVED_OFFSET;
+  fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
+  fs->regs.reg[15].how = REG_SAVED_OFFSET;
+  fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
+  fs->regs.reg[16].how = REG_SAVED_OFFSET;
+  fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
+  fs->retaddr_column = 16;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+
+#else /* Next section is for i386  */
+
+#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
+
+
+static void
+x86_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 128;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
+
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(esp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  fs->regs.cfa_reg = 4;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
+  fs->regs.reg[7].how = REG_SAVED_OFFSET;
+  fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
+  fs->retaddr_column = 8;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+#endif /* ifdef __x86_64__  */
--- libitm/configure.tgt.orig
+++ libitm/configure.tgt
@@ -140,7 +140,7 @@
   *-*-gnu* | *-*-k*bsd*-gnu \
   | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
   | *-*-solaris2* | *-*-sysv4* | *-*-hpux11* \
-  | *-*-darwin* | *-*-aix*)
+  | *-*-darwin* | *-*-aix* | *-*-dragonfly*)
 	# POSIX system.  The OS is supported.
 	;;
 
--- libstdc++-v3/acinclude.m4.orig
+++ libstdc++-v3/acinclude.m4
@@ -1989,6 +1989,9 @@
       darwin* | freebsd*)
 	enable_clocale_flag=darwin
 	;;
+      dragonfly*)
+	enable_clocale_flag=dragonfly
+	;;
       openbsd*)
 	enable_clocale_flag=newlib
 	;;
@@ -2075,6 +2078,23 @@
       CMESSAGES_H=config/locale/generic/messages_members.h
       CMESSAGES_CC=config/locale/generic/messages_members.cc
       CMONEY_CC=config/locale/generic/monetary_members.cc
+      CNUMERIC_CC=config/locale/generic/numeric_members.cc
+      CTIME_H=config/locale/generic/time_members.h
+      CTIME_CC=config/locale/generic/time_members.cc
+      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+      ;;
+
+    dragonfly)
+      AC_MSG_RESULT(dragonfly)
+
+      CLOCALE_H=config/locale/generic/c_locale.h
+      CLOCALE_CC=config/locale/dragonfly/c_locale.cc
+      CCODECVT_CC=config/locale/generic/codecvt_members.cc
+      CCOLLATE_CC=config/locale/generic/collate_members.cc
+      CCTYPE_CC=config/locale/dragonfly/ctype_members.cc
+      CMESSAGES_H=config/locale/generic/messages_members.h
+      CMESSAGES_CC=config/locale/generic/messages_members.cc
+      CMONEY_CC=config/locale/generic/monetary_members.cc
       CNUMERIC_CC=config/locale/generic/numeric_members.cc
       CTIME_H=config/locale/generic/time_members.h
       CTIME_CC=config/locale/generic/time_members.cc
--- libstdc++-v3/configure.host.orig
+++ libstdc++-v3/configure.host
@@ -260,6 +260,9 @@
     os_include_dir="os/djgpp"
     error_constants_dir="os/djgpp"
     ;;
+  dragonfly*)
+    os_include_dir="os/bsd/dragonfly"
+    ;;
   freebsd*)
     os_include_dir="os/bsd/freebsd"
     ;;
--- /dev/null
+++ libstdc++-v3/config/locale/dragonfly/c_locale.cc
@@ -0,0 +1,299 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.8  Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <cerrno>  // For errno
+#include <cmath>  // For isinf, finite, finitef, fabs
+#include <cstdlib>  // For strof, strtold
+#include <cstring>
+#include <cstdio>
+#include <locale>
+#include <limits>
+
+#ifdef _GLIBCXX_HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<>
+    void
+    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
+		   const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+      char* __sanity;
+      bool __overflow = false;
+
+#if !__FLT_HAS_INFINITY__
+      errno = 0;
+#endif
+
+#ifdef _GLIBCXX_HAVE_STRTOF
+      __v = strtof(__s, &__sanity);
+#else
+      double __d = strtod(__s, &__sanity);
+      __v = static_cast<float>(__d);
+#ifdef _GLIBCXX_HAVE_FINITEF
+      if (!finitef (__v))
+	__overflow = true;
+#elif defined (_GLIBCXX_HAVE_FINITE)
+      if (!finite (static_cast<double> (__v)))
+	__overflow = true;
+#elif defined (_GLIBCXX_HAVE_ISINF)
+      if (isinf (static_cast<double> (__v)))
+	__overflow = true;
+#else
+      if (fabs(__d) > numeric_limits<float>::max())
+	__overflow = true;
+#endif
+#endif // _GLIBCXX_HAVE_STRTOF
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+	{
+	  __v = 0.0f;
+	  __err = ios_base::failbit;
+	}
+      else if (__overflow
+#if __FLT_HAS_INFINITY__
+	       || __v == numeric_limits<float>::infinity()
+	       || __v == -numeric_limits<float>::infinity()
+#else
+	       || ((__v > 1.0f || __v < -1.0f) && errno == ERANGE)
+#endif
+	      )
+	{
+	  if (__v > 0.0f)
+	    __v = numeric_limits<float>::max();
+	  else
+	    __v = -numeric_limits<float>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+  template<>
+    void
+    __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
+		   const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+      char* __sanity;
+
+#if !__DBL_HAS_INFINITY__
+      errno = 0;
+#endif
+
+      __v = strtod(__s, &__sanity);
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+	{
+	  __v = 0.0;
+	  __err = ios_base::failbit;
+	}
+      else if (
+#if __DBL_HAS_INFINITY__
+	       __v == numeric_limits<double>::infinity()
+	       || __v == -numeric_limits<double>::infinity())
+#else
+	       (__v > 1.0 || __v < -1.0) && errno == ERANGE)
+#endif
+	{
+	  if (__v > 0.0)
+	    __v = numeric_limits<double>::max();
+	  else
+	    __v = -numeric_limits<double>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+  template<>
+    void
+    __convert_to_v(const char* __s, long double& __v,
+		   ios_base::iostate& __err, const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+
+#if !__LDBL_HAS_INFINITY__
+      errno = 0;
+#endif
+
+#if defined(_GLIBCXX_HAVE_STRTOLD) && !defined(_GLIBCXX_HAVE_BROKEN_STRTOLD)
+      char* __sanity;
+      __v = strtold(__s, &__sanity);
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+#else
+      typedef char_traits<char>::int_type int_type;
+      int __p = sscanf(__s, "%Lf", &__v);
+
+      if (!__p || static_cast<int_type>(__p) == char_traits<char>::eof())
+#endif
+	{
+	  __v = 0.0l;
+	  __err = ios_base::failbit;
+	}
+       else if (
+#if __LDBL_HAS_INFINITY__
+		__v == numeric_limits<long double>::infinity()
+		|| __v == -numeric_limits<long double>::infinity())
+#else
+		(__v > 1.0l || __v < -1.0l) && errno == ERANGE)
+#endif
+	{
+	  if (__v > 0.0l)
+	    __v = numeric_limits<long double>::max();
+	  else
+	    __v = -numeric_limits<long double>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+
+  /*  DragonFly's implementation of setlocale won't accept something like
+      "de_DE".  According to nls manpage, the expected format is:
+      language[_territory][.codeset][@modifier], but it seems that both
+      the _territory and .codeset components are required.
+      
+      As an attempt to correct for this, we'll tack on ".UTF-8" if 
+      a period is not detected in the locale string.  
+
+      There are no locales with modifiers on DragonFly so if found, they
+      will just be stripped off silently.  e.g "de_DE@euro" will be reduced
+      to "de_DE".  The UTF-8 default would be added after that.
+  */
+
+  void
+  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
+				    __c_locale)
+  {
+    const size_t size__s = (__s == NULL) ? 1 : strlen (__s);
+    const char UTF8[] = ".UTF-8";
+    char localspec[size__s + 6 + 1];
+    
+    if (__s == NULL) {
+       localspec[0] = NULL;
+    } else {
+       strcpy (localspec, __s);
+       char * pch = strchr (localspec, '@');
+       if (pch != NULL)
+          *pch = 0;
+
+       if (  (strchr (__s, '.') == NULL)
+          && (strcmp (__s, "C") != 0)
+          && (strcmp (__s, "POSIX") != 0))
+          strncat (localspec, UTF8, 6);
+    }
+
+    const char * result = std::setlocale(LC_ALL, localspec);
+    
+    if ((strcmp(result, "C") != 0) && (strcmp (result, localspec) != 0))
+      __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
+			    "name not valid"));
+    __cloc = 0;
+  }
+
+  void
+  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
+  { __cloc = 0; }
+
+  __c_locale
+  locale::facet::_S_clone_c_locale(__c_locale&) throw()
+  { return __c_locale(); }
+
+  __c_locale
+  locale::facet::_S_lc_ctype_c_locale(__c_locale, const char*)
+  { return __c_locale(); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
+    {
+      "LC_CTYPE",
+      "LC_NUMERIC",
+      "LC_TIME",
+      "LC_COLLATE",
+      "LC_MONETARY",
+      "LC_MESSAGES"
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  const char* const* const locale::_S_categories = __gnu_cxx::category_names;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+// XXX GLIBCXX_ABI Deprecated
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
+  extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- /dev/null
+++ libstdc++-v3/config/locale/dragonfly/ctype_members.cc
@@ -0,0 +1,173 @@
+// std::ctype implementation details, GNU version -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+#include <bits/c++locale_internal.h>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  // NB: The other ctype<char> specializations are in src/locale.cc and
+  // various /config/os/* files.
+
+  ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+  : ctype<char>(0, false, __refs) 
+  { 		
+    if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+      {
+	this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+	this->_S_create_c_locale(this->_M_c_locale_ctype, __s); 
+      }
+  }
+
+  ctype_byname<char>::~ctype_byname()
+  { }
+
+#ifdef _GLIBCXX_USE_WCHAR_T  
+  ctype<wchar_t>::__wmask_type
+  ctype<wchar_t>::_M_convert_to_wmask(
+    const mask __attribute__((__unused__)) __m) const throw()
+  {
+    // DragonFly uses the same codes for 'char' as 'wchar_t', so this routine
+    // never gets called.
+    return __wmask_type();
+  };
+  
+  wchar_t
+  ctype<wchar_t>::do_toupper(wchar_t __c) const
+  { return towupper(__c); }
+
+  const wchar_t*
+  ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi)
+      {
+        *__lo = towupper(*__lo);
+        ++__lo;
+      }
+    return __hi;
+  }
+  
+  wchar_t
+  ctype<wchar_t>::do_tolower(wchar_t __c) const
+  { return towlower(__c); }
+  
+  const wchar_t*
+  ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi)
+      {
+        *__lo = towlower(*__lo);
+        ++__lo;
+      }
+    return __hi;
+  }
+
+  wchar_t
+  ctype<wchar_t>::
+  do_widen(char __c) const
+  { return _M_widen[static_cast<unsigned char>(__c)]; }
+
+  const char* 
+  ctype<wchar_t>::
+  do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
+  {
+    while (__lo < __hi)
+      {
+	*__dest = _M_widen[static_cast<unsigned char>(*__lo)];
+	++__lo;
+	++__dest;
+      }
+    return __hi;
+  }
+
+  char
+  ctype<wchar_t>::
+  do_narrow(wchar_t __wc, char __dfault) const
+  { 
+    if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
+      return _M_narrow[__wc];
+    const int __c = wctob(__wc);
+    return (__c == EOF ? __dfault : static_cast<char>(__c)); 
+  }
+
+  const wchar_t*
+  ctype<wchar_t>::
+  do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, 
+	    char* __dest) const
+  {
+    if (_M_narrow_ok)
+      while (__lo < __hi)
+	{
+	  if (*__lo >= 0 && *__lo < 128)
+	    *__dest = _M_narrow[*__lo];
+	  else
+	    {
+	      const int __c = wctob(*__lo);
+	      *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+	    }
+	  ++__lo;
+	  ++__dest;
+	}
+    else
+      while (__lo < __hi)
+	{
+	  const int __c = wctob(*__lo);
+	  *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+	  ++__lo;
+	  ++__dest;
+	}
+    return __hi;
+  }
+
+  void
+  ctype<wchar_t>::_M_initialize_ctype() throw()
+  {
+    wint_t __i;
+    for (__i = 0; __i < 128; ++__i)
+      {
+	const int __c = wctob(__i);
+	if (__c == EOF)
+	  break;
+	else
+	  _M_narrow[__i] = static_cast<char>(__c);
+      }
+    if (__i == 128)
+      _M_narrow_ok = true;
+    else
+      _M_narrow_ok = false;
+    for (size_t __i = 0;
+	 __i < sizeof(_M_widen) / sizeof(wint_t); ++__i)
+      _M_widen[__i] = btowc(__i);
+  }
+#endif //  _GLIBCXX_USE_WCHAR_T
+}
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h
@@ -0,0 +1,58 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h on DragonFly.
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef const int*		__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef unsigned long	mask;
+    static const mask upper	= _CTYPE_U;
+    static const mask lower 	= _CTYPE_L;
+    static const mask alpha 	= _CTYPE_A;
+    static const mask digit 	= _CTYPE_D;
+    static const mask xdigit 	= _CTYPE_X;
+    static const mask space 	= _CTYPE_S;
+    static const mask print 	= _CTYPE_R;
+    static const mask graph 	= _CTYPE_A | _CTYPE_D | _CTYPE_P;
+    static const mask cntrl 	= _CTYPE_C;
+    static const mask punct 	= _CTYPE_P;
+    static const mask alnum 	= _CTYPE_A | _CTYPE_D;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc
@@ -0,0 +1,99 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ctype_configure_char.cc */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+// Information as gleaned from /usr/include/ctype.h
+  
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  { return 0; }
+
+  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
+		     size_t __refs) 
+  : facet(__refs), _M_del(__table != 0 && __del), 
+  _M_toupper(NULL), _M_tolower(NULL), 
+  _M_table(__table ? __table : classic_table()) 
+  { 
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
+  : facet(__refs), _M_del(__table != 0 && __del), 
+  _M_toupper(NULL), _M_tolower(NULL), 
+  _M_table(__table ? __table : classic_table()) 
+  { 
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  { return ::toupper((int) __c); }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = ::toupper((int) *__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  { return ::tolower((int) __c); }
+
+  const char* 
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = ::tolower((int) *__low);
+	++__low;
+      }
+    return __high;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h
@@ -0,0 +1,133 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/ctype_inline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  {
+    if (_M_table)
+      return _M_table[static_cast<unsigned char>(__c)] & __m;
+    else
+      return __istype(__c, __m);
+  }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    if (_M_table)
+      while (__low < __high)
+	*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    else
+      for (;__low < __high; ++__vec, ++__low)
+	{
+	  *__vec = __maskrune (*__low, upper | lower | alpha | digit | xdigit
+			       | space | print | graph | cntrl | punct | alnum);
+	}
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    if (_M_table)
+      while (__low < __high
+	     && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
+	++__low;
+    else
+      while (__low < __high && !this->is(__m, *__low))
+	++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    if (_M_table)
+      while (__low < __high
+	     && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
+	++__low;
+    else
+      while (__low < __high && this->is(__m, *__low) != 0)
+	++__low;
+    return __low;
+  }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  inline bool
+  ctype<wchar_t>::
+  do_is(mask __m, wchar_t __c) const
+  {
+    return __istype (__c, __m);
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
+  {
+    for (; __lo < __hi; ++__vec, ++__lo)
+      *__vec = __maskrune (*__lo, upper | lower | alpha | digit | xdigit
+			   | space | print | graph | cntrl | punct | alnum);
+    return __hi;
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi && ! __istype (*__lo, __m))
+      ++__lo;
+    return __lo;
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
+  {
+    while (__lo < __hi && __istype (*__lo, __m))
+      ++__lo;
+    return __lo;
+  }
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+++ libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
@@ -0,0 +1,32 @@
+// Specific definitions for BSD  -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here.  This
+// file will come before all others.
+
+#endif

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PING] Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-04-21  4:41   ` John Marino
@ 2014-04-29 15:39     ` John Marino
  2014-04-29 17:25       ` Ian Lance Taylor
  0 siblings, 1 reply; 25+ messages in thread
From: John Marino @ 2014-04-29 15:39 UTC (permalink / raw)
  Cc: gcc-patches, Ian Lance Taylor, libstdc++, binutils, gdb-patches

Hi folks,
Does anyone have any issues with this set of patches to add support for
the DragonFly targets?  It's a blocker for other patches of mine that
have a more general benefit, but this (relatively simple) one has to go
in first.

Thanks,
John

On 4/20/2014 21:04, John Marino wrote:
> On 4/20/2014 14:51, Jonathan Wakely wrote:
>> On 19 April 2014 20:39, John Marino wrote:
>>> Hello GCC developers,
>>>
>>> For the last few years, I have been maintaining a large set of patches
>>> that add support for the DragonFly BSD target and also complete Ada
>>> frontend support on all four major BSDs among other things.  Before I
>>> can submit patches for Ada or testsuite cases, DragonFly must be a
>>> recognized, working target.  The patches attached here will provide
>>> out-of-the-box support for the C, C++, Objective-C and Fortran frontends.
>>
>> Thanks for the patch - I only have a few general, minor comments. As
>> noted at http://gcc.gnu.org/lists.html C++ library patches should go
>> to the libstdc++ list as well as gcc-patches, so I've CC'd that list
>> (original mail and patch are at
>> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01128.html)
>>
>> Patches should not include generated files such as configure, as the
>> diffs don't always apply cleanly and the changes are implied by the
>> patches to files such as acinclude.m4 and configure.ac. The
>> regenerated versions should of course be committed, and the ChangeLog
>> should mention they are regenerated, as you've done.
> 
> Thanks for your advice, Jonathan.
> I've updated the patch to remove the two "configure" file patches.  I
> also removed an errant "-rpath" from the dragonfly.h specs that crept in
> from FreeBSD ports.  I've attached the updated patch to this email.
> 
>>
>> The changelog text should be correctly capitalised and sentences ended
>> with a period (e.g. "New target." and "New." not "New target" and
>> "new"). The individual ChangeLog entries at
>> http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/
>> would generally be used as the commit message, grouped and prefixed by
>> the name of the sub-directory:
>>
> 
> 
> I have updated the six entry files at
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/ to
> conform to this style.  I updated the proposed commit message
> accordingly:
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/proposed_commit-msg.txt
> 
> 
>>
>> The libstdc++ changes are OK for trunk if the rest gets approved.
> 
> Thanks!
> I see from the critique of another submitted patch that also touches
> liberty that I'm supposed to cross-post to gdb and binutils, so I've
> cc'd them as well.
> 
> Regards,
> John
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PING] Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-04-29 15:39     ` [PING] " John Marino
@ 2014-04-29 17:25       ` Ian Lance Taylor
  2014-04-29 18:50         ` John Marino
  0 siblings, 1 reply; 25+ messages in thread
From: Ian Lance Taylor @ 2014-04-29 17:25 UTC (permalink / raw)
  To: John Marino; +Cc: gcc-patches, libstdc++, Binutils, gdb-patches

On Tue, Apr 29, 2014 at 11:37 AM, John Marino <gnugcc@marino.st> wrote:
>
> Does anyone have any issues with this set of patches to add support for
> the DragonFly targets?  It's a blocker for other patches of mine that
> have a more general benefit, but this (relatively simple) one has to go
> in first.

It's inconvenient, but patches are much more likely to be reviewed
when they cover a separate part of the tree, as different people
maintain different parts.  I expect your libitm and libcilkrts could
be approved trivially if you send them separately.

The change to include/libiberty.h is fine.

I don't understand the benefit of libgcc/enable-execute-stack-bsd.c.
The code seems the same as the existing
libgcc/enable-execute-stack-mprotect.c.  All you are changing is
omitting need_enable_exec_stack.  If you just drop the FreeBSD
constructor, you will get the behaviour you want.

Ian

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PING] Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-04-29 17:25       ` Ian Lance Taylor
@ 2014-04-29 18:50         ` John Marino
  2014-04-30  0:07           ` Ian Lance Taylor
  0 siblings, 1 reply; 25+ messages in thread
From: John Marino @ 2014-04-29 18:50 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-patches, libstdc++, Binutils, gdb-patches

On 4/29/2014 19:23, Ian Lance Taylor wrote:
> On Tue, Apr 29, 2014 at 11:37 AM, John Marino <gnugcc@marino.st> wrote:
>>
>> Does anyone have any issues with this set of patches to add support for
>> the DragonFly targets?  It's a blocker for other patches of mine that
>> have a more general benefit, but this (relatively simple) one has to go
>> in first.
> 
> It's inconvenient, but patches are much more likely to be reviewed
> when they cover a separate part of the tree, as different people
> maintain different parts.  I expect your libitm and libcilkrts could
> be approved trivially if you send them separately.

Hi Ian,
I was trying to identify specific people (e.g. an libitm person) and
have them approve specific files since they are trivial as you saw.  I
decided to keep the patch set as an atomic unit because it needs to be
committed as a unit, and also because I assumed it provided the
necessary context.


> The change to include/libiberty.h is fine.

thanks!

> I don't understand the benefit of libgcc/enable-execute-stack-bsd.c.
> The code seems the same as the existing
> libgcc/enable-execute-stack-mprotect.c.  All you are changing is
> omitting need_enable_exec_stack.  If you just drop the FreeBSD
> constructor, you will get the behaviour you want.

With the caveat that this patch is over 2 years old, I just took a look
at both files.  I would have not needed to modify this file at all for
DragonFly.  In fact, I seem to recall that I didn't modify it for
DragonFly, but rather for FreeBSD.  If I had to guess, it would be that
I found mprotect() was needed regardless of value of kern.stackprot.  I
must have traced some test failures back to this.

Which I guess that's what you mean - just delete the block between "#if
defined __FreeBSD__" and the next #elif which should be equivalent.  I
can tweak the patch set to do that.


And what about the dl_iterate_phdr changes?  Do they look good to you?

Thanks,
John

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PING] Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-04-29 18:50         ` John Marino
@ 2014-04-30  0:07           ` Ian Lance Taylor
  0 siblings, 0 replies; 25+ messages in thread
From: Ian Lance Taylor @ 2014-04-30  0:07 UTC (permalink / raw)
  To: John Marino; +Cc: gcc-patches, libstdc++, Binutils, gdb-patches

On Tue, Apr 29, 2014 at 2:37 PM, John Marino <gnugcc@marino.st> wrote:
>
>> I don't understand the benefit of libgcc/enable-execute-stack-bsd.c.
>> The code seems the same as the existing
>> libgcc/enable-execute-stack-mprotect.c.  All you are changing is
>> omitting need_enable_exec_stack.  If you just drop the FreeBSD
>> constructor, you will get the behaviour you want.
>
> With the caveat that this patch is over 2 years old, I just took a look
> at both files.  I would have not needed to modify this file at all for
> DragonFly.  In fact, I seem to recall that I didn't modify it for
> DragonFly, but rather for FreeBSD.  If I had to guess, it would be that
> I found mprotect() was needed regardless of value of kern.stackprot.  I
> must have traced some test failures back to this.
>
> Which I guess that's what you mean - just delete the block between "#if
> defined __FreeBSD__" and the next #elif which should be equivalent.  I
> can tweak the patch set to do that.

Yes.

> And what about the dl_iterate_phdr changes?  Do they look good to you?

They looked fine to me but I'm not a build system maintainer.

Ian

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-04-19 19:41 Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly John Marino
  2014-04-20 19:05 ` Jonathan Wakely
@ 2014-05-01 23:03 ` Joseph S. Myers
  2014-05-01 23:46   ` John Marino
  1 sibling, 1 reply; 25+ messages in thread
From: Joseph S. Myers @ 2014-05-01 23:03 UTC (permalink / raw)
  To: John Marino
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

The include of <sys/types.h> from <stddef.h> seems risky, given that 
that's a POSIX header that typically defines various types ISO C does not 
permit to be defined in <stddef.h> (ISO C does not have any general *_t 
namespace reservation, unlike POSIX).

Have you verified that if you include <stddef.h> with -std=c90 / -std=c99 
/ -std=c11, the resulting definitions (compiler and preprocessor) are all 
ones permitted by the relevant C standard version to be provided by 
<stddef.h>?

(I don't know what the FreeBSD <sys/_types.h> defines, but it at least 
seems possible from the name that it is only defining things in the 
implementation namespace, with the public <sys/types.h> being what then 
includes <sys/_types.h> and does "typedef __foo_t foo_t;" or similar to 
provide the public POSIX types that aren't in ISO C.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-01 23:03 ` Joseph S. Myers
@ 2014-05-01 23:46   ` John Marino
  2014-05-02 17:49     ` Joseph S. Myers
  0 siblings, 1 reply; 25+ messages in thread
From: John Marino @ 2014-05-01 23:46 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 5/2/2014 01:03, Joseph S. Myers wrote:
> The include of <sys/types.h> from <stddef.h> seems risky, given that 
> that's a POSIX header that typically defines various types ISO C does not 
> permit to be defined in <stddef.h> (ISO C does not have any general *_t 
> namespace reservation, unlike POSIX).
> 
> Have you verified that if you include <stddef.h> with -std=c90 / -std=c99 
> / -std=c11, the resulting definitions (compiler and preprocessor) are all 
> ones permitted by the relevant C standard version to be provided by 
> <stddef.h>?

You bring up some interesting points.  I haven't specific tested
anything like that, but DragonFly has been using this modification for
years - since gcc 4.6 at least.  It is even in the primary base compiler:

http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/contrib/gcc-4.7/gcc/ginclude/stddef.h

So given the track record (building itself, building base, building
21,000 software ports) over a couple of years I think any issues this
could have caused would have been seen and identified by now.

> 
> (I don't know what the FreeBSD <sys/_types.h> defines, but it at least 
> seems possible from the name that it is only defining things in the 
> implementation namespace, with the public <sys/types.h> being what then 
> includes <sys/_types.h> and does "typedef __foo_t foo_t;" or similar to 
> provide the public POSIX types that aren't in ISO C.)

Here are the headers in question:
http://grok.dragonflybsd.org/xref/freebsd/sys/sys/_types.h
http://grok.dragonflybsd.org/xref/dragonfly/sys/sys/types.h

Thanks,
John


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-01 23:46   ` John Marino
@ 2014-05-02 17:49     ` Joseph S. Myers
  2014-05-02 18:17       ` John Marino
  0 siblings, 1 reply; 25+ messages in thread
From: Joseph S. Myers @ 2014-05-02 17:49 UTC (permalink / raw)
  To: John Marino
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On Fri, 2 May 2014, John Marino wrote:

> So given the track record (building itself, building base, building
> 21,000 software ports) over a couple of years I think any issues this
> could have caused would have been seen and identified by now.

These issues aren't generally obvious (given that the ISO C conformance 
modes aren't used that often, and when they are that doesn't mean the 
application is using POSIX types for something else).

> > (I don't know what the FreeBSD <sys/_types.h> defines, but it at least 
> > seems possible from the name that it is only defining things in the 
> > implementation namespace, with the public <sys/types.h> being what then 
> > includes <sys/_types.h> and does "typedef __foo_t foo_t;" or similar to 
> > provide the public POSIX types that aren't in ISO C.)
> 
> Here are the headers in question:
> http://grok.dragonflybsd.org/xref/freebsd/sys/sys/_types.h

That seems OK for <stddef.h> inclusion, as long as the <machine/_types.h> 
is OK.

> http://grok.dragonflybsd.org/xref/dragonfly/sys/sys/types.h

That's definitely not correct to include in <stddef.h>; it defines lots of 
types outside the ISO C namespace.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-02 17:49     ` Joseph S. Myers
@ 2014-05-02 18:17       ` John Marino
  2014-05-02 20:15         ` Joseph S. Myers
  0 siblings, 1 reply; 25+ messages in thread
From: John Marino @ 2014-05-02 18:17 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 5/2/2014 19:49, Joseph S. Myers wrote:
> On Fri, 2 May 2014, John Marino wrote:
> 
>> http://grok.dragonflybsd.org/xref/dragonfly/sys/sys/types.h
> 
> That's definitely not correct to include in <stddef.h>; it defines lots of 
> types outside the ISO C namespace.

Ok.
So I guess there are two problems.
1) I don't know which type definitions are missing (iow, the important
ones from sys/type.h that are required to build gcc)
2) Mainly because of 1) I don't know what to pull in instead.  DragonFly
doesn't have this _type.h split like FreeBSD

Do you have a suggestion for me on how to proceed?
Thanks,
John

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-02 18:17       ` John Marino
@ 2014-05-02 20:15         ` Joseph S. Myers
  2014-05-02 20:20           ` John Marino
  2014-05-03  7:12           ` John Marino
  0 siblings, 2 replies; 25+ messages in thread
From: Joseph S. Myers @ 2014-05-02 20:15 UTC (permalink / raw)
  To: John Marino
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On Fri, 2 May 2014, John Marino wrote:

> 1) I don't know which type definitions are missing (iow, the important
> ones from sys/type.h that are required to build gcc)

The default presumption should be:

* <stddef.h> from GCC provides what it needs to provide; nothing extra is 
needed and such a #include should not be needed at all.

* Special measures to avoid duplicate typedefs (where some other header 
also defines one of the typedefs defined in <stddef.h>) aren't in fact 
needed, because GCC allows duplicate typedefs in system headers (even 
outside C11 mode - in C11 mode it's a standard feature).

So try removing that #include.  If that causes problems, investigate based 
on the actual problems seen.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-02 20:15         ` Joseph S. Myers
@ 2014-05-02 20:20           ` John Marino
  2014-05-03  7:12           ` John Marino
  1 sibling, 0 replies; 25+ messages in thread
From: John Marino @ 2014-05-02 20:20 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 5/2/2014 22:15, Joseph S. Myers wrote:
> On Fri, 2 May 2014, John Marino wrote:
> 
>> 1) I don't know which type definitions are missing (iow, the important
>> ones from sys/type.h that are required to build gcc)
> 
> The default presumption should be:
> 
> * <stddef.h> from GCC provides what it needs to provide; nothing extra is 
> needed and such a #include should not be needed at all.
> 
> * Special measures to avoid duplicate typedefs (where some other header 
> also defines one of the typedefs defined in <stddef.h>) aren't in fact 
> needed, because GCC allows duplicate typedefs in system headers (even 
> outside C11 mode - in C11 mode it's a standard feature).
> 
> So try removing that #include.  If that causes problems, investigate based 
> on the actual problems seen.

Okay, will do.
Thanks!

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-02 20:15         ` Joseph S. Myers
  2014-05-02 20:20           ` John Marino
@ 2014-05-03  7:12           ` John Marino
  2014-05-08 13:15             ` Jonathan Wakely
  2014-05-09  5:27             ` Jeff Law
  1 sibling, 2 replies; 25+ messages in thread
From: John Marino @ 2014-05-03  7:12 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 5/2/2014 22:15, Joseph S. Myers wrote:
> On Fri, 2 May 2014, John Marino wrote:
> 
>> 1) I don't know which type definitions are missing (iow, the important
>> ones from sys/type.h that are required to build gcc)
> 
> The default presumption should be:
> 
> * <stddef.h> from GCC provides what it needs to provide; nothing extra is 
> needed and such a #include should not be needed at all.
> 
> * Special measures to avoid duplicate typedefs (where some other header 
> also defines one of the typedefs defined in <stddef.h>) aren't in fact 
> needed, because GCC allows duplicate typedefs in system headers (even 
> outside C11 mode - in C11 mode it's a standard feature).
> 
> So try removing that #include.  If that causes problems, investigate based 
> on the actual problems seen.

Hi Joseph,
Removing the include worked after also removing the #ifdef __DragonFly
with regards to the rune_t type definition.

I built gcc with a full bootstraps on both DragonFly platforms
successfully.  stddef.h is much simpler now:

--- gcc/ginclude/stddef.h.orig
+++ gcc/ginclude/stddef.h
@@ -133,6 +133,7 @@
 #ifndef _BSD_PTRDIFF_T_
 #ifndef ___int_ptrdiff_t_h
 #ifndef _GCC_PTRDIFF_T
+#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
 #define _PTRDIFF_T
 #define _T_PTRDIFF_
 #define _T_PTRDIFF
@@ -141,10 +142,12 @@
 #define _BSD_PTRDIFF_T_
 #define ___int_ptrdiff_t_h
 #define _GCC_PTRDIFF_T
+#define _PTRDIFF_T_DECLARED
 #ifndef __PTRDIFF_TYPE__
 #define __PTRDIFF_TYPE__ long int
 #endif
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#endif /* _PTRDIFF_T_DECLARED */
 #endif /* _GCC_PTRDIFF_T */
 #endif /* ___int_ptrdiff_t_h */
 #endif /* _BSD_PTRDIFF_T_ */
@@ -198,6 +201,7 @@
 #define _GCC_SIZE_T
 #define _SIZET_
 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+  || defined(__DragonFly__) \
   || defined(__FreeBSD_kernel__)
 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
 #elif defined (__VMS__)


revised patchset  :
http://leaf.dragonflybsd.org/~marino/gcc-df-target/patches/patch-dragonfly-target
revised changelog :
http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/gcc_ChangeLog_entry.txt
revised commit msg:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/proposed_commit-msg.txt

Good catch!  Does the rest of the patch set look good to you?  I think
all the non-obvious patches have been reviewed collectively by various
people now and may be ready to be approved now.

Thanks,
John

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-03  7:12           ` John Marino
@ 2014-05-08 13:15             ` Jonathan Wakely
  2014-05-08 13:32               ` Jeff Law
  2014-05-09  5:27             ` Jeff Law
  1 sibling, 1 reply; 25+ messages in thread
From: Jonathan Wakely @ 2014-05-08 13:15 UTC (permalink / raw)
  To: John Marino
  Cc: Joseph S. Myers, gcc-patches, Gerald Pfeifer,
	manu at gcc dot gnu.org, Eric Botcazou (gnu.org)

On 3 May 2014 08:11, John Marino wrote:
> On 5/2/2014 22:15, Joseph S. Myers wrote:
>> On Fri, 2 May 2014, John Marino wrote:
>>
>>> 1) I don't know which type definitions are missing (iow, the important
>>> ones from sys/type.h that are required to build gcc)
>>
>> The default presumption should be:
>>
>> * <stddef.h> from GCC provides what it needs to provide; nothing extra is
>> needed and such a #include should not be needed at all.
>>
>> * Special measures to avoid duplicate typedefs (where some other header
>> also defines one of the typedefs defined in <stddef.h>) aren't in fact
>> needed, because GCC allows duplicate typedefs in system headers (even
>> outside C11 mode - in C11 mode it's a standard feature).
>>
>> So try removing that #include.  If that causes problems, investigate based
>> on the actual problems seen.
>
> Hi Joseph,
> Removing the include worked after also removing the #ifdef __DragonFly
> with regards to the rune_t type definition.
>
> I built gcc with a full bootstraps on both DragonFly platforms
> successfully.  stddef.h is much simpler now:
>
> --- gcc/ginclude/stddef.h.orig
> +++ gcc/ginclude/stddef.h
> @@ -133,6 +133,7 @@
>  #ifndef _BSD_PTRDIFF_T_
>  #ifndef ___int_ptrdiff_t_h
>  #ifndef _GCC_PTRDIFF_T
> +#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
>  #define _PTRDIFF_T
>  #define _T_PTRDIFF_
>  #define _T_PTRDIFF
> @@ -141,10 +142,12 @@
>  #define _BSD_PTRDIFF_T_
>  #define ___int_ptrdiff_t_h
>  #define _GCC_PTRDIFF_T
> +#define _PTRDIFF_T_DECLARED
>  #ifndef __PTRDIFF_TYPE__
>  #define __PTRDIFF_TYPE__ long int
>  #endif
>  typedef __PTRDIFF_TYPE__ ptrdiff_t;
> +#endif /* _PTRDIFF_T_DECLARED */
>  #endif /* _GCC_PTRDIFF_T */
>  #endif /* ___int_ptrdiff_t_h */
>  #endif /* _BSD_PTRDIFF_T_ */
> @@ -198,6 +201,7 @@
>  #define _GCC_SIZE_T
>  #define _SIZET_
>  #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
> +  || defined(__DragonFly__) \
>    || defined(__FreeBSD_kernel__)
>  /* __size_t is a typedef on FreeBSD 5, must not trash it. */
>  #elif defined (__VMS__)
>
>
> revised patchset  :
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/patches/patch-dragonfly-target
> revised changelog :
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/gcc_ChangeLog_entry.txt
> revised commit msg:
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/proposed_commit-msg.txt
>
> Good catch!  Does the rest of the patch set look good to you?  I think
> all the non-obvious patches have been reviewed collectively by various
> people now and may be ready to be approved now.

Ian's approved the libiberty.h change, Joseph's approved the stddef.h
change, I've approved the libstdc++ parts.

IIUC it still needs explicit approval for the rest, e.g. trivial
adjustments to configuration stuff in libitm and libcilkrts. Are there
specific maintainers for those libs?

The rest look obvious to me, it doesn't touch other targets at all
except for one bit that replaces a check for __FreeBSD__ >= 7 with a
grep for the dl_iterate_phdr function in a system header, which only
affects FreeBSD and looks OK to me.

Anyone willing to give it an overall approval?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-08 13:15             ` Jonathan Wakely
@ 2014-05-08 13:32               ` Jeff Law
  2014-05-08 13:36                 ` John Marino
  0 siblings, 1 reply; 25+ messages in thread
From: Jeff Law @ 2014-05-08 13:32 UTC (permalink / raw)
  To: Jonathan Wakely, John Marino
  Cc: Joseph S. Myers, gcc-patches, Gerald Pfeifer,
	manu at gcc dot gnu.org, Eric Botcazou (gnu.org)

On 05/08/14 07:14, Jonathan Wakely wrote:
>
> Ian's approved the libiberty.h change, Joseph's approved the stddef.h
> change, I've approved the libstdc++ parts.
>
> IIUC it still needs explicit approval for the rest, e.g. trivial
> adjustments to configuration stuff in libitm and libcilkrts. Are there
> specific maintainers for those libs?
>
> The rest look obvious to me, it doesn't touch other targets at all
> except for one bit that replaces a check for __FreeBSD__ >= 7 with a
> grep for the dl_iterate_phdr function in a system header, which only
> affects FreeBSD and looks OK to me.
>
> Anyone willing to give it an overall approval?
I'll take a look at the rest.  I mostly wanted someone else to deal with 
stddef.h :-)

jeff

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-08 13:32               ` Jeff Law
@ 2014-05-08 13:36                 ` John Marino
  0 siblings, 0 replies; 25+ messages in thread
From: John Marino @ 2014-05-08 13:36 UTC (permalink / raw)
  To: Jeff Law, Jonathan Wakely
  Cc: Joseph S. Myers, gcc-patches, Gerald Pfeifer,
	manu at gcc dot gnu.org, Eric Botcazou (gnu.org)

On 5/8/2014 15:32, Jeff Law wrote:
> On 05/08/14 07:14, Jonathan Wakely wrote:
>>
>> Anyone willing to give it an overall approval?
> I'll take a look at the rest.  I mostly wanted someone else to deal with
> stddef.h :-)


Thanks Jeff!
I'm am very appreciative of that.
John

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-03  7:12           ` John Marino
  2014-05-08 13:15             ` Jonathan Wakely
@ 2014-05-09  5:27             ` Jeff Law
  2014-05-09  7:15               ` John Marino
  1 sibling, 1 reply; 25+ messages in thread
From: Jeff Law @ 2014-05-09  5:27 UTC (permalink / raw)
  To: John Marino, Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 05/03/14 01:11, John Marino wrote:

>
>
> revised patchset  :
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/patches/patch-dragonfly-target
> revised changelog :
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/gcc_ChangeLog_entry.txt
> revised commit msg:
> http://leaf.dragonflybsd.org/~marino/gcc-df-target/proposed_commit-msg.txt
>
> Good catch!  Does the rest of the patch set look good to you?  I think
> all the non-obvious patches have been reviewed collectively by various
> people now and may be ready to be approved now.

In config.gcc:

+    no | gnat | single)
+      # Let these non-posix thread selections fall through if requested
Support for "gnat" as a thread model was removed in 2011.  So I think 
you need to remove that case.

configure.ac:

+  *-*-dragonfly* | *-*-freebsd*)
+    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > 
/dev/null 2>&1; then
+      gcc_cv_target_dl_iterate_phdr=yes
+    else
+      gcc_cv_target_dl_iterate_phdr=no
+    fi
+    ;;
Presumably you intended to change freebsd* here.  Just want a 
confirmation.  I haven't worked on the *bsd platforms in about 20 years, 
so I have no idea if this is right for them in general.

I see you have a dragonfly-stdint.h.  Is there a particular reason why 
you can't use the freebsd-stdint.h?  I didn't check every type, but a 
quick glance makes me think they ought to be equivalent.

Similarly for dragonfly.opt.

It looks like there's a fair amount of duplication in config/dragonfly.h 
and config/i386/dragonfly but I don't see an easy way to fix that.  So, 
I'll let that go.


I'm going to trust the unwind code works and isn't duplicating something 
from somewhere else that ought to instead be shared.


So it basically looks good.  Can you fix the config.gcc nit and 
determine if we can (and should) share files with freebsd.  Repost after 
those fixes and we should be ready to go.

And one final thing, do you have a copyright assignment on file with the 
FSF?

jeff

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-09  5:27             ` Jeff Law
@ 2014-05-09  7:15               ` John Marino
  2014-05-12 16:59                 ` Jeff Law
  0 siblings, 1 reply; 25+ messages in thread
From: John Marino @ 2014-05-09  7:15 UTC (permalink / raw)
  To: Jeff Law, Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 5/9/2014 07:26, Jeff Law wrote:
> On 05/03/14 01:11, John Marino wrote:
> 
> In config.gcc:
> 
> +    no | gnat | single)
> +      # Let these non-posix thread selections fall through if requested
> Support for "gnat" as a thread model was removed in 2011.  So I think
> you need to remove that case.

I realized that the gnat thread mechanism had been removed a couple of
days ago, but I didn't want to invalidate the ongoing review since it
was a not really an issue.  I'll make the change now.  This hunk was
obviously created when it did exist.

> configure.ac:
> 
> +  *-*-dragonfly* | *-*-freebsd*)
> +    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h >
> /dev/null 2>&1; then
> +      gcc_cv_target_dl_iterate_phdr=yes
> +    else
> +      gcc_cv_target_dl_iterate_phdr=no
> +    fi
> +    ;;
> Presumably you intended to change freebsd* here.  Just want a
> confirmation.  I haven't worked on the *bsd platforms in about 20 years,
> so I have no idea if this is right for them in general.


Yes, this is intentional.  This is why I also did a full testsuite on
FreeBSD as well as DragonFly to prove that still worked.

NetBSD and OpenBSD would be handled similarly when the time comes, but
they would need to grep a different header.


> I see you have a dragonfly-stdint.h.  Is there a particular reason why
> you can't use the freebsd-stdint.h?  I didn't check every type, but a
> quick glance makes me think they ought to be equivalent.
> 
> Similarly for dragonfly.opt.

And there is already precedent for each system to have its own files:

freebsd.opt  freebsd-stdint.h
openbsd.opt  openbsd-stdint.h
netbsd.opt   (

The dragonfly-stdint.h is cleaner than freebsd-stdint.h as well.

> It looks like there's a fair amount of duplication in config/dragonfly.h
> and config/i386/dragonfly but I don't see an easy way to fix that.  So,
> I'll let that go.

While similar due to heritage, and also due to a conscious effort to
keep the userland compatible where a difference isn't specifically
needed, DragonFly is not FreeBSD.  We've had a challenge with software
that consider them to be equivalent in every aspect.

Sometimes changes are made against a FreeBSD file that is not valid for
DragonFly, so even if they are equivalent today they may not be in the
future.  We prefer separate configuration files like NetBSD and OpenBSD
have in general.

by the way config/dragonfly.h and config/i386/dragonfly.h are
significantly different that FreeBSD counterparts.  And we eliminated
the equivalent of config/i386/freebsd64.h by combining it's
functionality into config/i386/dragonfly.h.  There are also
platform-specific differences there so there is no question that
DragonFly needs its own header files.

> I'm going to trust the unwind code works and isn't duplicating something
> from somewhere else that ought to instead be shared.

Not only is it not duplicated, FreeBSD needs its own, different version
(FreeBSD is currently missing unwind functionality).  I have the patch
and that's a separate submission (out of scope for DragonFly target
creation).  Believe me, if there is one thing you would not want to
duplicate, it's MD support code.  FYI NetBSD and OpenBSD are missing
this functionality too.


> So it basically looks good.  Can you fix the config.gcc nit and
> determine if we can (and should) share files with freebsd.  Repost after
> those fixes and we should be ready to go.

1) Patch updated online as requested
2) At this exact point in time, we probably can share the files
3) I might debate that we should share the files - that would imply
reviewing the existing counterpart files for NetBSD and OpenBSD and
combining when equivalent.

> And one final thing, do you have a copyright assignment on file with the
> FSF?


Yes, since 2011.  I mentioned that in the very first post of the thread
along with the associated assignment number.

> jeff


Thank you very much for the overarching review Jeff!
John

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-09  7:15               ` John Marino
@ 2014-05-12 16:59                 ` Jeff Law
  2014-05-12 17:10                   ` John Marino
  0 siblings, 1 reply; 25+ messages in thread
From: Jeff Law @ 2014-05-12 16:59 UTC (permalink / raw)
  To: John Marino, Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 05/09/14 01:14, John Marino wrote:
> On 5/9/2014 07:26, Jeff Law wrote:
>> On 05/03/14 01:11, John Marino wrote:
>>
>> In config.gcc:
>>
>> +    no | gnat | single)
>> +      # Let these non-posix thread selections fall through if requested
>> Support for "gnat" as a thread model was removed in 2011.  So I think
>> you need to remove that case.
>
> I realized that the gnat thread mechanism had been removed a couple of
> days ago, but I didn't want to invalidate the ongoing review since it
> was a not really an issue.  I'll make the change now.  This hunk was
> obviously created when it did exist.
No problem.

>
>> configure.ac:
>>
>> +  *-*-dragonfly* | *-*-freebsd*)
>> +    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h >
>> /dev/null 2>&1; then
>> +      gcc_cv_target_dl_iterate_phdr=yes
>> +    else
>> +      gcc_cv_target_dl_iterate_phdr=no
>> +    fi
>> +    ;;
>> Presumably you intended to change freebsd* here.  Just want a
>> confirmation.  I haven't worked on the *bsd platforms in about 20 years,
>> so I have no idea if this is right for them in general.
>
>
> Yes, this is intentional.  This is why I also did a full testsuite on
> FreeBSD as well as DragonFly to prove that still worked.
OK.  Just wanted to be sure.  As I mentioned, it's been a *long* time 
since I did anything with the *bsd ports.


>
> NetBSD and OpenBSD would be handled similarly when the time comes, but
> they would need to grep a different header.
>
>
>> I see you have a dragonfly-stdint.h.  Is there a particular reason why
>> you can't use the freebsd-stdint.h?  I didn't check every type, but a
>> quick glance makes me think they ought to be equivalent.
>>
>> Similarly for dragonfly.opt.
>
> And there is already precedent for each system to have its own files:
>
> freebsd.opt  freebsd-stdint.h
> openbsd.opt  openbsd-stdint.h
> netbsd.opt   (
>
> The dragonfly-stdint.h is cleaner than freebsd-stdint.h as well.
Yea, there's always a bit of a natural tension between having this kind 
of stuff duplicated vs sharing when their contents are common.  I lean 
towards the latter in this case for a variety of reasons.

>
> While similar due to heritage, and also due to a conscious effort to
> keep the userland compatible where a difference isn't specifically
> needed, DragonFly is not FreeBSD.  We've had a challenge with software
> that consider them to be equivalent in every aspect.
I certainly understand having done similar stuff in the past.

>
> Sometimes changes are made against a FreeBSD file that is not valid for
> DragonFly, so even if they are equivalent today they may not be in the
> future.  We prefer separate configuration files like NetBSD and OpenBSD
> have in general.
Right and this is the most important counter-argument to sharing. 
They're compatible today, but will they be tomorrow?  It sounds like 
Dragonfly has a bit of a mandate to be different than FreeBSD, so 
there's probably more than the usual chance this stuff could diverge in 
the future.

>
> by the way config/dragonfly.h and config/i386/dragonfly.h are
> significantly different that FreeBSD counterparts.  And we eliminated
> the equivalent of config/i386/freebsd64.h by combining it's
> functionality into config/i386/dragonfly.h.  There are also
> platform-specific differences there so there is no question that
> DragonFly needs its own header files.
I saw that when scanning dragfonfly.h and freebsd.h to see how much 
commonality there was between them.

>
>> I'm going to trust the unwind code works and isn't duplicating something
>> from somewhere else that ought to instead be shared.
>
> Not only is it not duplicated, FreeBSD needs its own, different version
> (FreeBSD is currently missing unwind functionality).  I have the patch
> and that's a separate submission (out of scope for DragonFly target
> creation).  Believe me, if there is one thing you would not want to
> duplicate, it's MD support code.  FYI NetBSD and OpenBSD are missing
> this functionality too.
>
>
>> So it basically looks good.  Can you fix the config.gcc nit and
>> determine if we can (and should) share files with freebsd.  Repost after
>> those fixes and we should be ready to go.
>
> 1) Patch updated online as requested
> 2) At this exact point in time, we probably can share the files
> 3) I might debate that we should share the files - that would imply
> reviewing the existing counterpart files for NetBSD and OpenBSD and
> combining when equivalent.
Let's go ahead and keep the files separate.  We can always go back and 
combine them at a later date if we see the need.

So with that in mind, the patch is good to go with the gnat thread stuff 
removed.

Do you have write access, or do you you need someone to commit the 
change for you?

Jeff

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-12 16:59                 ` Jeff Law
@ 2014-05-12 17:10                   ` John Marino
  2014-05-12 17:14                     ` Jeff Law
  2014-05-21 11:43                     ` Jonathan Wakely
  0 siblings, 2 replies; 25+ messages in thread
From: John Marino @ 2014-05-12 17:10 UTC (permalink / raw)
  To: Jeff Law, Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 5/12/2014 18:59, Jeff Law wrote:
> On 05/09/14 01:14, John Marino wrote:
>>
>> 1) Patch updated online as requested
>> 2) At this exact point in time, we probably can share the files
>> 3) I might debate that we should share the files - that would imply
>> reviewing the existing counterpart files for NetBSD and OpenBSD and
>> combining when equivalent.
> Let's go ahead and keep the files separate.  We can always go back and
> combine them at a later date if we see the need.
> 
> So with that in mind, the patch is good to go with the gnat thread stuff
> removed.
> 
> Do you have write access, or do you you need someone to commit the
> change for you?

Thanks, Jeff!
I do not have write access, but jwakely has graciously offered to commit
this patchset when it achieves approval, so I guess he's on deck!

John

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-12 17:10                   ` John Marino
@ 2014-05-12 17:14                     ` Jeff Law
  2014-05-13 14:10                       ` Jonathan Wakely
  2014-05-21 11:43                     ` Jonathan Wakely
  1 sibling, 1 reply; 25+ messages in thread
From: Jeff Law @ 2014-05-12 17:14 UTC (permalink / raw)
  To: John Marino, Joseph S. Myers
  Cc: gcc-patches, Jonathan Wakely, Gerald Pfeifer, manu,
	Eric Botcazou (gnu.org)

On 05/12/14 11:10, John Marino wrote:
> On 5/12/2014 18:59, Jeff Law wrote:
>> On 05/09/14 01:14, John Marino wrote:
>>>
>>> 1) Patch updated online as requested
>>> 2) At this exact point in time, we probably can share the files
>>> 3) I might debate that we should share the files - that would imply
>>> reviewing the existing counterpart files for NetBSD and OpenBSD and
>>> combining when equivalent.
>> Let's go ahead and keep the files separate.  We can always go back and
>> combine them at a later date if we see the need.
>>
>> So with that in mind, the patch is good to go with the gnat thread stuff
>> removed.
>>
>> Do you have write access, or do you you need someone to commit the
>> change for you?
>
> Thanks, Jeff!
> I do not have write access, but jwakely has graciously offered to commit
> this patchset when it achieves approval, so I guess he's on deck!
OK.  It's Jon's :-)

Jeff

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-12 17:14                     ` Jeff Law
@ 2014-05-13 14:10                       ` Jonathan Wakely
  0 siblings, 0 replies; 25+ messages in thread
From: Jonathan Wakely @ 2014-05-13 14:10 UTC (permalink / raw)
  To: Jeff Law
  Cc: John Marino, Joseph S. Myers, gcc-patches, Gerald Pfeifer,
	manu at gcc dot gnu.org, Eric Botcazou (gnu.org)

On 12 May 2014 18:14, Jeff Law wrote:
> On 05/12/14 11:10, John Marino wrote:
>>
>> On 5/12/2014 18:59, Jeff Law wrote:
>>>
>>> On 05/09/14 01:14, John Marino wrote:
>>>>
>>>>
>>>> 1) Patch updated online as requested
>>>> 2) At this exact point in time, we probably can share the files
>>>> 3) I might debate that we should share the files - that would imply
>>>> reviewing the existing counterpart files for NetBSD and OpenBSD and
>>>> combining when equivalent.
>>>
>>> Let's go ahead and keep the files separate.  We can always go back and
>>> combine them at a later date if we see the need.
>>>
>>> So with that in mind, the patch is good to go with the gnat thread stuff
>>> removed.
>>>
>>> Do you have write access, or do you you need someone to commit the
>>> change for you?
>>
>>
>> Thanks, Jeff!
>> I do not have write access, but jwakely has graciously offered to commit
>> this patchset when it achieves approval, so I guess he's on deck!
>
> OK.  It's Jon's :-)

Great, I'll coordinate with John and aim to get it committed before Friday.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly
  2014-05-12 17:10                   ` John Marino
  2014-05-12 17:14                     ` Jeff Law
@ 2014-05-21 11:43                     ` Jonathan Wakely
  2015-04-09 20:12                       ` [doc] Add John Marino to doc/contrib.texi (was: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly) Gerald Pfeifer
  1 sibling, 1 reply; 25+ messages in thread
From: Jonathan Wakely @ 2014-05-21 11:43 UTC (permalink / raw)
  To: John Marino
  Cc: Jeff Law, Joseph S. Myers, gcc-patches, Gerald Pfeifer,
	manu at gcc dot gnu.org, Eric Botcazou (gnu.org)

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

On 12 May 2014 18:10, John Marino wrote:
> On 5/12/2014 18:59, Jeff Law wrote:
>> On 05/09/14 01:14, John Marino wrote:
>>>
>>> 1) Patch updated online as requested
>>> 2) At this exact point in time, we probably can share the files
>>> 3) I might debate that we should share the files - that would imply
>>> reviewing the existing counterpart files for NetBSD and OpenBSD and
>>> combining when equivalent.
>> Let's go ahead and keep the files separate.  We can always go back and
>> combine them at a later date if we see the need.
>>
>> So with that in mind, the patch is good to go with the gnat thread stuff
>> removed.
>>
>> Do you have write access, or do you you need someone to commit the
>> change for you?
>
> Thanks, Jeff!
> I do not have write access, but jwakely has graciously offered to commit
> this patchset when it achieves approval, so I guess he's on deck!

Bootstrapped on x86_64-unknown-dragonfly3.6 and
x86_64-unknown-linux-gnu, committed to trunk as
http://gcc.gnu.org/r210694

John, thanks for contributing the target support and for persevering
with the review process :-)

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 56942 bytes --]

commit 90c9c737be72d028ac249c80505dcb2c5d147de9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue May 20 16:49:28 2014 +0100

    2014-05-21  John Marino  <gnugcc@marino.st>
    
    gcc:
    
    	* config.gcc (*-*-dragonfly*): New target.
    	* configure.ac: Detect dl_iterate_phdr (*freebsd*, *dragonfly*).
    	* configure: Regenerate.
    	* config/dragonfly-stdint.h: New.
    	* config/dragonfly.h: New.
    	* config/dragonfly.opt: New.
    	* config/i386/dragonfly.h: New.
    	* ginclude/stddef.h: Detect _PTRDIFF_T_DECLARED for DragonFly.
    
    include:
    
    	* liberty.h: Use basename function on DragonFly.
    
    libcilkrts:
    
    	* runtime/os-unix.c (__DragonFly__): New target.
    
    libgcc:
    
    	* config.host (*-*-dragonfly*): New target.
    	* crtstuff.c: Make dl_iterate_support generic on *bsd.
    	* enable-execute-stack-mprotect.c: Always mprotect on FreeBSD.
    	* unwind-dw2-fde-dip.c: Add dl_iterate_phr support for DragonFly.
    	* config/i386/dragonfly-unwind.h: New.
    
    libitm:
    
    	* configure.tgt (*-*-dragonfly*): New target.
    
    libstdc++-v3:
    
    	* acinclude.m4 (*-*-dragonfly*): New target.
    	* configure: Regenerate.
    	* configure.host (*-*-dragonfly*): New target.
    	* config/locale/dragonfly/c_locale.cc: New.
    	* config/locale/dragonfly/ctype_members.cc: New.
    	* config/os/bsd/dragonfly/ctype_base.h: New.
    	* config/os/bsd/dragonfly/ctype_configure_char.cc: New.
    	* config/os/bsd/dragonfly/ctype_inline.h: New.
    	* config/os/bsd/dragonfly/os_defines.h: New.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index de010da..bf05385 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -621,6 +621,26 @@ case ${target} in
     "" | yes | posix) thread_file='posix' ;;
   esac
   ;;
+*-*-dragonfly*)
+  gas=yes
+  gnu_ld=yes
+  tmake_file="t-slibgcc"
+  case ${enable_threads} in
+    "" | yes | posix)
+      thread_file='posix'
+      ;;
+    no | single)
+      # Let these non-posix thread selections fall through if requested
+      ;;
+    *)
+      echo 'Unknown thread configuration for DragonFly BSD'
+      exit 1
+      ;;
+  esac
+  extra_options="$extra_options rpath.opt dragonfly.opt"
+  default_use_cxa_atexit=yes
+  use_gcc_stdint=wrap
+  ;;
 *-*-freebsd*)
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
@@ -1321,6 +1341,14 @@ x86_64-*-rdos*)
     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
     tmake_file="i386/t-i386elf t-svr4"
     ;;
+i[34567]86-*-dragonfly*)
+	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
+	tmake_file="${tmake_file} i386/t-crtstuff"
+	;;
+x86_64-*-dragonfly*)
+	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"
+	tmake_file="${tmake_file} i386/t-crtstuff"
+	;;
 i[34567]86-*-freebsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
 	;;
@@ -4060,6 +4088,8 @@ case ${target} in
 		;;
 	i[34567]86-*-mingw* | x86_64-*-mingw*)
 		;;
+	i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
+		;;
 	i[34567]86-*-freebsd* | x86_64-*-freebsd*)
 		;;
 	ia64*-*-linux*)
diff --git a/gcc/config/dragonfly-stdint.h b/gcc/config/dragonfly-stdint.h
new file mode 100644
index 0000000..f0bb30f
--- /dev/null
+++ b/gcc/config/dragonfly-stdint.h
@@ -0,0 +1,56 @@
+/* Definitions for <stdint.h> types for DragonFly systems.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#define SIG_ATOMIC_TYPE   "int"
+
+#define INT8_TYPE         "signed char"
+#define INT16_TYPE        "short int"
+#define INT32_TYPE        "int"
+#define INT64_TYPE        (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
+#define UINT8_TYPE        "unsigned char"
+#define UINT16_TYPE       "short unsigned int"
+#define UINT32_TYPE       "unsigned int"
+#define UINT64_TYPE       (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
+
+#define INT_LEAST8_TYPE   INT8_TYPE
+#define INT_LEAST16_TYPE  INT16_TYPE
+#define INT_LEAST32_TYPE  INT32_TYPE
+#define INT_LEAST64_TYPE  INT64_TYPE
+#define UINT_LEAST8_TYPE  UINT8_TYPE
+#define UINT_LEAST16_TYPE UINT16_TYPE
+#define UINT_LEAST32_TYPE UINT32_TYPE
+#define UINT_LEAST64_TYPE UINT64_TYPE
+
+#define INT_FAST8_TYPE    INT32_TYPE
+#define INT_FAST16_TYPE   INT32_TYPE
+#define INT_FAST32_TYPE   INT32_TYPE
+#define INT_FAST64_TYPE   INT64_TYPE
+#define UINT_FAST8_TYPE   UINT32_TYPE
+#define UINT_FAST16_TYPE  UINT32_TYPE
+#define UINT_FAST32_TYPE  UINT32_TYPE
+#define UINT_FAST64_TYPE  UINT64_TYPE
+
+#define INTPTR_TYPE       (LONG_TYPE_SIZE == 64 ?  INT64_TYPE :  INT32_TYPE)
+#define UINTPTR_TYPE      (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
diff --git a/gcc/config/dragonfly.h b/gcc/config/dragonfly.h
new file mode 100644
index 0000000..115c25d
--- /dev/null
+++ b/gcc/config/dragonfly.h
@@ -0,0 +1,129 @@
+/* Base configuration file for all DragonFly targets.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#undef  TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()            \
+  do                                        \
+    {                                       \
+       builtin_define_std ("unix");         \
+       builtin_define ("__DragonFly__");    \
+       builtin_assert ("system=unix");      \
+       builtin_assert ("system=bsd");       \
+       builtin_assert ("system=DragonFly"); \
+    }                                       \
+  while (0)
+
+#undef  CPP_SPEC
+#define CPP_SPEC \
+ "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}"
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC	\
+  "%{!shared: \
+     %{pg:gcrt1.o%s} \
+     %{!pg: \
+       %{p:gcrt1.o%s} \
+       %{!p: \
+         %{profile: gcrt1.o%s} \
+         %{!profile: \
+           %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
+   crti.o%s \
+   %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
+#undef  LIB_SPEC
+#define LIB_SPEC \
+  "%{pthread:-lpthread} -lc"
+
+#if defined(HAVE_LD_EH_FRAME_HDR)
+#define LINK_EH_SPEC "--eh-frame-hdr"
+#endif
+
+/* Provide a LINK_SPEC appropriate for DragonFly.  Here we provide support
+   for the special GCC options -static and -shared, which allow us to
+   link things in one of these three modes by applying the appropriate
+   combinations of options at link-time.
+
+   When the -shared link option is used a final link is not being
+   done.  */
+
+#define DFBSD_LINK_SPEC \
+ "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+  %{v:-V} \
+  %{assert*} %{R*} %{rpath*} %{defsym*} \
+  %{shared:-Bshareable %{h*} %{soname*}} \
+  %{!shared: \
+   %{!static: \
+    %{rdynamic:-export-dynamic} \
+    -dynamic-linker %(dfbsd_dynamic_linker) \
+   } \
+   %{static:-Bstatic} \
+  } \
+  %{!static:--hash-style=gnu} \
+  %{symbolic:-Bsymbolic}"
+
+#undef  LINK_SPEC
+#define LINK_SPEC DFBSD_LINK_SPEC
+
+#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
+
+
+/* Use --as-needed -lgcc_s for eh support.  */
+#ifdef HAVE_LD_AS_NEEDED
+#define USE_LD_AS_NEEDED 1
+#endif
+
+/************************[  Target stuff  ]***********************************/
+
+/* All DragonFly Architectures support the ELF object file format.  */
+#undef  OBJECT_FORMAT_ELF
+#define OBJECT_FORMAT_ELF
+
+/* Don't assume anything about the header files.  */
+#undef  NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C	1
+
+/* Follow DragonFly's standard headers (<machine/stdint.h>, etc...).  */
+
+#undef  WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef  WINT_TYPE
+#define WINT_TYPE "int"
+
+/* Code generation parameters.  */
+
+/* Use periods rather than dollar signs in special g++ assembler names.
+   This ensures the configuration knows our system correctly so we can link
+   with libraries compiled with the native cc.  */
+#undef NO_DOLLAR_IN_LABEL
+
+/* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
+   This enables the test coverage code to use file locking when exiting a
+   program, which avoids race conditions if the program has forked.  */
+#define TARGET_POSIX_IO
diff --git a/gcc/config/dragonfly.opt b/gcc/config/dragonfly.opt
new file mode 100644
index 0000000..c87828d
--- /dev/null
+++ b/gcc/config/dragonfly.opt
@@ -0,0 +1,64 @@
+; DragonFly BSD options.
+
+; Copyright (C) 2014 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+
+; See the GCC internals manual (options.texi) for a description of this file's format.
+
+; Please try to keep this file in ASCII collating order.
+
+assert
+Driver Separate
+
+assert=
+Driver JoinedOrMissing
+
+defsym
+Driver Separate
+
+defsym=
+Driver JoinedOrMissing
+
+posix
+Driver
+
+profile
+Driver
+
+pthread
+Driver
+
+rdynamic
+Driver
+
+rpath-link
+Driver Separate
+
+rpath-link=
+Driver JoinedOrMissing
+
+rpath=
+Driver JoinedOrMissing
+
+soname
+Driver Separate
+
+soname=
+Driver JoinedOrMissing
+
+; This comment is to ensure we retain the blank line above.
diff --git a/gcc/config/i386/dragonfly.h b/gcc/config/i386/dragonfly.h
new file mode 100644
index 0000000..71362d5
--- /dev/null
+++ b/gcc/config/i386/dragonfly.h
@@ -0,0 +1,104 @@
+/* Definitions for Intel 386 running DragonFly with ELF format
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+
+/* Override the default comment-starter of "/".  */
+#undef  ASM_COMMENT_START
+#define ASM_COMMENT_START "#"
+
+#undef  ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef  ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#undef  DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) \
+  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
+
+#undef  NO_PROFILE_COUNTERS
+#define NO_PROFILE_COUNTERS	1
+
+/* Tell final.c that we don't need a label passed to mcount.  */
+
+#undef  MCOUNT_NAME
+#define MCOUNT_NAME ".mcount"
+
+/* Make gcc agree with <machine/ansi.h>.  */
+
+#undef  SIZE_TYPE
+#define SIZE_TYPE	(TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+#undef  PTRDIFF_TYPE
+#define PTRDIFF_TYPE	(TARGET_64BIT ? "long int" : "int")
+
+#undef  WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE	(TARGET_64BIT ? 32 : BITS_PER_WORD)
+
+#undef  SUBTARGET_EXTRA_SPECS	/* i386.h bogusly defines it.  */
+#define SUBTARGET_EXTRA_SPECS \
+  { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
+
+/* A C statement to output to the stdio stream FILE an assembler
+   command to advance the location counter to a multiple of 1<<LOG
+   bytes if it is within MAX_SKIP bytes.
+
+   This is used to align code labels according to Intel recommendations.  */
+
+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+#undef  ASM_OUTPUT_MAX_SKIP_ALIGN
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)					\
+  if ((LOG) != 0) {														\
+    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
+    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
+  }
+#endif
+
+/* Don't default to pcc-struct-return, we want to retain compatibility with
+   older gcc versions AND pcc-struct-return is nonreentrant.
+   (even though the SVR4 ABI for the i386 says that records and unions are
+   returned in memory).  */
+
+#undef  DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* DragonFly sets the rounding precision of the FPU to 53 bits.  Let the
+   compiler get the contents of <float.h> and std::numeric_limits correct.  */
+#undef TARGET_96_ROUND_53_LONG_DOUBLE
+#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
+
+/* Put all *tf routines in libgcc.  */
+#undef LIBGCC2_HAS_TF_MODE
+#define LIBGCC2_HAS_TF_MODE 1
+#define LIBGCC2_TF_CEXT q
+#define TF_SIZE 113
+
+/* Static stack checking is supported by means of probes.  */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* Support for i386 was removed from DragonFly in 2007  */
+#define SUBTARGET32_DEFAULT_CPU "i486"
+
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
diff --git a/gcc/configure.ac b/gcc/configure.ac
index a339a0f..281ce8e 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5019,6 +5019,13 @@ case "$target" in
       gcc_cv_target_dl_iterate_phdr=no
     fi
     ;;
+  *-*-dragonfly* | *-*-freebsd*)
+    if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
+      gcc_cv_target_dl_iterate_phdr=yes
+    else
+      gcc_cv_target_dl_iterate_phdr=no
+    fi
+    ;;
 esac
 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index cfa8df3..62e893a 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -133,6 +133,7 @@ _TYPE_wchar_t;
 #ifndef _BSD_PTRDIFF_T_
 #ifndef ___int_ptrdiff_t_h
 #ifndef _GCC_PTRDIFF_T
+#ifndef _PTRDIFF_T_DECLARED /* DragonFly */
 #define _PTRDIFF_T
 #define _T_PTRDIFF_
 #define _T_PTRDIFF
@@ -141,10 +142,12 @@ _TYPE_wchar_t;
 #define _BSD_PTRDIFF_T_
 #define ___int_ptrdiff_t_h
 #define _GCC_PTRDIFF_T
+#define _PTRDIFF_T_DECLARED
 #ifndef __PTRDIFF_TYPE__
 #define __PTRDIFF_TYPE__ long int
 #endif
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#endif /* _PTRDIFF_T_DECLARED */
 #endif /* _GCC_PTRDIFF_T */
 #endif /* ___int_ptrdiff_t_h */
 #endif /* _BSD_PTRDIFF_T_ */
@@ -198,6 +201,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 #define _GCC_SIZE_T
 #define _SIZET_
 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+  || defined(__DragonFly__) \
   || defined(__FreeBSD_kernel__)
 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
 #elif defined (__VMS__)
diff --git a/include/libiberty.h b/include/libiberty.h
index 78c42eb..7fd0703 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -106,7 +106,10 @@ extern int countargv (char**);
    to find the declaration so provide a fully prototyped one.  If it
    is 1, we found it so don't provide any declaration at all.  */
 #if !HAVE_DECL_BASENAME
-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
+ || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
+ || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
+ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) 
 extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
 #else
 /* Do not allow basename to be used if there is no prototype seen.  We
diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
index c9ddbbc..cb582dd 100644
--- a/libcilkrts/runtime/os-unix.c
+++ b/libcilkrts/runtime/os-unix.c
@@ -54,6 +54,8 @@
 #elif defined __APPLE__
 #   include <sys/sysctl.h>
     // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
+#elif defined  __DragonFly__
+// No additional include files
 #elif defined  __FreeBSD__
 // No additional include files
 #elif defined __CYGWIN__
@@ -374,7 +376,7 @@ COMMON_SYSDEP int __cilkrts_hardware_cpu_count(void)
     assert((unsigned)count == count);
 
     return count;
-#elif defined  __FreeBSD__ || defined __CYGWIN__
+#elif defined  __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__
     int ncores = sysconf(_SC_NPROCESSORS_ONLN);
 
     return ncores;
@@ -402,6 +404,9 @@ COMMON_SYSDEP void __cilkrts_yield(void)
     // On MacOS, call sched_yield to yield quantum.  I'm not sure why we
     // don't do this on Linux also.
     sched_yield();
+#elif defined(__DragonFly__)
+    // On DragonFly BSD, call sched_yield to yield quantum.
+    sched_yield();
 #elif defined(__MIC__)
     // On MIC, pthread_yield() really trashes things.  Arch's measurements
     // showed that calling _mm_delay_32() (or doing nothing) was a better
diff --git a/libgcc/config.host b/libgcc/config.host
index f4a7428..5f13a9f 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -207,6 +207,11 @@ case ${host} in
   tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin"
   extra_parts="crt3.o crttms.o crttme.o"
   ;;
+*-*-dragonfly*)
+  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
+  tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
+  extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
+  ;;
 *-*-freebsd*)
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
@@ -302,7 +307,8 @@ case ${host} in
 esac
 
 case ${host} in
-*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2*)
+*-*-darwin* | *-*-dragonfly* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | \
+  *-*-solaris2*)
   enable_execute_stack=enable-execute-stack-mprotect.c
   ;;
 i[34567]86-*-mingw* | x86_64-*-mingw*)
@@ -545,6 +551,14 @@ i[34567]86-*-elf*)
 x86_64-*-elf*)
 	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
 	;;
+i[34567]86-*-dragonfly*)
+	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
+	md_unwind_header=i386/dragonfly-unwind.h
+	;;
+x86_64-*-dragonfly*)
+	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
+	md_unwind_header=i386/dragonfly-unwind.h
+	;;
 i[34567]86-*-freebsd*)
 	tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
 	;;
@@ -1262,6 +1276,7 @@ i[34567]86-*-darwin* | x86_64-*-darwin* | \
   i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
   i[34567]86-*-cygwin* | x86_64-*-cygwin* | \
   i[34567]86-*-mingw* | x86_64-*-mingw* | \
+  i[34567]86-*-dragonfly* | x86_64-*-dragonfly* | \
   i[34567]86-*-freebsd* | x86_64-*-freebsd* | \
   i[34567]86-*-openbsd* | x86_64-*-openbsd*)
   	tmake_file="${tmake_file} t-softfp-tf"
diff --git a/libgcc/config/i386/dragonfly-unwind.h b/libgcc/config/i386/dragonfly-unwind.h
new file mode 100644
index 0000000..cfea5e3
--- /dev/null
+++ b/libgcc/config/i386/dragonfly-unwind.h
@@ -0,0 +1,180 @@
+/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by John Marino <gnugcc@marino.st>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* Do code reading to identify a signal frame, and set the frame
+   state data appropriately.  See unwind-dw2.c for the structs. */
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+#include <machine/sigframe.h>
+
+
+#define REG_NAME(reg)	sf_uc.uc_mcontext.mc_## reg
+
+#ifdef __x86_64__
+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
+
+
+static void
+x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 32;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_64_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(rsp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  /* Register 7 is rsp  */
+  fs->regs.cfa_reg = 7;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
+  fs->regs.reg[4].how = REG_SAVED_OFFSET;
+  fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
+  fs->regs.reg[9].how = REG_SAVED_OFFSET;
+  fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
+  fs->regs.reg[10].how = REG_SAVED_OFFSET;
+  fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
+  fs->regs.reg[11].how = REG_SAVED_OFFSET;
+  fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
+  fs->regs.reg[12].how = REG_SAVED_OFFSET;
+  fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
+  fs->regs.reg[13].how = REG_SAVED_OFFSET;
+  fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
+  fs->regs.reg[14].how = REG_SAVED_OFFSET;
+  fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
+  fs->regs.reg[15].how = REG_SAVED_OFFSET;
+  fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
+  fs->regs.reg[16].how = REG_SAVED_OFFSET;
+  fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
+  fs->retaddr_column = 16;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+
+#else /* Next section is for i386  */
+
+#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
+
+
+static void
+x86_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 128;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
+
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(esp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  fs->regs.cfa_reg = 4;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
+  fs->regs.reg[7].how = REG_SAVED_OFFSET;
+  fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
+  fs->retaddr_column = 8;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+#endif /* ifdef __x86_64__  */
diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
index 12bed4b..2c56af3 100644
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -79,11 +79,16 @@ call_ ## FUNC (void)					\
 }
 #endif
 
+#if defined(TARGET_DL_ITERATE_PHDR) && \
+   (defined(__DragonFly__) || defined(__FreeBSD__))
+#define BSD_DL_ITERATE_PHDR_AVAILABLE
+#endif
+ 
 #if defined(OBJECT_FORMAT_ELF) \
     && !defined(OBJECT_FORMAT_FLAT) \
     && defined(HAVE_LD_EH_FRAME_HDR) \
     && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
+    && defined(BSD_DL_ITERATE_PHDR_AVAILABLE)
 #include <link.h>
 # define USE_PT_GNU_EH_FRAME
 #endif
diff --git a/libgcc/enable-execute-stack-mprotect.c b/libgcc/enable-execute-stack-mprotect.c
index 096abea..e3fb3b6 100644
--- a/libgcc/enable-execute-stack-mprotect.c
+++ b/libgcc/enable-execute-stack-mprotect.c
@@ -33,20 +33,7 @@ static int need_enable_exec_stack;
 static void check_enabling (void) __attribute__ ((unused));
 extern void __enable_execute_stack (void *);
 
-#if defined __FreeBSD__
-#include <sys/sysctl.h>
-
-static void __attribute__ ((constructor))
-check_enabling (void)
-{
-  int prot = 0;
-  size_t len = sizeof (prot);
-
-  sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0);
-  if (prot != STACK_PROT_RWX)
-    need_enable_exec_stack = 1;
-}
-#elif defined __sun__ && defined __svr4__
+#if defined __sun__ && defined __svr4__
 static void __attribute__ ((constructor))
 check_enabling (void)
 {
diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
index d6c0521..b7b9f91 100644
--- a/libgcc/unwind-dw2-fde-dip.c
+++ b/libgcc/unwind-dw2-fde-dip.c
@@ -58,7 +58,8 @@
 #endif
 
 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
+    && defined(TARGET_DL_ITERATE_PHDR) \
+    && (defined(__DragonFly__) || defined(__FreeBSD__))
 # define ElfW __ElfN
 # define USE_PT_GNU_EH_FRAME
 #endif
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index 44c1a14..29b692f 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -141,7 +141,7 @@ case "${target}" in
   *-*-gnu* | *-*-k*bsd*-gnu \
   | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
   | *-*-solaris2* | *-*-sysv4* | *-*-hpux11* \
-  | *-*-darwin* | *-*-aix*)
+  | *-*-darwin* | *-*-aix* | *-*-dragonfly*)
 	# POSIX system.  The OS is supported.
 	;;
 
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 55427cd..69b165f 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1989,6 +1989,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
       darwin* | freebsd*)
 	enable_clocale_flag=darwin
 	;;
+      dragonfly*)
+	enable_clocale_flag=dragonfly
+	;;
       openbsd*)
 	enable_clocale_flag=newlib
 	;;
@@ -2081,6 +2084,23 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
       ;;
 
+    dragonfly)
+      AC_MSG_RESULT(dragonfly)
+
+      CLOCALE_H=config/locale/generic/c_locale.h
+      CLOCALE_CC=config/locale/dragonfly/c_locale.cc
+      CCODECVT_CC=config/locale/generic/codecvt_members.cc
+      CCOLLATE_CC=config/locale/generic/collate_members.cc
+      CCTYPE_CC=config/locale/dragonfly/ctype_members.cc
+      CMESSAGES_H=config/locale/generic/messages_members.h
+      CMESSAGES_CC=config/locale/generic/messages_members.cc
+      CMONEY_CC=config/locale/generic/monetary_members.cc
+      CNUMERIC_CC=config/locale/generic/numeric_members.cc
+      CTIME_H=config/locale/generic/time_members.h
+      CTIME_CC=config/locale/generic/time_members.cc
+      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
+      ;;
+
     gnu)
       AC_MSG_RESULT(gnu)
 
diff --git a/libstdc++-v3/config/locale/dragonfly/c_locale.cc b/libstdc++-v3/config/locale/dragonfly/c_locale.cc
new file mode 100644
index 0000000..6c503db
--- /dev/null
+++ b/libstdc++-v3/config/locale/dragonfly/c_locale.cc
@@ -0,0 +1,299 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.8  Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <cerrno>  // For errno
+#include <cmath>  // For isinf, finite, finitef, fabs
+#include <cstdlib>  // For strof, strtold
+#include <cstring>
+#include <cstdio>
+#include <locale>
+#include <limits>
+
+#ifdef _GLIBCXX_HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<>
+    void
+    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
+		   const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+      char* __sanity;
+      bool __overflow = false;
+
+#if !__FLT_HAS_INFINITY__
+      errno = 0;
+#endif
+
+#ifdef _GLIBCXX_HAVE_STRTOF
+      __v = strtof(__s, &__sanity);
+#else
+      double __d = strtod(__s, &__sanity);
+      __v = static_cast<float>(__d);
+#ifdef _GLIBCXX_HAVE_FINITEF
+      if (!finitef (__v))
+	__overflow = true;
+#elif defined (_GLIBCXX_HAVE_FINITE)
+      if (!finite (static_cast<double> (__v)))
+	__overflow = true;
+#elif defined (_GLIBCXX_HAVE_ISINF)
+      if (isinf (static_cast<double> (__v)))
+	__overflow = true;
+#else
+      if (fabs(__d) > numeric_limits<float>::max())
+	__overflow = true;
+#endif
+#endif // _GLIBCXX_HAVE_STRTOF
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+	{
+	  __v = 0.0f;
+	  __err = ios_base::failbit;
+	}
+      else if (__overflow
+#if __FLT_HAS_INFINITY__
+	       || __v == numeric_limits<float>::infinity()
+	       || __v == -numeric_limits<float>::infinity()
+#else
+	       || ((__v > 1.0f || __v < -1.0f) && errno == ERANGE)
+#endif
+	      )
+	{
+	  if (__v > 0.0f)
+	    __v = numeric_limits<float>::max();
+	  else
+	    __v = -numeric_limits<float>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+  template<>
+    void
+    __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
+		   const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+      char* __sanity;
+
+#if !__DBL_HAS_INFINITY__
+      errno = 0;
+#endif
+
+      __v = strtod(__s, &__sanity);
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+	{
+	  __v = 0.0;
+	  __err = ios_base::failbit;
+	}
+      else if (
+#if __DBL_HAS_INFINITY__
+	       __v == numeric_limits<double>::infinity()
+	       || __v == -numeric_limits<double>::infinity())
+#else
+	       (__v > 1.0 || __v < -1.0) && errno == ERANGE)
+#endif
+	{
+	  if (__v > 0.0)
+	    __v = numeric_limits<double>::max();
+	  else
+	    __v = -numeric_limits<double>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+  template<>
+    void
+    __convert_to_v(const char* __s, long double& __v,
+		   ios_base::iostate& __err, const __c_locale&) throw()
+    {
+      // Assumes __s formatted for "C" locale.
+      char* __old = setlocale(LC_ALL, 0);
+      const size_t __len = strlen(__old) + 1;
+      char* __sav = new char[__len];
+      memcpy(__sav, __old, __len);
+      setlocale(LC_ALL, "C");
+
+#if !__LDBL_HAS_INFINITY__
+      errno = 0;
+#endif
+
+#if defined(_GLIBCXX_HAVE_STRTOLD) && !defined(_GLIBCXX_HAVE_BROKEN_STRTOLD)
+      char* __sanity;
+      __v = strtold(__s, &__sanity);
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 23. Num_get overflow result.
+      if (__sanity == __s || *__sanity != '\0')
+#else
+      typedef char_traits<char>::int_type int_type;
+      int __p = sscanf(__s, "%Lf", &__v);
+
+      if (!__p || static_cast<int_type>(__p) == char_traits<char>::eof())
+#endif
+	{
+	  __v = 0.0l;
+	  __err = ios_base::failbit;
+	}
+       else if (
+#if __LDBL_HAS_INFINITY__
+		__v == numeric_limits<long double>::infinity()
+		|| __v == -numeric_limits<long double>::infinity())
+#else
+		(__v > 1.0l || __v < -1.0l) && errno == ERANGE)
+#endif
+	{
+	  if (__v > 0.0l)
+	    __v = numeric_limits<long double>::max();
+	  else
+	    __v = -numeric_limits<long double>::max();
+	  __err = ios_base::failbit;
+	}
+
+      setlocale(LC_ALL, __sav);
+      delete [] __sav;
+    }
+
+
+  /*  DragonFly's implementation of setlocale won't accept something like
+      "de_DE".  According to nls manpage, the expected format is:
+      language[_territory][.codeset][@modifier], but it seems that both
+      the _territory and .codeset components are required.
+      
+      As an attempt to correct for this, we'll tack on ".UTF-8" if 
+      a period is not detected in the locale string.  
+
+      There are no locales with modifiers on DragonFly so if found, they
+      will just be stripped off silently.  e.g "de_DE@euro" will be reduced
+      to "de_DE".  The UTF-8 default would be added after that.
+  */
+
+  void
+  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
+				    __c_locale)
+  {
+    const size_t size__s = (__s == NULL) ? 1 : strlen (__s);
+    const char UTF8[] = ".UTF-8";
+    char localspec[size__s + 6 + 1];
+    
+    if (__s == NULL) {
+       localspec[0] = NULL;
+    } else {
+       strcpy (localspec, __s);
+       char * pch = strchr (localspec, '@');
+       if (pch != NULL)
+          *pch = 0;
+
+       if (  (strchr (__s, '.') == NULL)
+          && (strcmp (__s, "C") != 0)
+          && (strcmp (__s, "POSIX") != 0))
+          strncat (localspec, UTF8, 6);
+    }
+
+    const char * result = std::setlocale(LC_ALL, localspec);
+    
+    if ((strcmp(result, "C") != 0) && (strcmp (result, localspec) != 0))
+      __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
+			    "name not valid"));
+    __cloc = 0;
+  }
+
+  void
+  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
+  { __cloc = 0; }
+
+  __c_locale
+  locale::facet::_S_clone_c_locale(__c_locale&) throw()
+  { return __c_locale(); }
+
+  __c_locale
+  locale::facet::_S_lc_ctype_c_locale(__c_locale, const char*)
+  { return __c_locale(); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
+    {
+      "LC_CTYPE",
+      "LC_NUMERIC",
+      "LC_TIME",
+      "LC_COLLATE",
+      "LC_MONETARY",
+      "LC_MESSAGES"
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  const char* const* const locale::_S_categories = __gnu_cxx::category_names;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+// XXX GLIBCXX_ABI Deprecated
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
+  extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
+_GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKPi, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKPi);
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
diff --git a/libstdc++-v3/config/locale/dragonfly/ctype_members.cc b/libstdc++-v3/config/locale/dragonfly/ctype_members.cc
new file mode 100644
index 0000000..4fe58fb
--- /dev/null
+++ b/libstdc++-v3/config/locale/dragonfly/ctype_members.cc
@@ -0,0 +1,173 @@
+// std::ctype implementation details, GNU version -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+#include <bits/c++locale_internal.h>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  // NB: The other ctype<char> specializations are in src/locale.cc and
+  // various /config/os/* files.
+
+  ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+  : ctype<char>(0, false, __refs) 
+  { 		
+    if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+      {
+	this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+	this->_S_create_c_locale(this->_M_c_locale_ctype, __s); 
+      }
+  }
+
+  ctype_byname<char>::~ctype_byname()
+  { }
+
+#ifdef _GLIBCXX_USE_WCHAR_T  
+  ctype<wchar_t>::__wmask_type
+  ctype<wchar_t>::_M_convert_to_wmask(
+    const mask __attribute__((__unused__)) __m) const throw()
+  {
+    // DragonFly uses the same codes for 'char' as 'wchar_t', so this routine
+    // never gets called.
+    return __wmask_type();
+  };
+  
+  wchar_t
+  ctype<wchar_t>::do_toupper(wchar_t __c) const
+  { return towupper(__c); }
+
+  const wchar_t*
+  ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi)
+      {
+        *__lo = towupper(*__lo);
+        ++__lo;
+      }
+    return __hi;
+  }
+  
+  wchar_t
+  ctype<wchar_t>::do_tolower(wchar_t __c) const
+  { return towlower(__c); }
+  
+  const wchar_t*
+  ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi)
+      {
+        *__lo = towlower(*__lo);
+        ++__lo;
+      }
+    return __hi;
+  }
+
+  wchar_t
+  ctype<wchar_t>::
+  do_widen(char __c) const
+  { return _M_widen[static_cast<unsigned char>(__c)]; }
+
+  const char* 
+  ctype<wchar_t>::
+  do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
+  {
+    while (__lo < __hi)
+      {
+	*__dest = _M_widen[static_cast<unsigned char>(*__lo)];
+	++__lo;
+	++__dest;
+      }
+    return __hi;
+  }
+
+  char
+  ctype<wchar_t>::
+  do_narrow(wchar_t __wc, char __dfault) const
+  { 
+    if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
+      return _M_narrow[__wc];
+    const int __c = wctob(__wc);
+    return (__c == EOF ? __dfault : static_cast<char>(__c)); 
+  }
+
+  const wchar_t*
+  ctype<wchar_t>::
+  do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, 
+	    char* __dest) const
+  {
+    if (_M_narrow_ok)
+      while (__lo < __hi)
+	{
+	  if (*__lo >= 0 && *__lo < 128)
+	    *__dest = _M_narrow[*__lo];
+	  else
+	    {
+	      const int __c = wctob(*__lo);
+	      *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+	    }
+	  ++__lo;
+	  ++__dest;
+	}
+    else
+      while (__lo < __hi)
+	{
+	  const int __c = wctob(*__lo);
+	  *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
+	  ++__lo;
+	  ++__dest;
+	}
+    return __hi;
+  }
+
+  void
+  ctype<wchar_t>::_M_initialize_ctype() throw()
+  {
+    wint_t __i;
+    for (__i = 0; __i < 128; ++__i)
+      {
+	const int __c = wctob(__i);
+	if (__c == EOF)
+	  break;
+	else
+	  _M_narrow[__i] = static_cast<char>(__c);
+      }
+    if (__i == 128)
+      _M_narrow_ok = true;
+    else
+      _M_narrow_ok = false;
+    for (size_t __i = 0;
+	 __i < sizeof(_M_widen) / sizeof(wint_t); ++__i)
+      _M_widen[__i] = btowc(__i);
+  }
+#endif //  _GLIBCXX_USE_WCHAR_T
+}
diff --git a/libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h b/libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h
new file mode 100644
index 0000000..a95b248
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h
@@ -0,0 +1,58 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h on DragonFly.
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef const int*		__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef unsigned long	mask;
+    static const mask upper	= _CTYPE_U;
+    static const mask lower 	= _CTYPE_L;
+    static const mask alpha 	= _CTYPE_A;
+    static const mask digit 	= _CTYPE_D;
+    static const mask xdigit 	= _CTYPE_X;
+    static const mask space 	= _CTYPE_S;
+    static const mask print 	= _CTYPE_R;
+    static const mask graph 	= _CTYPE_A | _CTYPE_D | _CTYPE_P;
+    static const mask cntrl 	= _CTYPE_C;
+    static const mask punct 	= _CTYPE_P;
+    static const mask alnum 	= _CTYPE_A | _CTYPE_D;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc b/libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc
new file mode 100644
index 0000000..11fa22e
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc
@@ -0,0 +1,99 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ctype_configure_char.cc */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+// Information as gleaned from /usr/include/ctype.h
+  
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  { return 0; }
+
+  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
+		     size_t __refs) 
+  : facet(__refs), _M_del(__table != 0 && __del), 
+  _M_toupper(NULL), _M_tolower(NULL), 
+  _M_table(__table ? __table : classic_table()) 
+  { 
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
+  : facet(__refs), _M_del(__table != 0 && __del), 
+  _M_toupper(NULL), _M_tolower(NULL), 
+  _M_table(__table ? __table : classic_table()) 
+  { 
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  { return ::toupper((int) __c); }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = ::toupper((int) *__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  { return ::tolower((int) __c); }
+
+  const char* 
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = ::tolower((int) *__low);
+	++__low;
+      }
+    return __high;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h b/libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h
new file mode 100644
index 0000000..984665e
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h
@@ -0,0 +1,133 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/ctype_inline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  {
+    if (_M_table)
+      return _M_table[static_cast<unsigned char>(__c)] & __m;
+    else
+      return __istype(__c, __m);
+  }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    if (_M_table)
+      while (__low < __high)
+	*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    else
+      for (;__low < __high; ++__vec, ++__low)
+	{
+	  *__vec = __maskrune (*__low, upper | lower | alpha | digit | xdigit
+			       | space | print | graph | cntrl | punct | alnum);
+	}
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    if (_M_table)
+      while (__low < __high
+	     && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
+	++__low;
+    else
+      while (__low < __high && !this->is(__m, *__low))
+	++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    if (_M_table)
+      while (__low < __high
+	     && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
+	++__low;
+    else
+      while (__low < __high && this->is(__m, *__low) != 0)
+	++__low;
+    return __low;
+  }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  inline bool
+  ctype<wchar_t>::
+  do_is(mask __m, wchar_t __c) const
+  {
+    return __istype (__c, __m);
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
+  {
+    for (; __lo < __hi; ++__vec, ++__lo)
+      *__vec = __maskrune (*__lo, upper | lower | alpha | digit | xdigit
+			   | space | print | graph | cntrl | punct | alnum);
+    return __hi;
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
+  {
+    while (__lo < __hi && ! __istype (*__lo, __m))
+      ++__lo;
+    return __lo;
+  }
+
+  inline const wchar_t*
+  ctype<wchar_t>::
+  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
+  {
+    while (__lo < __hi && __istype (*__lo, __m))
+      ++__lo;
+    return __lo;
+  }
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/config/os/bsd/dragonfly/os_defines.h b/libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
new file mode 100644
index 0000000..9160eeb
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
@@ -0,0 +1,32 @@
+// Specific definitions for BSD  -*- C++ -*-
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here.  This
+// file will come before all others.
+
+#endif
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index dc6c977..a12871a 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -260,6 +260,9 @@ case "${host_os}" in
     os_include_dir="os/djgpp"
     error_constants_dir="os/djgpp"
     ;;
+  dragonfly*)
+    os_include_dir="os/bsd/dragonfly"
+    ;;
   freebsd*)
     os_include_dir="os/bsd/freebsd"
     ;;

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [doc] Add John Marino to doc/contrib.texi (was: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly)
  2014-05-21 11:43                     ` Jonathan Wakely
@ 2015-04-09 20:12                       ` Gerald Pfeifer
  0 siblings, 0 replies; 25+ messages in thread
From: Gerald Pfeifer @ 2015-04-09 20:12 UTC (permalink / raw)
  To: Jonathan Wakely
  Cc: John Marino, Jeff Law, Joseph S. Myers, gcc-patches, manu,
	Eric Botcazou (gnu.org)

On Wed, 21 May 2014, Jonathan Wakely wrote:
> Bootstrapped on x86_64-unknown-dragonfly3.6 and
> x86_64-unknown-linux-gnu, committed to trunk as
> http://gcc.gnu.org/r210694
> 
> John, thanks for contributing the target support and for persevering
> with the review process :-)

And here is the corresponding entry to doc/contrib.texi.  Committed.
Better late than never, I guess, and still in time for 5.0. :-)

Gerald

2015-04-09  Gerald Pfeifer  <gerald@pfeifer.com>

	* doc/contrib.texi (Contributors): Add John Marino.

Index: doc/contrib.texi
===================================================================
--- doc/contrib.texi	(revision 221959)
+++ doc/contrib.texi	(working copy)
@@ -590,6 +590,9 @@
 Bob Manson for his behind the scenes work on dejagnu.
 
 @item
+John Marino for contributing the DragonFly BSD port.
+
+@item
 Philip Martin for lots of libstdc++ string and vector iterator fixes and
 improvements, and string clean up and testsuites.
 

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-04-09 20:12 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-19 19:41 Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly John Marino
2014-04-20 19:05 ` Jonathan Wakely
2014-04-21  4:41   ` John Marino
2014-04-29 15:39     ` [PING] " John Marino
2014-04-29 17:25       ` Ian Lance Taylor
2014-04-29 18:50         ` John Marino
2014-04-30  0:07           ` Ian Lance Taylor
2014-05-01 23:03 ` Joseph S. Myers
2014-05-01 23:46   ` John Marino
2014-05-02 17:49     ` Joseph S. Myers
2014-05-02 18:17       ` John Marino
2014-05-02 20:15         ` Joseph S. Myers
2014-05-02 20:20           ` John Marino
2014-05-03  7:12           ` John Marino
2014-05-08 13:15             ` Jonathan Wakely
2014-05-08 13:32               ` Jeff Law
2014-05-08 13:36                 ` John Marino
2014-05-09  5:27             ` Jeff Law
2014-05-09  7:15               ` John Marino
2014-05-12 16:59                 ` Jeff Law
2014-05-12 17:10                   ` John Marino
2014-05-12 17:14                     ` Jeff Law
2014-05-13 14:10                       ` Jonathan Wakely
2014-05-21 11:43                     ` Jonathan Wakely
2015-04-09 20:12                       ` [doc] Add John Marino to doc/contrib.texi (was: Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly) Gerald Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).