Skip to content

Commit 5168983

Browse files
committed
libphobos: Support GNU/Hurd.
1 parent 9932752 commit 5168983

7 files changed

Lines changed: 34 additions & 5 deletions

File tree

libphobos/configure.tgt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ case "${target}" in
8585
x86_64-*-linux* | i?86-*-linux*)
8686
LIBPHOBOS_SUPPORTED=yes
8787
;;
88+
x86_64-*-gnu* | i?86-*-gnu*)
89+
LIBPHOBOS_SUPPORTED=yes
90+
;;
8891
x86_64-*-netbsd* | i?86-*-netbsd*)
8992
LIBPHOBOS_SUPPORTED=yes
9093
;;

libphobos/libdruntime/Makefile.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ ALL_DRUNTIME_INSTALL_DSOURCES = $(DRUNTIME_DSOURCES) \
3939
$(DRUNTIME_DSOURCES_LINUX) $(DRUNTIME_DSOURCES_NETBSD) \
4040
$(DRUNTIME_DSOURCES_OPENBSD) $(DRUNTIME_DSOURCES_POSIX) \
4141
$(DRUNTIME_DSOURCES_SOLARIS) $(DRUNTIME_DSOURCES_WINDOWS) \
42+
$(DRUNTIME_DSOURCES_HURD) \
4243
$(DRUNTIME_DSOURCES_GENERATED) $(DRUNTIME_DISOURCES) \
4344
$(DRUNTIME_DSOURCES_ELF) $(DRUNTIME_DSOURCES_STDCXX)
4445

@@ -77,6 +78,9 @@ endif
7778
if DRUNTIME_OS_SOLARIS
7879
DRUNTIME_SOURCES_CONFIGURED += $(DRUNTIME_DSOURCES_SOLARIS)
7980
endif
81+
if DRUNTIME_OS_HURD
82+
DRUNTIME_SOURCES_CONFIGURED += $(DRUNTIME_DSOURCES_HURD)
83+
endif
8084
# CPU specific sources
8185
if DRUNTIME_CPU_AARCH64
8286
DRUNTIME_SOURCES_CONFIGURED += config/aarch64/switchcontext.S
@@ -361,6 +365,12 @@ DRUNTIME_DSOURCES_SOLARIS = core/sys/solaris/dlfcn.d \
361365
core/sys/solaris/sys/regset.d core/sys/solaris/sys/types.d \
362366
core/sys/solaris/thread.d core/sys/solaris/time.d
363367

368+
DRUNTIME_DSOURCES_HURD = core/sys/hurd/config.d \
369+
core/sys/hurd/dlfcn.d core/sys/hurd/elf.d \
370+
core/sys/hurd/errno.d core/sys/hurd/execinfo.d \
371+
core/sys/hurd/link.d core/sys/hurd/sys/types.d \
372+
core/sys/hurd/time.d core/sys/hurd/unistd.d
373+
364374
DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \
365375
core/sys/windows/aclapi.d core/sys/windows/aclui.d \
366376
core/sys/windows/basetsd.d core/sys/windows/basetyps.d \

libphobos/libdruntime/config/common/threadasm.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ a copy of the GCC Runtime Library Exception along with this program;
2222
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
2323
<http://www.gnu.org/licenses/>. */
2424

25-
#if (__linux__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__) && __ELF__
25+
#if (__linux__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ || __GNU__) && __ELF__
2626
/*
2727
* Mark the resulting object file as not requiring execution permissions on
2828
* stack memory. The absence of this section would mark the whole resulting

libphobos/libdruntime/config/x86/switchcontext.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ CSYM(fiber_switchContext):
108108

109109
# endif /* defined(__ELF__) */
110110

111-
# if defined(__MACH__)
111+
# if defined(__APPLE__)
112112

113113
# if defined(__i386__)
114114

@@ -177,7 +177,7 @@ LASFDE1:
177177
.p2align 2,0
178178
LEFDE1:
179179

180-
# endif /* defined(__MACH__) && defined(__i386__) */
180+
# endif /* defined(__APPLE__) && defined(__i386__) */
181181

182182
# if defined(__x86_64__) && !defined(__ILP32__)
183183

@@ -247,8 +247,8 @@ LASFDE1:
247247
.p2align 3,0
248248
LEFDE1:
249249

250-
# endif /* defined(__MACH__) && defined(__x86_64__) && !defined(__ILP32__) */
250+
# endif /* defined(__APPLE__) && defined(__x86_64__) && !defined(__ILP32__) */
251251

252-
# endif /* defined (__MACH__) */
252+
# endif /* defined(__APPLE__) */
253253

254254
#endif /* !defined(__CET__) */

libphobos/libdruntime/gcc/backtrace.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ private:
408408
import core.sys.openbsd.dlfcn;
409409
else version (Solaris)
410410
import core.sys.solaris.dlfcn;
411+
else version (Hurd)
412+
import core.sys.hurd.dlfcn;
411413
else version (Posix)
412414
import core.sys.posix.dlfcn;
413415

libphobos/libdruntime/gcc/sections/elf.d

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ else version (Solaris)
8282
import core.sys.solaris.sys.elf;
8383
import core.sys.solaris.sys.link;
8484
}
85+
else version (Hurd)
86+
{
87+
import core.sys.hurd.dlfcn;
88+
import core.sys.hurd.elf;
89+
import core.sys.hurd.link;
90+
}
8591
else
8692
{
8793
static assert(0, "unimplemented");
@@ -777,6 +783,8 @@ version (Shared)
777783
strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
778784
else version (Solaris)
779785
strtab = cast(const(char)*)(info.dlpi_addr + dyn.d_un.d_ptr); // relocate
786+
else version (Hurd)
787+
strtab = cast(const(char)*)(dyn.d_un.d_ptr);
780788
else
781789
static assert(0, "unimplemented");
782790
break;
@@ -912,6 +920,7 @@ bool findDSOInfoForAddr(in void* addr, dl_phdr_info* result=null) nothrow @nogc
912920
else version (NetBSD) enum IterateManually = true;
913921
else version (OpenBSD) enum IterateManually = true;
914922
else version (Solaris) enum IterateManually = true;
923+
else version (Hurd) enum IterateManually = true;
915924
else enum IterateManually = false;
916925

917926
static if (IterateManually)

libphobos/m4/druntime/os.m4

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ AC_DEFUN([DRUNTIME_OS_SOURCES],
8989
mingw*) druntime_target_os_parsed="mingw"
9090
;;
9191
*solaris*) druntime_target_os_parsed="solaris"
92+
;;
93+
gnu*) druntime_target_os_parsed="hurd"
94+
;;
9295
esac
9396
AM_CONDITIONAL([DRUNTIME_OS_AIX],
9497
[test "$druntime_target_os_parsed" = "aix"])
@@ -110,6 +113,8 @@ AC_DEFUN([DRUNTIME_OS_SOURCES],
110113
[test "$druntime_target_os_parsed" = "mingw"])
111114
AM_CONDITIONAL([DRUNTIME_OS_SOLARIS],
112115
[test "$druntime_target_os_parsed" = "solaris"])
116+
AM_CONDITIONAL([DRUNTIME_OS_HURD],
117+
[test "$druntime_target_os_parsed" = "hurd"])
113118
114119
druntime_target_posix="no"
115120
case "$druntime_cv_target_os" in

0 commit comments

Comments
 (0)