]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add netbsd support for D compiler and runtime
authoribuclaw <ibuclaw@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Feb 2019 21:25:39 +0000 (21:25 +0000)
committeribuclaw <ibuclaw@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Feb 2019 21:25:39 +0000 (21:25 +0000)
Merges upstream druntime fb4bda91.

2019-02-14  Maya Rashish  <coypu@sdf.org>

gcc/ChangeLog:

* config.gcc (*-*-netbsd*): Add netbsd-d.o
* config/netbsd-d.c: New file.
* config/t-netbsd: Add netbsd-d.o

gcc/d/ChangeLog:

* d-system.h: NetBSD is POSIX.

libphobos/ChangeLog:

* configure.tgt: Add netbsd/x86 as supported target.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268905 138bc75d-0d04-0410-961f-82ee72b054a4

13 files changed:
gcc/ChangeLog
gcc/config.gcc
gcc/config/netbsd-d.c [new file with mode: 0644]
gcc/config/t-netbsd
gcc/d/ChangeLog
gcc/d/d-system.h
libphobos/ChangeLog
libphobos/configure.tgt
libphobos/libdruntime/MERGE
libphobos/libdruntime/core/stdc/assert_.d
libphobos/libdruntime/core/stdc/stdio.d
libphobos/libdruntime/core/stdc/wchar_.d
libphobos/libdruntime/core/sys/netbsd/dlfcn.d

index 1c4aa5da2726b130bda6604adb894cbe3ea0bccf..e2c7b8ef3530f7a4db8ffba912e0007e02aef0f2 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-14  Maya Rashish  <coypu@sdf.org>
+
+       * config.gcc (*-*-netbsd*): Add netbsd-d.o
+       * config/netbsd-d.c: New file.
+       * config/t-netbsd: Add netbsd-d.o
+
 2018-02-14  Steve Ellcey  <sellcey@marvell.com>
 
        * config/aarch64/aarch64.c (aarch64_attribute_table): Change
index 31b47c51b7bc6c1925238b34016b8c4b364b2b3f..3ee31c5993df3065e1cc183eb8478a2c8a72d443 100644 (file)
@@ -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/netbsd-d.c b/gcc/config/netbsd-d.c
new file mode 100644 (file)
index 0000000..76342aa
--- /dev/null
@@ -0,0 +1,41 @@
+/* Functions for generic NetBSD as target machine for GNU D compiler.
+   Copyright (C) 2019 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/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "varasm.h"
+#include "netbsd-protos.h"
+#include "tm_p.h"
+#include "d/d-target.h"
+#include "d/d-target-def.h"
+
+static void
+netbsd_d_os_builtins (void)
+{
+  d_add_builtin_version ("Posix");
+  d_add_builtin_version ("NetBSD");
+}
+
+#undef TARGET_D_OS_VERSIONS
+#define TARGET_D_OS_VERSIONS netbsd_d_os_builtins
+
+struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
index 4626e963ebf0393bf853112453ccd82dce912662..716a94f86c63dd81c6b507b439274790727ca1b0 100644 (file)
@@ -19,3 +19,7 @@
 netbsd.o: $(srcdir)/config/netbsd.c
        $(COMPILE) $<
        $(POSTCOMPILE)
+
+netbsd-d.o: $(srcdir)/config/netbsd-d.c
+       $(COMPILE) $<
+       $(POSTCOMPILE)
index 6eb2ac488e66a3b631f3f5c4949cf1f131bd86fa..4bf2e95805d1b16876d970d382bc204e83739c83 100644 (file)
@@ -1,3 +1,7 @@
+2019-02-14  Maya Rashish  <coypu@sdf.org>
+
+       * d-system.h: NetBSD is POSIX.
+
 2019-02-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR d/87864
index cd59b827812af4a31f32441c3a37fe6b9ca6c32b..c32825d4ad1139a67ff900a306bd1d84a08b4b38 100644 (file)
@@ -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
index 4efd97efaaff0a620749cdb957ece23faa6d1d24..22766a2d52aa6e284a94b339c51991b9d846250f 100644 (file)
@@ -1,3 +1,7 @@
+2019-02-14  Maya Rashish  <coypu@sdf.org>
+
+       * configure.tgt: Add netbsd/x86 as supported target.
+
 2019-02-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR d/87864
index 2b2a97468110a72ec347b5d87b6b5e5175aff618..0471bfd816b151d6164ecbc5dfb64e983a16c2ae 100644 (file)
@@ -30,6 +30,8 @@ case "${target}" in
        ;;
   x86_64-*-linux* | i?86-*-linux*)
        ;;
+  x86_64-*-netbsd* | i?86-*-netbsd*)
+       ;;
   *)
        UNSUPPORTED=1
        ;;
index 921b954aafb65c33c7ea1c16c10f0a210fc4f679..09ce8d03566a29036e81a962fa403e4c57d3a65c 100644 (file)
@@ -1,4 +1,4 @@
-2fd957307d94b5ce89eb173910cc7f1995d99031
+fb4bda91b0b43b5a18e1c143943c101ad4e17667
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/druntime repository.
index ead9c05f35ce5b6ff2a602d35d4524c1ad6f602f..ca7afe93b1e7c34702323405c81069a6f0c690bb 100644 (file)
@@ -53,6 +53,13 @@ else version (FreeBSD)
      */
     void __assert(const(char)* exp, const(char)* file, uint line);
 }
+else version (NetBSD)
+{
+    /***
+     * Assert failure function in the NetBSD C library.
+     */
+    void __assert(const(char)* file, int line, const(char)* exp);
+}
 else version (DragonFlyBSD)
 {
     /***
index c0223b5c7769cc071dd315ec486a34982c6765b2..c04b9c41228044de87754a9907ceb0ec50ffd79b 100644 (file)
@@ -198,12 +198,6 @@ else version (FreeBSD)
         ubyte *_base;
         int _size;
     }
-
-    union __mbstate_t // <sys/_types.h>
-    {
-        char[128]   _mbstate8;
-        long        _mbstateL;
-    }
 }
 else version (NetBSD)
 {
@@ -228,12 +222,6 @@ else version (NetBSD)
         ubyte *_base;
         int _size;
     }
-
-    union __mbstate_t // <sys/_types.h>
-    {
-        char[128]   _mbstate8;
-        long        _mbstateL;
-    }
 }
 else version (OpenBSD)
 {
@@ -258,12 +246,6 @@ else version (OpenBSD)
         ubyte *_base;
         int _size;
     }
-
-    union __mbstate_t // <sys/_types.h>
-    {
-        char[128]   __mbstate8;
-        long        __mbstateL;
-    }
 }
 else version (DragonFlyBSD)
 {
@@ -297,12 +279,6 @@ else version (DragonFlyBSD)
         SBUF_DYNSTRUCT  = 0x00080000,   // sbuf must be freed
         SBUF_INSECTION  = 0x00100000,   // set by sbuf_start_section()
     }
-
-    union __mbstate_t                   // <sys/stdint.h>
-    {
-        char[128]   _mbstate8;
-        long        _mbstateL;
-    }
 }
 else version (Solaris)
 {
@@ -518,6 +494,9 @@ else version (Darwin)
 }
 else version (FreeBSD)
 {
+    // Need to import wchar_ now since __mbstate_t now resides there
+    import core.stdc.wchar_ : mbstate_t;
+
     ///
     alias off_t fpos_t;
 
@@ -554,7 +533,7 @@ else version (FreeBSD)
         pthread_t       _fl_owner;
         int             _fl_count;
         int             _orientation;
-        __mbstate_t     _mbstate;
+        mbstate_t       _mbstate;
     }
 
     ///
@@ -664,10 +643,7 @@ else version (DragonFlyBSD)
 }
 else version (Solaris)
 {
-    import core.stdc.wchar_ : __mbstate_t;
-
-    ///
-    alias mbstate_t = __mbstate_t;
+    import core.stdc.wchar_ : mbstate_t;
 
     ///
     alias c_long fpos_t;
index 3bdaf824b8041efb38d2a7afb4d551b2b2c5259b..05c3ad862bc09f1df80a7f11a1a915902ae6fabb 100644 (file)
@@ -43,13 +43,52 @@ version (CRuntime_Glibc)
         ___value __value;
     }
 }
+else version (FreeBSD)
+{
+    ///
+    union __mbstate_t // <sys/_types.h>
+    {
+        char[128]   _mbstate8 = 0;
+        long        _mbstateL;
+    }
+
+    ///
+    alias mbstate_t = __mbstate_t;
+}
+else version (NetBSD)
+{
+    ///
+    union __mbstate_t
+    {
+        int64_t   __mbstateL;
+        char[128] __mbstate8;
+    }
+
+    ///
+    alias mbstate_t = __mbstate_t;
+}
 else version (OpenBSD)
 {
+    ///
     union __mbstate_t
     {
         char[128] __mbstate8;
         int64_t   __mbstateL;
     }
+
+    ///
+    alias mbstate_t = __mbstate_t;
+}
+else version (DragonFlyBSD)
+{
+    ///
+    union __mbstate_t                   // <sys/stdint.h>
+    {
+        char[128]   _mbstate8 = 0;
+        long        _mbstateL;
+    }
+
+    ///
     alias mbstate_t = __mbstate_t;
 }
 else version (Solaris)
@@ -66,6 +105,9 @@ else version (Solaris)
             int[6] __filler;
         }
     }
+
+    ///
+    alias mbstate_t = __mbstate_t;
 }
 else version (CRuntime_UClibc)
 {
index e56b5f58c680de7ff377d268125444164547e6d6..88eb94bf20e3634c942ff48cbb66829af2a05d26 100644 (file)
@@ -103,7 +103,7 @@ static if (__BSD_VISIBLE)
     //void*    fdlopen(int, int);
     int      dladdr(const(void)*, Dl_info*);
     //dlfunc_t dlfunc(void*, const(char)*);
-    //int      dlinfo(void*, int, void*);
+    int      dlinfo(void*, int, void*);
     /+void     dllockinit(void* _context,
         void* function(void* _context) _lock_create,
         void  function(void* _lock)    _rlock_acquire,