aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Marino <marino@FreeBSD.org>2014-05-13 21:19:35 +0000
committerJohn Marino <marino@FreeBSD.org>2014-05-13 21:19:35 +0000
commit2ba2db697e431af9d800fca96b2e6eb6b0c184d7 (patch)
tree12aa628b809be7452a059bb1a3fd38ce828104f1
parent54c0e532087bb54e0b5b60273e6ce657ddb992c0 (diff)
Notes
-rw-r--r--lang/gcc-aux/Makefile.version2
-rw-r--r--lang/gcc-aux/files/diff-ada112
-rw-r--r--lang/gcc-aux/files/diff-core243
-rw-r--r--lang/gcc-aux/files/diff-cxx15
-rw-r--r--lang/gcc-aux/files/diff-fortran23
-rw-r--r--lang/gcc-aux/files/diff-fortran-testsuite20
6 files changed, 298 insertions, 117 deletions
diff --git a/lang/gcc-aux/Makefile.version b/lang/gcc-aux/Makefile.version
index 813055f1c839..a7b9422f354b 100644
--- a/lang/gcc-aux/Makefile.version
+++ b/lang/gcc-aux/Makefile.version
@@ -4,7 +4,7 @@ GCC_BRANCH= 4.9
GCC_POINT= 0
GCC_VERSION= ${GCC_BRANCH}.${GCC_POINT}
SNAPSHOT= 20140422
-MAIN_PR= 1
+MAIN_PR= 2
ARMV5_PR= 0
ARMV7_PR= 0
diff --git a/lang/gcc-aux/files/diff-ada b/lang/gcc-aux/files/diff-ada
index 5d65a860e1ec..fbb18cddea1c 100644
--- a/lang/gcc-aux/files/diff-ada
+++ b/lang/gcc-aux/files/diff-ada
@@ -445,15 +445,40 @@
+end Ada.Interrupts.Names;
--- gcc/ada/adaint.c.orig
+++ gcc/ada/adaint.c
-@@ -1144,6 +1144,7 @@
- strcpy (path, "GNAT-XXXXXX");
+@@ -577,8 +577,8 @@
+ GNAT_STRUCT_STAT stat_result;
+ int fd;
+
+- sprintf (full_path, "%s%c%s", dir, DIR_SEPARATOR, file);
+- sprintf (temp_file, "%s%cTMP-%ld-%ld",
++ snprintf (full_path, 256, "%s%c%s", dir, DIR_SEPARATOR, file);
++ snprintf (temp_file, 256, "%s%cTMP-%ld-%ld",
+ dir, DIR_SEPARATOR, (long)getpid(), (long)getppid ());
+
+ /* Create the temporary file and write the process number. */
+@@ -745,7 +745,8 @@
+ strcpy (encoding, "encoding=utf8");
+ *e_length = strlen (encoding);
+ #else
+- strcpy (os_name, filename);
++ /* o_length is initialized with max os_name size (2x filename size) */
++ strncpy (os_name, filename, *o_length);
+ *o_length = strlen (filename);
+ *e_length = 0;
+ #endif
+@@ -1141,9 +1142,10 @@
+ int fd;
+ int o_fmode = O_BINARY;
+
+- strcpy (path, "GNAT-XXXXXX");
++ strncpy (path, "GNAT-XXXXXX", 12);
#if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \
+ || defined (__DragonFly__) \
|| defined (linux) || defined(__GLIBC__)) && !defined (__vxworks)
return mkstemp (path);
#elif defined (__Lynx__)
-@@ -1310,7 +1311,49 @@
+@@ -1310,7 +1312,49 @@
free (pname);
}
@@ -471,9 +496,9 @@
+ char *datadir = getenv ("ANDROID_DATA");
+
+ if (datadir == NULL)
-+ strcpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX");
++ strncpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX", L_tmpnam);
+ else
-+ sprintf (tmp_filename, "%s/local/tmp/gnat-XXXXXX", datadir);
++ snprintf (tmp_filename, L_tmpnam, "%s/local/tmp/gnat-XXXXXX", datadir);
+
+ testfd = mkstemp (tmp_filename);
+ if (testfd != -1)
@@ -485,9 +510,9 @@
+ char *sdcard = getenv ("EXTERNAL_STORAGE");
+
+ if (sdcard == NULL)
-+ strcpy (tmp_filename, "/sdcard/gnat-XXXXXX");
++ strncpy (tmp_filename, "/sdcard/gnat-XXXXXX", L_tmpnam);
+ else
-+ sprintf (tmp_filename, "%s/gnat-XXXXXX", sdcard);
++ snprintf (tmp_filename, L_tmpnam, "%s/gnat-XXXXXX", sdcard);
+
+ testfd = mkstemp (tmp_filename);
+ if (testfd != -1)
@@ -503,7 +528,19 @@
|| defined (__OpenBSD__) || defined(__GLIBC__)
#define MAX_SAFE_PATH 1000
char *tmpdir = getenv ("TMPDIR");
-@@ -2562,7 +2605,9 @@
+@@ -1318,9 +1362,9 @@
+ /* If tmpdir is longer than MAX_SAFE_PATH, revert to default value to avoid
+ a buffer overflow. */
+ if (tmpdir == NULL || strlen (tmpdir) > MAX_SAFE_PATH)
+- strcpy (tmp_filename, "/tmp/gnat-XXXXXX");
++ strncpy (tmp_filename, "/tmp/gnat-XXXXXX", L_tmpnam);
+ else
+- sprintf (tmp_filename, "%s/gnat-XXXXXX", tmpdir);
++ snprintf (tmp_filename, L_tmpnam, "%s/gnat-XXXXXX", tmpdir);
+
+ close (mkstemp(tmp_filename));
+ #elif defined (__vxworks) && !(defined (__RTP__) || defined (VTHREADS))
+@@ -2562,7 +2606,9 @@
{
int cores = 1;
@@ -514,7 +551,7 @@
cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
#elif defined (__hpux__)
-@@ -3608,35 +3653,6 @@
+@@ -3608,35 +3654,6 @@
}
#endif
@@ -5725,7 +5762,7 @@
+end System.OS_Interface;
--- /dev/null
+++ gcc/ada/s-osinte-openbsd.ads
-@@ -0,0 +1,648 @@
+@@ -0,0 +1,640 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
@@ -5774,7 +5811,7 @@
+package System.OS_Interface is
+ pragma Preelaborate;
+
-+ pragma Linker_Options ("-pthread");
++ pragma Linker_Options ("-lpthread");
+
+ subtype int is Interfaces.C.int;
+ subtype short is Interfaces.C.short;
@@ -5883,21 +5920,13 @@
+ -- sigcontext is architecture dependent, so define it private
+ type struct_sigcontext is private;
+
-+ type old_struct_sigaction is record
++ type struct_sigaction is record
+ sa_handler : System.Address;
+ sa_mask : sigset_t;
+ sa_flags : int;
+ end record;
-+ pragma Convention (C, old_struct_sigaction);
++ pragma Convention (C, struct_sigaction);
+
-+ type new_struct_sigaction is record
-+ sa_handler : System.Address;
-+ sa_flags : int;
-+ sa_mask : sigset_t;
-+ end record;
-+ pragma Convention (C, new_struct_sigaction);
-+
-+ subtype struct_sigaction is new_struct_sigaction;
+ type struct_sigaction_ptr is access all struct_sigaction;
+
+ SIG_BLOCK : constant := 1;
@@ -5948,9 +5977,6 @@
+ end record;
+ pragma Convention (C, struct_timezone);
+
-+ procedure usleep (useconds : unsigned_long);
-+ pragma Import (C, usleep, "usleep");
-+
+ -------------------------
+ -- Priority Scheduling --
+ -------------------------
@@ -5969,6 +5995,8 @@
+
+ type pid_t is private;
+
++ Self_PID : constant pid_t;
++
+ function kill (pid : pid_t; sig : Signal) return int;
+ pragma Import (C, kill, "kill");
+
@@ -6356,6 +6384,7 @@
+ pragma Convention (C, struct_sigcontext);
+
+ type pid_t is new int;
++ Self_PID : constant pid_t := 0;
+
+ type time_t is new int;
+
@@ -6994,7 +7023,7 @@
|| defined (__GLIBC__) || defined (__APPLE__)
eof_ch = termios_rec.c_cc[VEOF];
-@@ -853,8 +856,11 @@
+@@ -853,8 +856,12 @@
/* Darwin, Free BSD, Linux, where component tm_gmtoff is present in
struct tm */
@@ -7003,6 +7032,7 @@
+#elif defined (__APPLE__) \
+ || defined (__DragonFly__) \
+ || defined (__FreeBSD__) \
++ || defined (__OpenBSD__) \
+ || defined (linux) \
+ || defined (__GLIBC__)
{
@@ -7010,7 +7040,7 @@
*off = tp.tm_gmtoff;
--- /dev/null
+++ gcc/ada/system-dragonfly-x86.ads
-@@ -0,0 +1,143 @@
+@@ -0,0 +1,144 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
@@ -7145,6 +7175,7 @@
+ Stack_Check_Probes : constant Boolean := True;
+ Stack_Check_Limits : constant Boolean := False;
+ Support_Aggregates : constant Boolean := True;
++ Support_Atomic_Primitives : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
@@ -7156,7 +7187,7 @@
+end System;
--- /dev/null
+++ gcc/ada/system-dragonfly-x86_64.ads
-@@ -0,0 +1,143 @@
+@@ -0,0 +1,144 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
@@ -7291,6 +7322,7 @@
+ Stack_Check_Probes : constant Boolean := True;
+ Stack_Check_Limits : constant Boolean := False;
+ Support_Aggregates : constant Boolean := True;
++ Support_Atomic_Primitives : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
@@ -7302,7 +7334,7 @@
+end System;
--- /dev/null
+++ gcc/ada/system-netbsd-x86.ads
-@@ -0,0 +1,143 @@
+@@ -0,0 +1,144 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
@@ -7437,6 +7469,7 @@
+ Stack_Check_Probes : constant Boolean := True;
+ Stack_Check_Limits : constant Boolean := False;
+ Support_Aggregates : constant Boolean := True;
++ Support_Atomic_Primitives : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
@@ -7448,7 +7481,7 @@
+end System;
--- /dev/null
+++ gcc/ada/system-netbsd-x86_64.ads
-@@ -0,0 +1,143 @@
+@@ -0,0 +1,144 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
@@ -7583,6 +7616,7 @@
+ Stack_Check_Probes : constant Boolean := True;
+ Stack_Check_Limits : constant Boolean := False;
+ Support_Aggregates : constant Boolean := True;
++ Support_Atomic_Primitives : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
@@ -7594,7 +7628,7 @@
+end System;
--- /dev/null
+++ gcc/ada/system-openbsd-x86.ads
-@@ -0,0 +1,143 @@
+@@ -0,0 +1,144 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
@@ -7604,7 +7638,7 @@
+-- S p e c --
+-- (OpenBSD/x86 Version) --
+-- --
-+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
++-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -7729,10 +7763,11 @@
+ Stack_Check_Probes : constant Boolean := True;
+ Stack_Check_Limits : constant Boolean := False;
+ Support_Aggregates : constant Boolean := True;
++ Support_Atomic_Primitives : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
-+ Always_Compatible_Rep : constant Boolean := True;
++ Always_Compatible_Rep : constant Boolean := False;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := False;
@@ -7740,7 +7775,7 @@
+end System;
--- /dev/null
+++ gcc/ada/system-openbsd-x86_64.ads
-@@ -0,0 +1,143 @@
+@@ -0,0 +1,144 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
@@ -7748,9 +7783,9 @@
+-- S Y S T E M --
+-- --
+-- S p e c --
-+-- (OpenBSD/x86_64 Version) --
++-- (OpenBSD/x86_64 Version) --
+-- --
-+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
++-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -7875,10 +7910,11 @@
+ Stack_Check_Probes : constant Boolean := True;
+ Stack_Check_Limits : constant Boolean := False;
+ Support_Aggregates : constant Boolean := True;
++ Support_Atomic_Primitives : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
-+ Always_Compatible_Rep : constant Boolean := True;
++ Always_Compatible_Rep : constant Boolean := False;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := False;
@@ -8367,7 +8403,7 @@
+
+ EH_MECHANISM=
+ THREADSLIB= -lpthread
-+ GMEM_LIB =
++ GMEM_LIB = gmemlib
+ LIBRARY_VERSION := $(LIB_VERSION)
+ MISCLIB = -lutil
+endif
@@ -8400,7 +8436,7 @@
+ EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o
+
-+ EH_MECHANISM=-gcc
++ EH_MECHANISM=
+ THREADSLIB= -lpthread
+ GMEM_LIB = gmemlib
+ LIBRARY_VERSION := $(LIB_VERSION)
diff --git a/lang/gcc-aux/files/diff-core b/lang/gcc-aux/files/diff-core
index d3c4b7c71e47..e3cc3919f64d 100644
--- a/lang/gcc-aux/files/diff-core
+++ b/lang/gcc-aux/files/diff-core
@@ -1,3 +1,7 @@
+--- gcc/DEV-PHASE.orig
++++ gcc/DEV-PHASE
+@@ -0,0 +1 @@
++release
--- /dev/null
+++ gcc/config/dragonfly-stdint.h
@@ -0,0 +1,56 @@
@@ -323,6 +327,62 @@
+
+#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
+#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
+--- gcc/config/openbsd-libpthread.h.orig
++++ gcc/config/openbsd-libpthread.h
+@@ -18,5 +18,5 @@
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+-#define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread} -lc}"
++#define OBSD_LIB_SPEC "%{pthread:-lpthread%{!shared:%{p|pg:_p}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
+
+--- gcc/config/openbsd.h.orig
++++ gcc/config/openbsd.h
+@@ -108,9 +108,9 @@
+ This two-stage defines makes it easy to pick that for targets that
+ have subspecs. */
+ #ifdef CPP_CPU_SPEC
+-#define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
++#define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
+ #else
+-#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
++#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
+ #endif
+
+ #undef LIB_SPEC
+@@ -143,6 +143,9 @@
+ #define LIB_SPEC OBSD_LIB_SPEC
+ #endif
+
++#undef LINK_PIE_SPEC
++#define LINK_PIE_SPEC "%{pie:-pie} %{p|pg|nopie:-nopie} "
++
+ #define TARGET_POSIX_IO
+
+ /* All new versions of OpenBSD have C99 functions. We redefine this hook
+@@ -285,5 +288,12 @@
+
+ /* Storage layout. */
+
++/* Silence "unsafe GNU crap" messages */
++#define NO_UNSAFE_BUILTINS
++
++/* The system headers on OpenBSD are C++-aware. */
++#undef NO_IMPLICIT_EXTERN_C
++#define NO_IMPLICIT_EXTERN_C
++
+
+ #define HAVE_ENABLE_EXECUTE_STACK
+--- gcc/config/openbsd.opt.orig
++++ gcc/config/openbsd.opt
+@@ -32,4 +32,7 @@
+ pthread
+ Driver
+
++rdynamic
++Driver
++
+ ; This comment is to ensure we retain the blank line above.
--- /dev/null
+++ gcc/config/i386/dragonfly.h
@@ -0,0 +1,105 @@
@@ -505,9 +565,49 @@
+#if defined(HAVE_LD_EH_FRAME_HDR)
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#endif
+--- gcc/config/i386/openbsd.h.orig
++++ gcc/config/i386/openbsd.h
+@@ -38,10 +38,10 @@
+
+ /* This must agree with <machine/ansi.h> */
+ #undef SIZE_TYPE
+-#define SIZE_TYPE "unsigned int"
++#define SIZE_TYPE "long unsigned int"
+
+ #undef PTRDIFF_TYPE
+-#define PTRDIFF_TYPE "int"
++#define PTRDIFF_TYPE "long int"
+
+ #undef WCHAR_TYPE
+ #define WCHAR_TYPE "int"
+@@ -49,6 +49,9 @@
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE 32
+
++#undef WINT_TYPE
++#define WINT_TYPE "int"
++
+ /* Assembler format: overall framework. */
+
+ #undef ASM_APP_ON
+--- gcc/config/i386/openbsdelf.h.orig
++++ gcc/config/i386/openbsdelf.h
+@@ -97,9 +97,12 @@
+ %{shared:-shared} %{R*} \
+ %{static:-Bstatic} \
+ %{!static:-Bdynamic} \
++ %{rdynamic:-export-dynamic} \
+ %{assert*} \
+ -dynamic-linker /usr/libexec/ld.so"
+
++#define SUBTARGET32_DEFAULT_CPU "i486"
++
+ #undef STARTFILE_SPEC
+ #define STARTFILE_SPEC "\
+ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
--- gcc/ginclude/stddef.h.orig
+++ gcc/ginclude/stddef.h
-@@ -50,12 +50,21 @@
+@@ -50,6 +50,11 @@
one less case to deal with in the following. */
#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
#include <machine/ansi.h>
@@ -519,17 +619,7 @@
#endif
/* On FreeBSD 5, machine/ansi.h does not exist anymore... */
#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
- #include <sys/_types.h>
- #endif
-
-+#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 +142,7 @@
+@@ -133,6 +138,7 @@
#ifndef _BSD_PTRDIFF_T_
#ifndef ___int_ptrdiff_t_h
#ifndef _GCC_PTRDIFF_T
@@ -537,7 +627,7 @@
#define _PTRDIFF_T
#define _T_PTRDIFF_
#define _T_PTRDIFF
-@@ -141,10 +151,12 @@
+@@ -141,10 +147,12 @@
#define _BSD_PTRDIFF_T_
#define ___int_ptrdiff_t_h
#define _GCC_PTRDIFF_T
@@ -550,7 +640,7 @@
#endif /* _GCC_PTRDIFF_T */
#endif /* ___int_ptrdiff_t_h */
#endif /* _BSD_PTRDIFF_T_ */
-@@ -198,6 +210,7 @@
+@@ -198,6 +206,7 @@
#define _GCC_SIZE_T
#define _SIZET_
#if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
@@ -558,15 +648,6 @@
|| defined(__FreeBSD_kernel__)
/* __size_t is a typedef on FreeBSD 5, must not trash it. */
#elif defined (__VMS__)
-@@ -306,7 +319,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,16 @@
@@ -1257,6 +1338,60 @@
#endif
+#endif
}
+--- gcc/builtins.c.orig
++++ gcc/builtins.c
+@@ -125,9 +125,11 @@
+ static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode);
+ static rtx expand_builtin_mempcpy_args (tree, tree, tree, rtx,
+ enum machine_mode, int);
++#ifndef NO_UNSAFE_BUILTINS
+ static rtx expand_builtin_strcpy (tree, rtx);
+ static rtx expand_builtin_strcpy_args (tree, tree, rtx);
+ static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode);
++#endif
+ static rtx expand_builtin_strncpy (tree, rtx);
+ static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode);
+ static rtx expand_builtin_memset (tree, rtx, enum machine_mode);
+@@ -3370,6 +3372,7 @@
+ # define CODE_FOR_movstr CODE_FOR_nothing
+ #endif
+
++#ifndef NO_UNSAFE_BUILTINS
+ /* Expand into a movstr instruction, if one is available. Return NULL_RTX if
+ we failed, the caller should emit a normal call, otherwise try to
+ get the result in TARGET, if convenient. If ENDP is 0 return the
+@@ -3521,6 +3524,7 @@
+ return expand_movstr (dst, src, target, /*endp=*/2);
+ }
+ }
++#endif
+
+ /* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE)
+ bytes from constant string DATA + OFFSET and return it as target
+@@ -6140,9 +6144,11 @@
+ break;
+
+ case BUILT_IN_STRCPY:
++#ifndef NO_UNSAFE_BUILTINS
+ target = expand_builtin_strcpy (exp, target);
+ if (target)
+ return target;
++#endif
+ break;
+
+ case BUILT_IN_STRNCPY:
+@@ -6152,9 +6158,11 @@
+ break;
+
+ case BUILT_IN_STPCPY:
++#ifndef NO_UNSAFE_BUILTINS
+ target = expand_builtin_stpcpy (exp, target, mode);
+ if (target)
+ return target;
++#endif
+ break;
+
+ case BUILT_IN_MEMCPY:
--- gcc/config.gcc.orig
+++ gcc/config.gcc
@@ -687,6 +687,26 @@
@@ -1326,7 +1461,36 @@
;;
i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h"
-@@ -4109,6 +4140,8 @@
+@@ -1375,6 +1406,7 @@
+ use_collect2=yes
+ ;;
+ i[34567]86-*-openbsd*)
++ tm_defines="${tm_defines} PIE_DEFAULT=1"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
+ tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h"
+ extra_options="${extra_options} openbsd.opt"
+@@ -1382,6 +1414,7 @@
+ gnu_ld=yes
+ ;;
+ x86_64-*-openbsd*)
++ tm_defines="${tm_defines} PIE_DEFAULT=1"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
+ tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h"
+ extra_options="${extra_options} openbsd.opt"
+@@ -2927,6 +2960,12 @@
+ arch_without_sse2=yes
+ arch_without_64bit=yes
+ ;;
++ i386-*-openbsd*)
++ arch=i486
++ cpu=generic
++ arch_without_sse2=yes
++ arch_without_64bit=yes
++ ;;
+ i386-*-*)
+ arch=i386
+ cpu=i386
+@@ -4109,6 +4148,8 @@
;;
i[34567]86-*-mingw* | x86_64-*-mingw*)
;;
@@ -1348,13 +1512,13 @@
+ gcc_cv_target_dl_iterate_phdr=no
+ fi
+ ;;
-+# *-*-netbsd* | *-*-openbsd*)
-+# if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then
-+# gcc_cv_target_dl_iterate_phdr=yes
-+# else
-+# gcc_cv_target_dl_iterate_phdr=no
-+# fi
-+# ;;
++ *-*-netbsd*)
++ if grep dl_iterate_phdr $target_header_dir/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
@@ -1495,30 +1659,39 @@
tmake_file="${tmake_file} t-softfp-tf"
--- libcilkrts/runtime/os-unix.c.orig
+++ libcilkrts/runtime/os-unix.c
-@@ -56,6 +56,8 @@
+@@ -56,6 +56,12 @@
// Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
#elif defined __FreeBSD__
// No additional include files
+#elif defined __DragonFly__
+// No additional include files
++#elif defined __NetBSD__
++// No additional include files
++#elif defined __OpenBSD__
++// No additional include files
#elif defined __CYGWIN__
// Cygwin on Windows - no additional include files
#elif defined __VXWORKS__
-@@ -374,7 +376,7 @@
+@@ -374,7 +380,8 @@
assert((unsigned)count == count);
return count;
-#elif defined __FreeBSD__ || defined __CYGWIN__
-+#elif defined __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__
++#elif defined __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__ \
++ || defined __NetBSD__ || defined __OpenBSD__
int ncores = sysconf(_SC_NPROCESSORS_ONLN);
return ncores;
-@@ -402,6 +404,8 @@
+@@ -402,6 +409,12 @@
// 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__)
+ sched_yield();
++#elif defined(__NetBSD__)
++ sched_yield();
++#elif defined(__OpenBSD__)
++ 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/lang/gcc-aux/files/diff-cxx b/lang/gcc-aux/files/diff-cxx
index 29ed481a78ed..9e709e19055c 100644
--- a/lang/gcc-aux/files/diff-cxx
+++ b/lang/gcc-aux/files/diff-cxx
@@ -1049,6 +1049,21 @@
return __high;
}
+--- libstdc++-v3/config/os/bsd/openbsd/os_defines.h.orig
++++ libstdc++-v3/config/os/bsd/openbsd/os_defines.h
+@@ -38,4 +38,12 @@
+ #define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC _GLIBCXX_USE_C99_DYNAMIC
+ #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC _GLIBCXX_USE_C99_DYNAMIC
+
++/* max_align_t is defined in ginclude/stddef.h which OpenBSD intentionally
++ excludes. Bringing the definition here fixes the libstdc++ build. */
++
++typedef struct {
++ long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
++ long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
++} max_align_t;
++
+ #endif
--- libstdc++-v3/acinclude.m4.orig
+++ libstdc++-v3/acinclude.m4
@@ -1989,6 +1989,9 @@
diff --git a/lang/gcc-aux/files/diff-fortran b/lang/gcc-aux/files/diff-fortran
index ed7bbb169f7d..caf531d19096 100644
--- a/lang/gcc-aux/files/diff-fortran
+++ b/lang/gcc-aux/files/diff-fortran
@@ -40,26 +40,3 @@
$as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
---- libquadmath/Makefile.in.orig
-+++ libquadmath/Makefile.in
-@@ -402,10 +402,9 @@
-
- # AM_CONDITIONAL on configure option --generated-files-in-srcdir
- @BUILD_LIBQUADMATH_TRUE@@GENINSRC_TRUE@STAMP_GENINSRC = stamp-geninsrc
--@BUILD_INFO_FALSE@@BUILD_LIBQUADMATH_TRUE@STAMP_BUILD_INFO =
-+@BUILD_LIBQUADMATH_TRUE@STAMP_BUILD_INFO =
-
- # AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
--@BUILD_INFO_TRUE@@BUILD_LIBQUADMATH_TRUE@STAMP_BUILD_INFO = stamp-build-info
- @BUILD_LIBQUADMATH_TRUE@CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) libquadmath.info
- @BUILD_LIBQUADMATH_TRUE@MAINTAINERCLEANFILES = $(srcdir)/libquadmath.info
-
-@@ -1300,7 +1299,7 @@
-
- info-am: $(INFO_DEPS)
-
--install-data-am: install-info-am install-nodist_libsubincludeHEADERS
-+install-data-am: install-nodist_libsubincludeHEADERS
-
- install-dvi: install-dvi-am
-
diff --git a/lang/gcc-aux/files/diff-fortran-testsuite b/lang/gcc-aux/files/diff-fortran-testsuite
index 789a9a2d4684..4241318f23fa 100644
--- a/lang/gcc-aux/files/diff-fortran-testsuite
+++ b/lang/gcc-aux/files/diff-fortran-testsuite
@@ -1,23 +1,3 @@
---- gcc/testsuite/gfortran.dg/large_real_kind_2.F90.orig
-+++ gcc/testsuite/gfortran.dg/large_real_kind_2.F90
-@@ -1,6 +1,6 @@
- ! { dg-do run }
- ! { dg-require-effective-target fortran_large_real }
--! { dg-xfail-if "" { "*-*-freebsd*" } { "*" } { "" } }
-+! { dg-skip-if "Requires cpowl,coshl,sinhl,tanhl,acoshl,asinhl,atanhl,expl,logl,ccosl,csinl,cexpl,clogl" { "x86_64-*-freebsd* x86_64-*-dragonfly* x86_64-*-netbsd*" } { "*" } { "" } }
-
- ! Testing library calls on large real kinds (larger than kind=8)
- implicit none
---- gcc/testsuite/gfortran.dg/large_real_kind_3.F90.orig
-+++ gcc/testsuite/gfortran.dg/large_real_kind_3.F90
-@@ -1,6 +1,6 @@
- ! { dg-do run }
- ! { dg-require-effective-target fortran_large_real }
--! { dg-xfail-if "" { "*-*-freebsd*" } { "*" } { "" } }
-+! { dg-skip-if "Requires erfl,erfcl with -O0" { "x86_64-*-freebsd* x86_64-*-dragonfly* x86_64-*-netbsd*" } { "-O0" } { "" } }
-
- ! Testing erf and erfc library calls on large real kinds (larger than kind=8)
- implicit none
--- gcc/testsuite/gfortran.dg/open_errors.f90.orig
+++ gcc/testsuite/gfortran.dg/open_errors.f90
@@ -22,7 +22,7 @@