[PATCH 1/1] Remove ns32k leftover

2017-06-24 Thread Maya Rashish
Support for ns32k was removed in GCC4.
---
 include/longlong.h | 36 
 1 file changed, 36 deletions(-)

diff --git a/include/longlong.h b/include/longlong.h
index 9d3ab21be..c24568ace 100644
--- a/include/longlong.h
+++ b/include/longlong.h
@@ -858,42 +858,6 @@ extern UDItype __umulsidi3 (USItype, USItype);
 #endif
 #endif /* __mips__ */
 
-#if defined (__ns32000__) && W_TYPE_SIZE == 32
-#define umul_ppmm(w1, w0, u, v) \
-  ({union {UDItype __ll;   \
-  struct {USItype __l, __h;} __i;  \
- } __xx;   \
-  __asm__ ("meid %2,%0"
\
-  : "=g" (__xx.__ll)   \
-  : "%0" ((USItype) (u)),  \
-"g" ((USItype) (v)));  \
-  (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#define __umulsidi3(u, v) \
-  ({UDItype __w;   \
-__asm__ ("meid %2,%0"  \
-: "=g" (__w)   \
-: "%0" ((USItype) (u)),\
-  "g" ((USItype) (v)));\
-__w; })
-#define udiv_qrnnd(q, r, n1, n0, d) \
-  ({union {UDItype __ll;   \
-  struct {USItype __l, __h;} __i;  \
- } __xx;   \
-  __xx.__i.__h = (n1); __xx.__i.__l = (n0);\
-  __asm__ ("deid %2,%0"
\
-  : "=g" (__xx.__ll)   \
-  : "0" (__xx.__ll),   \
-"g" ((USItype) (d)));  \
-  (r) = __xx.__i.__l; (q) = __xx.__i.__h; })
-#define count_trailing_zeros(count,x) \
-  do { \
-__asm__ ("ffsd %2,%0"  \
-   : "=r" ((USItype) (count))  \
-   : "0" ((USItype) 0),\
- "r" ((USItype) (x))); \
-  } while (0)
-#endif /* __ns32000__ */
-
 /* FIXME: We should test _IBMR2 here when we add assembly support for the
system vendor compilers.
FIXME: What's needed for gcc PowerPC VxWorks?  __vxworks__ is not good
-- 
2.13.1



[PATCH] Remove stale doc notes about netbsd and openbsd

2018-06-22 Thread Maya Rashish
That isn't a default any more because the default is 80486 with FPU.

---
 gcc/doc/invoke.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9bb1a4910b2..f231da3cde2 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -26851,8 +26851,8 @@ in ordinary CPU registers instead.
 @opindex mno-fancy-math-387
 Some 387 emulators do not support the @code{sin}, @code{cos} and
 @code{sqrt} instructions for the 387.  Specify this option to avoid
-generating those instructions.  This option is the default on
-OpenBSD and NetBSD@.  This option is overridden when @option{-march}
+generating those instructions.
+This option is overridden when @option{-march}
 indicates that the target CPU always has an FPU and so the
 instruction does not need emulation.  These
 instructions are not generated unless you also use the
-- 
2.17.0



[PATCH 1/2] Untangle stddef.h a little

2018-02-03 Thread Maya Rashish
Of the currently supported BSDs:
- FreeBSD, doesn't have ansi.h or define _MACHINE_ANSI_H anywhere
in its other headers since the long-gone 5.x release.
- OpenBSD, DragonflyBSD don't have ansi.h either.
- NetBSD, sole remaining with ansi.h

Replace all the ifdef macros to be ifdef __NetBSD__ as it's the
sole remaining user.

Whether it is appropriate to make per-OS choices here is debatable,
but this change allows for further future cleanup.

This enables using the headers on netbsd archs that use different
include guards for ansi.h, like ARM.

(Note that netbsd's copy of GCC avoids this header entirely.)
Built tested on NetBSD-8.99.12/amd64.
---
 gcc/ginclude/stddef.h | 20 +---
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 31b96a7e5..15a99e7da 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -46,9 +46,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 /* This avoids lossage on SunOS but only if stdtypes.h comes first.
There's no way to win with the other order!  Sun lossage.  */
 
-/* On 4.3bsd-net2, make sure ansi.h is included, so we have
-   one less case to deal with in the following.  */
-#if defined (__BSD_NET2__) || defined (386BSD) || (defined 
(__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
+#if defined(__NetBSD__)
 #include 
 #endif
 /* On FreeBSD 5, machine/ansi.h does not exist anymore... */
@@ -56,11 +54,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #include 
 #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_.
-   NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_ */
-#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) 
 || defined(_I386_ANSI_H_)
+#if defined(__NetBSD__)
 #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
 #define _SIZE_T
 #endif
@@ -87,7 +81,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #undef _WCHAR_T_
 #undef _BSD_WCHAR_T_
 #endif
-#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || 
defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) */
+#endif /* defined(__NetBSD__) */
 
 /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
Just ignore it.  */
@@ -359,11 +353,7 @@ typedef __WINT_TYPE__ wint_t;
 #undef __need_wint_t
 #endif
 
-/*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
-are already defined.  */
-/*  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.  */
-/*  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.  */
-#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) 
|| defined(_I386_ANSI_H_)
+#if defined(__NetBSD__)
 /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
 are probably typos and should be removed before 2.8 is released.  */
 #ifdef _GCC_PTRDIFF_T_
@@ -391,7 +381,7 @@ typedef __WINT_TYPE__ wint_t;
 #undef _WCHAR_T_
 #undef _BSD_WCHAR_T_
 #endif
-#endif /* _ANSI_H_ || _MACHINE_ANSI_H_ || _X86_64_ANSI_H_ || _I386_ANSI_H_ */
+#endif /* __NetBSD__ */
 
 #endif /* __sys_stdtypes_h */
 
-- 
2.15.1



[PATCH, alpha] PR target/85095

2018-05-24 Thread Maya Rashish
Move linux-specific specfile definitions to linux.h
gcc/config/alpha/linux.h (STARTFILE_SPEC, ENDFILE_SPEC) move from alpha/elf.h
---
 gcc/config/alpha/elf.h   | 26 --
 gcc/config/alpha/linux.h | 26 ++
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index db766616156..2a767f193f2 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -100,32 +100,6 @@ do {   
\
 ASM_OUTPUT_DEF (FILE, alias, name);\
   } while (0)
 
-/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
-   (even more) magical crtbegin.o file which provides part of the
-   support for getting C++ file-scope static object constructed
-   before entering `main'.  */
-
-#undef STARTFILE_SPEC
-#ifdef HAVE_LD_PIE
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#else
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#endif
-
-/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
-   magical crtend.o file which provides part of the support for
-   getting C++ file-scope static object constructed before entering
-   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
-
 /* This variable should be set to 'true' if the target ABI requires
unwinding tables even when exceptions are not used.  */
 #define TARGET_UNWIND_TABLES_DEFAULT true
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index 9ef320668c7..2bf52fe78ae 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -78,6 +78,32 @@ along with GCC; see the file COPYING3.  If not see
 
 #define TARGET_POSIX_IO
 
+/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
+   (even more) magical crtbegin.o file which provides part of the
+   support for getting C++ file-scope static object constructed
+   before entering `main'.  */
+
+#undef STARTFILE_SPEC
+#ifdef HAVE_LD_PIE
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#else
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#endif
+
+/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
+   magical crtend.o file which provides part of the support for
+   getting C++ file-scope static object constructed before entering
+   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
 #define LINK_GCC_C_SEQUENCE_SPEC \
   "%{static|static-pie:--start-group} %G %L \
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
-- 
2.17.0



[PATCH, doc] Update fortran file locations

2019-06-09 Thread Maya Rashish
doc/invoke.texi: Update fortran file locations.

---
 gcc/doc/invoke.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 5e3e8873d35..f1d22e87cbc 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -29242,7 +29242,7 @@ Like @samp{%g}, except if @option{-pipe} is in effect.  
In that case
 all.  These are the two most common ways to instruct a program that it
 should read from standard input or write to standard output.  If you
 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
-construct: see for example @file{f/lang-specs.h}.
+construct: see for example @file{gcc/fortran/lang-specs.h}.
 
 @item %.@var{SUFFIX}
 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
-- 
2.21.0



[PATCH] bring netbsd/arm support up to speed. eabi, etc.

2018-10-20 Thread Maya Rashish
---
 gcc/config.gcc  |  33 +-
 gcc/config.host |   2 +-
 gcc/config/arm/netbsd-eabi.h| 108 
 gcc/config/arm/netbsd-elf.h |  10 +++
 gcc/config/netbsd-elf.h |  15 +
 libgcc/config.host  |  11 +++-
 libgcc/config/arm/t-netbsd  |  15 -
 libgcc/config/arm/t-netbsd-eabi |  18 ++
 8 files changed, 205 insertions(+), 7 deletions(-)
 create mode 100644 gcc/config/arm/netbsd-eabi.h
 create mode 100644 libgcc/config/arm/t-netbsd-eabi

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8521f7d556e..e749c61e75f 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1130,10 +1130,37 @@ arm*-*-freebsd*)# ARM FreeBSD EABI
with_tls=${with_tls:-gnu}
;;
 arm*-*-netbsdelf*)
-   tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h arm/aout.h 
${tm_file} arm/netbsd-elf.h"
-   extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
tmake_file="${tmake_file} arm/t-arm"
-   target_cpu_cname="arm6"
+   tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
+   extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+   case ${target} in
+   arm*eb-*) tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ;;
+   esac
+   case ${target} in
+   arm*-*-netbsdelf-*eabi*)
+   tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
+   tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
+   # The BPABI long long divmod functions return a 128-bit value in
+   # registers r0-r3.  Correctly modeling that requires the use of
+   # TImode.
+   need_64bit_hwint=yes
+   ;;
+   *)
+   tm_file="$tm_file arm/netbsd-elf.h"
+   tmake_file="$tmake_file arm/t-netbsd"
+   ;;
+   esac
+   tm_file="${tm_file} arm/aout.h arm/arm.h"
+   case ${target} in
+   arm*-*-netbsdelf-*eabihf*)
+   tm_defines="${tm_defines} 
TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
+   ;;
+   esac
+   case ${target} in
+   armv4*) target_cpu_cname="strongarm";;
+   armv6*) target_cpu_cname="arm1176jzf-s";;
+   armv7*) target_cpu_cname="cortex-a8";;
+   esac
;;
 arm*-*-linux-*)# ARM GNU/Linux with ELF
tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h 
glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
diff --git a/gcc/config.host b/gcc/config.host
index c65569da2e9..59208d2508f 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -107,7 +107,7 @@ case ${host} in
;;
 esac
 ;;
-  arm*-*-freebsd* | arm*-*-linux* | arm*-*-fuchsia*)
+  arm*-*-freebsd* | arm*-*-netbsd* | arm*-*-linux* | arm*-*-fuchsia*)
 case ${target} in
   arm*-*-*)
host_extra_gcc_objs="driver-arm.o"
diff --git a/gcc/config/arm/netbsd-eabi.h b/gcc/config/arm/netbsd-eabi.h
new file mode 100644
index 000..92f31b885f0
--- /dev/null
+++ b/gcc/config/arm/netbsd-eabi.h
@@ -0,0 +1,108 @@
+/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
+   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Contributed by Wasabi Systems, 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
+   .  */
+
+/* Run-time Target Specification.  */
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
+
+#define TARGET_LINKER_EABI_SUFFIX \
+(TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT \
+ ? "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}" \
+ : "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}")
+#define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
+#define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
+
+/* TARGET_BIG_ENDIAN_DEFAULT is set in
+   config.gcc for big endian configurations.  */
+#undef  TARGET_LINKER_EMULATION
+#if TARGET_BIG_ENDIAN_DEFAULT
+#define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION
+#undef BE8_LINK_SPEC
+#define BE8_LINK_SPEC " 
%{!mlittle-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
 
+#else
+#define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION
+#endif
+
+#undef ARM_DEFAULT_ABI
+#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
+
+#undef ARM_UNWIND_INFO
+#define AR

[PATCH] target/58397: add host_hooks for NetBSD to make precompiled headers work

2018-11-25 Thread Maya Rashish
---
 gcc/config.host  |  4 ++
 gcc/config/host-netbsd.c | 85 
 gcc/config/x-netbsd  |  4 ++
 3 files changed, 93 insertions(+)
 create mode 100644 gcc/config/host-netbsd.c
 create mode 100644 gcc/config/x-netbsd

diff --git a/gcc/config.host b/gcc/config.host
index c65569da2..970d4d549 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -282,6 +282,10 @@ case ${host} in
 out_host_hook_obj=host-openbsd.o
 host_xmake_file="${host_xmake_file} x-openbsd"
 ;;
+  *-*-netbsd*)
+out_host_hook_obj=host-netbsd.o
+host_xmake_file="${host_xmake_file} x-netbsd"
+;;
   ia64-*-hpux*)
 use_long_long_for_widest_fast_int=yes
 out_host_hook_obj=host-hpux.o
diff --git a/gcc/config/host-netbsd.c b/gcc/config/host-netbsd.c
new file mode 100644
index 0..fbd51e39b
--- /dev/null
+++ b/gcc/config/host-netbsd.c
@@ -0,0 +1,85 @@
+/* NetBSD host-specific hook definitions.
+   Copyright (C) 2004-2018 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
+   .  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
+
+
+#undef HOST_HOOKS_GT_PCH_GET_ADDRESS
+#define HOST_HOOKS_GT_PCH_GET_ADDRESS netbsd_gt_pch_get_address
+#undef HOST_HOOKS_GT_PCH_USE_ADDRESS
+#define HOST_HOOKS_GT_PCH_USE_ADDRESS netbsd_gt_pch_use_address
+
+/* For various ports, try to guess a fixed spot in the vm space
+   that's probably free.  */
+#if defined(__sparc64__)
+# define TRY_EMPTY_VM_SPACE0x400
+#elif defined(_LP64)
+# define TRY_EMPTY_VM_SPACE0x4000
+#elif defined(__mips__) || defined(__vax__) || defined (__arm__)
+# define TRY_EMPTY_VM_SPACE0x6000
+#else
+# define TRY_EMPTY_VM_SPACE0xb000
+#endif
+
+/* Determine a location where we might be able to reliably allocate
+   SIZE bytes.  FD is the PCH file, though we should return with the
+   file unmapped.  */
+
+static void *
+netbsd_gt_pch_get_address (size_t size, int fd)
+{
+  void *addr;
+
+  addr = mmap ((void *) TRY_EMPTY_VM_SPACE, size, PROT_READ | PROT_WRITE,
+  MAP_PRIVATE | MAP_FIXED, fd, 0);
+
+  /* If we failed the map, that means there's *no* free space.  */
+  if (addr == (void *) MAP_FAILED)
+return NULL;
+  /* Unmap the area before returning.  */
+  munmap (addr, size);
+
+  return addr;
+}
+
+/* Map SIZE bytes of FD+OFFSET at BASE.  Return 1 if we succeeded at 
+   mapping the data at BASE, -1 if we couldn't.  */
+
+static int
+netbsd_gt_pch_use_address (void *base, size_t size, int fd, size_t offset)
+{
+  void *addr;
+
+  /* We're called with size == 0 if we're not planning to load a PCH
+ file at all.  This allows the hook to free any static space that
+ we might have allocated at link time.  */
+  if (size == 0)
+return -1;
+
+  addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, 
fd, offset);
+
+  return addr == base ? 1 : -1;
+}
+
+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
diff --git a/gcc/config/x-netbsd b/gcc/config/x-netbsd
new file mode 100644
index 0..beef74512
--- /dev/null
+++ b/gcc/config/x-netbsd
@@ -0,0 +1,4 @@
+host-netbsd.o : $(srcdir)/config/host-netbsd.c $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H)
+   $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+   $(srcdir)/config/host-netbsd.c
-- 
2.19.1



[PATCH,GDC] Add netbsd support to GDC

2019-01-22 Thread Maya Rashish
libphobos/libdruntime changes were contributed upstream:
https://github.com/dlang/druntime/pull/2472
(caveat: pending a change to netbsd/execinfo.d)

One missing patch is needed for GDC to work.

gcc/config.gcc (*-*-netbsd*): add netbsd-d.o
gcc/config/t-netbsd: add netbsd-d.o

gcc/d/d-builtins.cc: add NetBSD
gcc/d/d-system.h: NetBSD is POSIX
gcc/d/dmd/globals.h: add isNetBSD

libphobos/configure.tgt: Mark netbsd/x86 as supported

---
 gcc/config.gcc  | 2 ++
 gcc/config/t-netbsd | 4 
 gcc/d/d-builtins.cc | 2 ++
 gcc/d/d-system.h| 3 ++-
 gcc/d/dmd/globals.h | 1 +
 libphobos/configure.tgt | 2 ++
 6 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index a189cb19f63..c5d3044b017 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -839,6 +839,7 @@ case ${target} in
   tm_p_file="${tm_p_file} netbsd-protos.h"
   tmake_file="t-netbsd t-slibgcc"
   extra_objs="${extra_objs} netbsd.o"
+  d_target_objs="${d_target_objs} netbsd-d.o"
   gas=yes
   gnu_ld=yes
   use_gcc_stdint=wrap
@@ -847,6 +848,7 @@ case ${target} in
   esac
   nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
   default_use_cxa_atexit=yes
+  target_has_targetdm=yes
   ;;
 *-*-openbsd*)
   tmake_file="t-openbsd"
diff --git a/gcc/config/t-netbsd b/gcc/config/t-netbsd
index 4626e963ebf..716a94f86c6 100644
--- a/gcc/config/t-netbsd
+++ b/gcc/config/t-netbsd
@@ -19,3 +19,7 @@
 netbsd.o: $(srcdir)/config/netbsd.c
$(COMPILE) $<
$(POSTCOMPILE)
+
+netbsd-d.o: $(srcdir)/config/netbsd-d.c
+   $(COMPILE) $<
+   $(POSTCOMPILE)
diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc
index b0a315a3ed9..ca105c7635d 100644
--- a/gcc/d/d-builtins.cc
+++ b/gcc/d/d-builtins.cc
@@ -382,6 +382,8 @@ d_add_builtin_version (const char* ident)
 global.params.isWindows = true;
   else if (strcmp (ident, "FreeBSD") == 0)
 global.params.isFreeBSD = true;
+  else if (strcmp (ident, "NetBSD") == 0)
+global.params.isNetBSD = true;
   else if (strcmp (ident, "OpenBSD") == 0)
 global.params.isOpenBSD = true;
   else if (strcmp (ident, "Solaris") == 0)
diff --git a/gcc/d/d-system.h b/gcc/d/d-system.h
index cd59b827812..c32825d4ad1 100644
--- a/gcc/d/d-system.h
+++ b/gcc/d/d-system.h
@@ -24,7 +24,8 @@
 
 /* Used by the dmd front-end to determine if we have POSIX-style IO.  */
 #define POSIX (__linux__ || __GLIBC__ || __gnu_hurd__ || __APPLE__ \
-  || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun)
+  || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ \
+  || __sun)
 
 /* Forward assert invariants to gcc_assert.  */
 #undef assert
diff --git a/gcc/d/dmd/globals.h b/gcc/d/dmd/globals.h
index 6c37cca3236..4fb96fecef4 100644
--- a/gcc/d/dmd/globals.h
+++ b/gcc/d/dmd/globals.h
@@ -84,6 +84,7 @@ struct Param
 bool isOSX; // generate code for Mac OSX
 bool isWindows; // generate code for Windows
 bool isFreeBSD; // generate code for FreeBSD
+bool isNetBSD;  // generate code for NetBSD
 bool isOpenBSD; // generate code for OpenBSD
 bool isSolaris; // generate code for Solaris
 bool hasObjectiveC; // target supports Objective-C
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index 2b2a9746811..0471bfd816b 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -30,6 +30,8 @@ case "${target}" in
;;
   x86_64-*-linux* | i?86-*-linux*)
;;
+  x86_64-*-netbsd* | i?86-*-netbsd*)
+   ;;
   *)
UNSUPPORTED=1
;;
-- 
2.20.1



[PATCH, alpha] Don't refer to -mfp-trap-mode=n as a default

2017-09-02 Thread Maya Rashish
The typical usage on alpha is done with passing -mieee, which
sets -mfp-trap-mode=su.

I found it confusing, at least.
---
 gcc/doc/invoke.texi | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f7bad9d23..acdb17ba5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -17304,9 +17304,8 @@ The trap mode can be set to one of four values:
 
 @table @samp
 @item n
-This is the default (normal) setting.  The only traps that are enabled
-are the ones that cannot be disabled in software (e.g., division by zero
-trap).
+The only traps that are enabled are the ones that cannot be disabled in
+software (e.g., division by zero trap).
 
 @item u
 In addition to the traps enabled by @samp{n}, underflow traps are enabled
-- 
2.14.1



[PATCH] Add netbsd-stdint.h to several netbsd targets

2017-09-03 Thread Maya Rashish
grouping netbsd.h netbsd-stdint.h netbsd-elf.h as "nbsd_tm_file",
similar to freebsd.

I've only tested some of the archs, but the change originates in
netbsd's copy of GCC, so it should be safe for the untested ones as
well.

---
 gcc/config.gcc | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 428e99a10..efbb49226 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -799,6 +799,7 @@ case ${target} in
   case ${enable_threads} in
 "" | yes | posix) thread_file='posix' ;;
   esac
+  nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
   default_use_cxa_atexit=yes
   ;;
 *-*-openbsd*)
@@ -1002,7 +1003,7 @@ alpha*-*-freebsd*)
extra_options="${extra_options} alpha/elf.opt"
;;
 alpha*-*-netbsd*)
-   tm_file="elfos.h ${tm_file} netbsd.h alpha/elf.h netbsd-elf.h 
alpha/netbsd.h"
+   tm_file="elfos.h ${tm_file} ${nbsd_tm_file} alpha/elf.h alpha/netbsd.h"
tmake_file="${tmake_file} alpha/t-alpha"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt \
   alpha/elf.opt"
@@ -1102,7 +1103,7 @@ arm*-*-freebsd*)# ARM FreeBSD EABI
with_tls=${with_tls:-gnu}
;;
 arm*-*-netbsdelf*)
-   tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h 
${tm_file} arm/netbsd-elf.h"
+   tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h arm/aout.h 
${tm_file} arm/netbsd-elf.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
tmake_file="${tmake_file} arm/t-arm"
target_cpu_cname="arm6"
@@ -1487,11 +1488,11 @@ x86_64-*-freebsd*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h 
${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
;;
 i[34567]86-*-netbsdelf*)
-   tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h 
netbsd-stdint.h netbsd-elf.h i386/netbsd-elf.h"
+   tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h 
${nbsd_tm_file} i386/netbsd-elf.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
;;
 x86_64-*-netbsd*)
-   tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h 
netbsd-stdint.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
+   tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h 
${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
;;
 i[34567]86-*-openbsd*)
@@ -2074,7 +2075,7 @@ riscv*-*-elf* | riscv*-*-rtems*)
;;
 mips*-*-netbsd*)   # NetBSD/mips, either endian.
target_cpu_default="MASK_ABICALLS"
-   tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h 
mips/netbsd.h"
+   tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
;;
 mips*-img-linux*)
@@ -2390,7 +2391,7 @@ powerpc*-*-freebsd*)
esac
;;
 powerpc-*-netbsd*)
-   tm_file="${tm_file} dbxelf.h elfos.h netbsd.h netbsd-elf.h 
freebsd-spec.h rs6000/sysv4.h rs6000/netbsd.h"
+   tm_file="${tm_file} ${nbsd_tm_file} dbxelf.h elfos.h freebsd-spec.h 
rs6000/sysv4.h rs6000/netbsd.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
tmake_file="${tmake_file} rs6000/t-netbsd"
extra_options="${extra_options} rs6000/sysv4.opt"
@@ -2732,7 +2733,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
fi
tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h 
sh/linux.h" ;;
sh*-*-netbsd*)
-   tm_file="${tm_file} netbsd.h netbsd-elf.h 
sh/netbsd-elf.h"
+   tm_file="${tm_file} ${nbsd_tm_file} sh/netbsd-elf.h"
extra_options="${extra_options} netbsd.opt 
netbsd-elf.opt"
 
;;
@@ -2892,7 +2893,7 @@ sparc-*-linux*)
fi
;;
 sparc-*-netbsdelf*)
-   tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h 
netbsd-elf.h sparc/netbsd-elf.h"
+   tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} 
sparc/netbsd-elf.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
extra_options="${extra_options} sparc/long-double-switch.opt"
tmake_file="${tmake_file} sparc/t-sparc"
@@ -2940,7 +2941,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*)
;;
 sparc64-*-netbsd*)
tm_file="sparc/biarch64.h ${tm_file}"
-   tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h netbsd.h 
netbsd-elf.h sparc/netbsd-elf.h"
+   tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} 
sparc/netbsd-elf.h"
extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
extra_options="${extra_options} sparc/long-double-switch.opt"
tmake_file="${tmake_file} sparc/t-sparc sparc/t-netbsd64"
@@ -3044,7 +3045,7 @@ vax-*-linux*)
extra_options="${extra_options} vax/elf

[PATCH, alpha] Move linux-specific specfile definitions to linux.h

2017-09-03 Thread Maya Rashish
Hi, in my first attempt to fix a build issue I found that the order of
tm files matters, would prefer to move linux-looking parts of elf.h to
linux.h.

other targets that include alpha/elf.h besides linux:
openbsd:  provides their own STARTFILE_SPEC and ENDFILE_SPEC in later file:
https://github.com/openbsd/ports/blob/master/lang/gcc/6/patches/patch-gcc_config_alpha_openbsd_h
freebsd:  dropped alpha in freebsd 7.0 (2008)

Built trunk on netbsd/alpha (until I out of spaced with a working stage3
after two days :-)) with some extra modifications.

---
 gcc/config/alpha/elf.h   | 26 --
 gcc/config/alpha/linux.h | 26 ++
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index c109b07c5..8a435dbc0 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -100,32 +100,6 @@ do {   
\
 ASM_OUTPUT_DEF (FILE, alias, name);\
   } while (0)
 
-/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
-   (even more) magical crtbegin.o file which provides part of the
-   support for getting C++ file-scope static object constructed
-   before entering `main'.  */
-
-#undef STARTFILE_SPEC
-#ifdef HAVE_LD_PIE
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#else
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#endif
-
-/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
-   magical crtend.o file which provides part of the support for
-   getting C++ file-scope static object constructed before entering
-   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
-
 /* This variable should be set to 'true' if the target ABI requires
unwinding tables even when exceptions are not used.  */
 #define TARGET_UNWIND_TABLES_DEFAULT true
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
index e15013eb9..cd0099779 100644
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -78,6 +78,32 @@ along with GCC; see the file COPYING3.  If not see
 
 #define TARGET_POSIX_IO
 
+/* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
+   (even more) magical crtbegin.o file which provides part of the
+   support for getting C++ file-scope static object constructed
+   before entering `main'.  */
+
+#undef STARTFILE_SPEC
+#ifdef HAVE_LD_PIE
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#else
+#define STARTFILE_SPEC \
+  "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+#endif
+
+/* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
+   magical crtend.o file which provides part of the support for
+   getting C++ file-scope static object constructed before entering
+   `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
 #define LINK_GCC_C_SEQUENCE_SPEC \
   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
 
-- 
2.14.1



[PATCH 1/2] aarch64: Run SUBTARGET_INIT_BUILTINS if it exists

2021-02-13 Thread Maya Rashish via Gcc-patches
Some subtargets don't provide the canonical function names as
the symbol name in C libraries, and libcalls will only work if
the builtins are patched to emit the correct library name.

For example, on NetBSD, cabsl has the symbol name __c99_cabsl,
and the patching is done via netbsd_patch_builtin.

With this change, libgfortran.so is correctly built with a
reference to __c99_cabsl, instead of "cabsl" which is not defined.

gcc/ChangeLog:
* config/aarch64/aarch64-builtins.c
  (aarch64_general_init_builtins): Call SUBTARGET_INIT_BUILTINS.
---
 gcc/config/aarch64/aarch64-builtins.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/aarch64/aarch64-builtins.c 
b/gcc/config/aarch64/aarch64-builtins.c
index 25ab866ccd4..df13c9be051 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -1459,6 +1459,10 @@ aarch64_general_init_builtins (void)
 
   if (TARGET_MEMTAG)
 aarch64_init_memtag_builtins ();
+
+#ifdef SUBTARGET_INIT_BUILTINS
+  SUBTARGET_INIT_BUILTINS;
+#endif
 }
 
 /* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group.  */
-- 
2.28.0



[PATCH 2/2] sparc: Run SUBTARGET_INIT_BUILTINS if it exists

2021-02-13 Thread Maya Rashish via Gcc-patches
Some subtargets don't provide the canonical function names as
the symbol name in C libraries, and libcalls will only work if
the builtins are patched to emit the correct library name.

For example, on NetBSD, cabsl has the symbol name __c99_cabsl,
and the patching is done via netbsd_patch_builtin.

With this change, libgfortran.so is correctly built with a
reference to __c99_cabsl, instead of "cabsl" which is not defined.

gcc/ChangeLog:
* config/sparc/sparc.c
  (sparc_init_builtins): Call SUBTARGET_INIT_BUILTINS.
---
 gcc/config/sparc/sparc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index f3557936114..fe6475f2520 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -10962,6 +10962,9 @@ sparc_init_builtins (void)
 
   if (TARGET_VIS)
 sparc_vis_init_builtins ();
+#ifdef SUBTARGET_INIT_BUILTINS
+  SUBTARGET_INIT_BUILTINS;
+#endif
 }
 
 /* Create builtin functions for FPU instructions.  */
-- 
2.28.0



[PATCH] sparc: Run SUBTARGET_INIT_BUILTINS if it exists

2021-02-15 Thread Maya Rashish via Gcc-patches
Some subtargets don't provide the canonical function names as
the symbol name in C libraries, and libcalls will only work if
the builtins are patched to emit the correct library name.

For example, on NetBSD, cabsl has the symbol name __c99_cabsl,
and the patching is done via netbsd_patch_builtin.

With this change, libgfortran.so is correctly built with a
reference to __c99_cabsl, instead of "cabsl" which is not defined.

gcc/ChangeLog:
* config/sparc/sparc.c (sparc_init_builtins):
Call SUBTARGET_INIT_BUILTINS.
---
 gcc/config/sparc/sparc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index f3557936114..ce75e1f8cc0 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -10962,6 +10962,10 @@ sparc_init_builtins (void)
 
   if (TARGET_VIS)
 sparc_vis_init_builtins ();
+
+#ifdef SUBTARGET_INIT_BUILTINS
+  SUBTARGET_INIT_BUILTINS;
+#endif
 }
 
 /* Create builtin functions for FPU instructions.  */
-- 
2.28.0



[PATCH] aarch64: Run SUBTARGET_INIT_BUILTINS if it exists

2021-02-15 Thread Maya Rashish via Gcc-patches
Some subtargets don't provide the canonical function names as
the symbol name in C libraries, and libcalls will only work if
the builtins are patched to emit the correct library name.

For example, on NetBSD, cabsl has the symbol name __c99_cabsl,
and the patching is done via netbsd_patch_builtin.

With this change, libgfortran.so is correctly built with a
reference to __c99_cabsl, instead of "cabsl" which is not defined.

gcc/ChangeLog:
* config/aarch64/aarch64.c (aarch64_init_builtins):
Call SUBTARGET_INIT_BUILTINS.
---
 gcc/config/aarch64/aarch64.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 146ed8c1b69..6fda6bca2a5 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -13492,6 +13492,9 @@ aarch64_init_builtins ()
 {
   aarch64_general_init_builtins ();
   aarch64_sve::init_builtins ();
+#ifdef SUBTARGET_INIT_BUILTINS
+  SUBTARGET_INIT_BUILTINS;
+#endif
 }
 
 /* Implement TARGET_FOLD_BUILTIN.  */
-- 
2.28.0