hppa: Add libphobos support

Message ID 03dec752-9f7c-cfc3-ceec-71b35bff0f5c@bell.net
State New
Headers show
Series
  • hppa: Add libphobos support
Related show

Commit Message

John David Anglin Dec. 9, 2018, 8:15 p.m.
The attached change implements a first cut at libphobos support on
hppa/glibc/linux.  Test
results are here:
<https://gcc.gnu.org/ml/gcc-testresults/2018-12/msg00778.html>.

Okay?

Dave

-- 
John David Anglin  dave.anglin@bell.net
2018-12-09  John David Anglin  <danglin@gcc.gnu.org>

	* configure.tgt: Add hppa*-*-linux* target.
	* libdruntime/core/stdc/errno.d: Define for hppa/glibc/linux.
	* libdruntime/core/stdc/fenv.d: Likewise.
	* libdruntime/core/stdc/math.d: Likewise.
	* libdruntime/core/sys/linux/dlfcn.d: Likewise.
	* libdruntime/core/sys/linux/epoll.d: Likewise.
	* libdruntime/core/sys/linux/link.d: Likewise.
	* libdruntime/core/sys/linux/sys/eventfd.d: Likewise.
	* libdruntime/core/sys/linux/sys/inotify.d: Likewise.
	* libdruntime/core/sys/posix/dlfcn.d: Likewise.
	* libdruntime/core/sys/posix/fcntl.d: Likewise.
	* libdruntime/core/sys/posix/setjmp.d: Likewise.
	* libdruntime/core/sys/posix/signal.d: Likewise.
	* libdruntime/core/sys/posix/sys/socket.d: Likewise.
	* libdruntime/core/sys/posix/sys/stat.d: Likewise.
	* libdruntime/core/sys/posix/sys/types.d: Likewise.
	* libdruntime/core/sys/posix/ucontext.d: Likewise.
	* libdruntime/rt/sections_elf_shared.d: Likewise.
	* src/std/experimental/allocator/building_blocks/region.d: Likewise.
	* src/std/math.d: Likewise.

Comments

Iain Buclaw Dec. 9, 2018, 11:10 p.m. | #1
On Sun, 9 Dec 2018 at 21:16, John David Anglin <dave.anglin@bell.net> wrote:
>

> The attached change implements a first cut at libphobos support on

> hppa/glibc/linux.  Test

> results are here:

> <https://gcc.gnu.org/ml/gcc-testresults/2018-12/msg00778.html>.

>

> Okay?

>


From what I can see, everything is properly scoped and looks valid (no
accidental C-style syntax anywhere).  Looking at the test results,
seems like nothing runs, which may not be entirely unexpected from a
new port, but I would have expected a little better.  I've just tried
building a cross-compiler and running some small programs under qemu,
but it seems that nothing works under emulation, not even C programs.

Would you mind if I send this to the upstream druntime first?
Repository is here https://github.com/dlang/druntime

-- 
Iain
John David Anglin Dec. 10, 2018, 1:28 p.m. | #2
On 2018-12-09 6:10 p.m., Iain Buclaw wrote:
> On Sun, 9 Dec 2018 at 21:16, John David Anglin <dave.anglin@bell.net> wrote:

>> The attached change implements a first cut at libphobos support on

>> hppa/glibc/linux.  Test

>> results are here:

>> <https://gcc.gnu.org/ml/gcc-testresults/2018-12/msg00778.html>.

>>

>> Okay?

>>

> >From what I can see, everything is properly scoped and looks valid (no

> accidental C-style syntax anywhere).  Looking at the test results,

> seems like nothing runs, which may not be entirely unexpected from a

> new port, but I would have expected a little better.

I see about 10% fails for gdc (27700 passes, 2641 fails).  For
libphobos, I see 242 passes and 46 fails.

I haven't had a chance to debug any of the fails.  The stack grows up on
hppa.  This is one big difference
from all other ports.  I also was a bit unsure about the setjmp
implementation.

> I've just tried

> building a cross-compiler and running some small programs under qemu,

> but it seems that nothing works under emulation, not even C programs.

I added Helge Deller to Cc.  He has worked on qemu for hppa.
> Would you mind if I send this to the upstream druntime first?

> Repository is here https://github.com/dlang/druntime

No problem.  Go ahead.

Dave

-- 
John David Anglin  dave.anglin@bell.net

Patch

Index: configure.tgt
===================================================================
--- configure.tgt	(revision 266930)
+++ configure.tgt	(working copy)
@@ -24,6 +24,8 @@ 
 case "${target}" in
   arm*-*-linux*)
 	;;
+  hppa*-*-linux*)
+	;;
   mips*-*-linux*)
 	;;
   x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
Index: libdruntime/core/stdc/errno.d
===================================================================
--- libdruntime/core/stdc/errno.d	(revision 266930)
+++ libdruntime/core/stdc/errno.d	(working copy)
@@ -25,6 +25,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -421,6 +422,112 @@ 
         enum ERFKILL            = 132;        ///
         enum EHWPOISON          = 133;        ///
     }
+    else version (HPPA_Any)
+    {
+        enum ENOMSG             = 35;         ///
+        enum EIDRM              = 36;         ///
+        enum ECHRNG             = 37;         ///
+        enum EL2NSYNC           = 38;         ///
+        enum EL3HLT             = 39;         ///
+        enum EL3RST             = 40;         ///
+        enum ELNRNG             = 41;         ///
+        enum EUNATCH            = 42;         ///
+        enum ENOCSI             = 43;         ///
+        enum EL2HLT             = 44;         ///
+        enum EDEADLK            = 45;         ///
+        enum EDEADLOCK          = EDEADLK;    ///
+        enum ENOLCK             = 46;         ///
+        enum EILSEQ             = 47;         ///
+        enum ENONET             = 50;         ///
+        enum ENODATA            = 51;         ///
+        enum ETIME              = 52;         ///
+        enum ENOSR              = 53;         ///
+        enum ENOSTR             = 54;         ///
+        enum ENOPKG             = 55;         ///
+        enum ENOLINK            = 57;         ///
+        enum EADV               = 58;         ///
+        enum ESRMNT             = 59;         ///
+        enum ECOMM              = 60;         ///
+        enum EPROTO             = 61;         ///
+        enum EMULTIHOP          = 64;         ///
+        enum EDOTDOT            = 66;         ///
+        enum EBADMSG            = 67;         ///
+        enum EUSERS             = 68;         ///
+        enum EDQUOT             = 69;         ///
+        enum ESTALE             = 70;         ///
+        enum EREMOTE            = 71;         ///
+        enum EOVERFLOW          = 72;         ///
+        enum EBADE              = 160;        ///
+        enum EBADR              = 161;        ///
+        enum EXFULL             = 162;        ///
+        enum ENOANO             = 163;        ///
+        enum EBADRQC            = 164;        ///
+        enum EBADSLT            = 165;        ///
+        enum EBFONT             = 166;        ///
+        enum ENOTUNIQ           = 167;        ///
+        enum EBADFD             = 168;        ///
+        enum EREMCHG            = 169;        ///
+        enum ELIBACC            = 170;        ///
+        enum ELIBBAD            = 171;        ///
+        enum ELIBSCN            = 172;        ///
+        enum ELIBMAX            = 173;        ///
+        enum ELIBEXEC           = 174;        ///
+        enum ERESTART           = 175;        ///
+        enum ESTRPIPE           = 176;        ///
+        enum EUCLEAN            = 177;        ///
+        enum ENOTNAM            = 178;        ///
+        enum ENAVAIL            = 179;        ///
+        enum EISNAM             = 180;        ///
+        enum EREMOTEIO          = 181;        ///
+        enum ENOMEDIUM          = 182;        ///
+        enum EMEDIUMTYPE        = 183;        ///
+        enum ENOKEY             = 184;        ///
+        enum EKEYEXPIRED        = 185;        ///
+        enum EKEYREVOKED        = 186;        ///
+        enum EKEYREJECTED       = 187;        ///
+        enum ENOSYM             = 215;        ///
+        enum ENOTSOCK           = 216;        ///
+        enum EDESTADDRREQ       = 217;        ///
+        enum EMSGSIZE           = 218;        ///
+        enum EPROTOTYPE         = 219;        ///
+        enum ENOPROTOOPT        = 220;        ///
+        enum EPROTONOSUPPORT    = 221;        ///
+        enum ESOCKTNOSUPPORT    = 221;        ///
+        enum EOPNOTSUPP         = 223;        ///
+        enum EPFNOSUPPORT       = 224;        ///
+        enum EAFNOSUPPORT       = 225;        ///
+        enum EADDRINUSE         = 226;        ///
+        enum EADDRNOTAVAIL      = 227;        ///
+        enum ENETDOWN           = 228;        ///
+        enum ENETUNREACH        = 229;        ///
+        enum ENETRESET          = 230;        ///
+        enum ECONNABORTED       = 231;        ///
+        enum ECONNRESET         = 232;        ///
+        enum ENOBUFS            = 233;        ///
+        enum EISCONN            = 234;        ///
+        enum ENOTCONN           = 235;        ///
+        enum ESHUTDOWN          = 236;        ///
+        enum ETOOMANYREFS       = 237;        ///
+        enum ETIMEDOUT          = 238;        ///
+        enum ECONNREFUSED       = 239;        ///
+        enum EREFUSED           = ECONNREFUSED; ///
+        enum EREMOTERELEASE     = 240;        ///
+        enum EHOSTDOWN          = 241;        ///
+        enum EHOSTUNREACH       = 242;        ///
+        enum EALREADY           = 244;        ///
+        enum EINPROGRESS        = 245;        ///
+        enum EWOULDBLOCK        = EAGAIN;     ///
+        enum ENOTEMPTY          = 247;        ///
+        enum ENAMETOOLONG       = 248;        ///
+        enum ELOOP              = 249;        ///
+        enum ENOSYS             = 251;        ///
+        enum ECANCELLED         = 253;        ///
+        enum ECANCELED          = ECANCELLED;  ///
+        enum EOWNERDEAD         = 254;        ///
+        enum ENOTRECOVERABLE    = 255;        ///
+        enum ERFKILL            = 256;        ///
+        enum EHWPOISON          = 257;        ///
+    }
     else version (MIPS_Any)
     {
         enum ENOMSG             = 35;         ///
Index: libdruntime/core/stdc/fenv.d
===================================================================
--- libdruntime/core/stdc/fenv.d	(revision 266930)
+++ libdruntime/core/stdc/fenv.d	(working copy)
@@ -30,6 +30,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -93,6 +94,17 @@ 
 
         alias fexcept_t = ushort;
     }
+    // https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/hppa/bits/fenv.h
+    else version (HPPA_Any)
+    {
+        struct fenv_t
+        {
+	    uint    __status_word;
+	    uint[7] __exception;
+        }
+
+        alias fexcept_t = uint;
+    }
     // https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mips/bits/fenv.h
     else version (MIPS_Any)
     {
@@ -527,6 +539,28 @@ 
             FE_TOWARDZERO   = 0xC00000, ///
         }
     }
+    else version (HPPA_Any)
+    {
+        // Define bits representing the exception.
+        enum
+        {
+            FE_INEXACT      = 0x01, ///
+            FE_UNDERFLOW    = 0x02, ///
+            FE_OVERFLOW     = 0x04, ///
+            FE_DIVBYZERO    = 0x08, ///
+            FE_INVALID      = 0x10, ///
+            FE_ALL_EXCEPT   = 0x1F, ///
+        }
+
+        // The HPPA FPU supports all of the four defined rounding modes.
+        enum
+        {
+            FE_TONEAREST    =   0x0, ///
+            FE_TOWARDZERO   = 0x200, ///
+            FE_UPWARD       = 0x400, ///
+            FE_DOWNWARD     = 0x600, ///
+        }
+    }
     else version (MIPS_Any)
     {
         // Define bits representing the exception.
Index: libdruntime/core/stdc/math.d
===================================================================
--- libdruntime/core/stdc/math.d	(revision 266930)
+++ libdruntime/core/stdc/math.d	(working copy)
@@ -26,6 +26,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -147,6 +148,13 @@ 
         ///
         enum int FP_ILOGBNAN      = int.max;
     }
+    else version (HPPA_Any)
+    {
+        ///
+        enum int FP_ILOGB0        = -int.max;
+        ///
+        enum int FP_ILOGBNAN      = int.max;
+    }
     else version (MIPS_Any)
     {
         ///
Index: libdruntime/core/sys/linux/dlfcn.d
===================================================================
--- libdruntime/core/sys/linux/dlfcn.d	(revision 266930)
+++ libdruntime/core/sys/linux/dlfcn.d	(working copy)
@@ -12,6 +12,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -53,6 +54,30 @@ 
         void _dl_mcount_wrapper_check(void* __selfpc);
     }
 }
+else version (HPPA_Any)
+{
+    // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/hppa/bits/dlfcn.h
+    // enum RTLD_LAZY = 0x0001; // POSIX
+    // enum RTLD_NOW = 0x0002; // POSIX
+    enum RTLD_BINDING_MASK = 0x3;
+    enum RTLD_NOLOAD = 0x00004;
+    enum RTLD_DEEPBIND = 0x00008;
+
+    // enum RTLD_GLOBAL = 0x0004; // POSIX
+    // enum RTLD_LOCAL = 0; // POSIX
+    enum RTLD_NODELETE = 0x01000;
+
+    static if (__USE_GNU)
+    {
+        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
+        {
+            _dl_mcount_wrapper_check(cast(void*)fctp);
+            return fctp(args);
+        }
+
+        void _dl_mcount_wrapper_check(void* __selfpc);
+    }
+}
 else version (MIPS_Any)
 {
     // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/mips/bits/dlfcn.h
Index: libdruntime/core/sys/linux/epoll.d
===================================================================
--- libdruntime/core/sys/linux/epoll.d	(revision 266930)
+++ libdruntime/core/sys/linux/epoll.d	(working copy)
@@ -17,6 +17,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -86,6 +87,14 @@ 
         epoll_data_t data;
     }
 }
+else version (HPPA_Any)
+{
+    struct epoll_event
+    {
+        uint events;
+        epoll_data_t data;
+    }
+}
 else version (MIPS_Any)
 {
     struct epoll_event
Index: libdruntime/core/sys/linux/link.d
===================================================================
--- libdruntime/core/sys/linux/link.d	(revision 266930)
+++ libdruntime/core/sys/linux/link.d	(working copy)
@@ -11,6 +11,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -34,6 +35,12 @@ 
     alias __WORDSIZE __ELF_NATIVE_CLASS;
     alias uint32_t Elf_Symndx;
 }
+else version (HPPA_Any)
+{
+    // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
+    alias __WORDSIZE __ELF_NATIVE_CLASS;
+    alias uint32_t Elf_Symndx;
+}
 else version (MIPS_Any)
 {
     // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
Index: libdruntime/core/sys/linux/sys/eventfd.d
===================================================================
--- libdruntime/core/sys/linux/sys/eventfd.d	(revision 266930)
+++ libdruntime/core/sys/linux/sys/eventfd.d	(working copy)
@@ -14,6 +14,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -48,6 +49,12 @@ 
     enum EFD_CLOEXEC = 0x80000; // octal!2000000
     enum EFD_NONBLOCK = 0x800; // octal!4000
 }
+else version (HPPA_Any)
+{
+    enum EFD_SEMAPHORE = 1;
+    enum EFD_CLOEXEC = 0x200000; // octal!10000000
+    enum EFD_NONBLOCK = 0x10004; // octal!00200004
+}
 else version (MIPS_Any)
 {
     enum EFD_SEMAPHORE = 1;
Index: libdruntime/core/sys/linux/sys/inotify.d
===================================================================
--- libdruntime/core/sys/linux/sys/inotify.d	(revision 266930)
+++ libdruntime/core/sys/linux/sys/inotify.d	(working copy)
@@ -13,6 +13,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -73,6 +74,11 @@ 
     enum IN_CLOEXEC = 0x80000; // octal!2000000
     enum IN_NONBLOCK = 0x800; // octal!4000
 }
+else version (HPPA_Any)
+{
+    enum IN_CLOEXEC = 0x200000; // octal!10000000
+    enum IN_NONBLOCK = 0x10004; // octal!200004
+}
 else version (MIPS_Any)
 {
     enum IN_CLOEXEC = 0x80000; // octal!2000000
Index: libdruntime/core/sys/posix/dlfcn.d
===================================================================
--- libdruntime/core/sys/posix/dlfcn.d	(revision 266930)
+++ libdruntime/core/sys/posix/dlfcn.d	(working copy)
@@ -27,6 +27,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -69,6 +70,13 @@ 
         enum RTLD_GLOBAL    = 0x00100;
         enum RTLD_LOCAL     = 0x00000;
     }
+    else version (HPPA_Any)
+    {
+        enum RTLD_LAZY      = 0x0001;
+        enum RTLD_NOW       = 0x0002;
+        enum RTLD_GLOBAL    = 0x0100;
+        enum RTLD_LOCAL     = 0;
+    }
     else version (MIPS_Any)
     {
         enum RTLD_LAZY      = 0x0001;
Index: libdruntime/core/sys/posix/fcntl.d
===================================================================
--- libdruntime/core/sys/posix/fcntl.d	(revision 266930)
+++ libdruntime/core/sys/posix/fcntl.d	(working copy)
@@ -30,6 +30,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -154,6 +155,19 @@ 
         enum O_DSYNC        = 0x1000;   // octal   010000
         enum O_RSYNC        = O_SYNC;
     }
+    else version (HPPA_Any)
+    {
+        enum O_CREAT        = 0x00100;  // octal    04000
+        enum O_EXCL         = 0x00400;  // octal     0200
+        enum O_NOCTTY       = 0x20000;  // octal     0400
+        enum O_TRUNC        = 0x00200;  // octal    01000
+
+        enum O_APPEND       = 0x00008;  // octal      010
+        enum O_NONBLOCK     = 0x10004;  // octal  0200004
+        enum O_SYNC         = 0x48000;  // octal 01100000
+        enum O_DSYNC        = 0x40000;  // octal 01000000
+        enum O_RSYNC        = 0x80000;  // octal 02000000
+    }
     else version (MIPS_Any)
     {
         enum O_CREAT        = 0x0100;
Index: libdruntime/core/sys/posix/setjmp.d
===================================================================
--- libdruntime/core/sys/posix/setjmp.d	(revision 266930)
+++ libdruntime/core/sys/posix/setjmp.d	(working copy)
@@ -77,6 +77,20 @@ 
     {
         alias int[64] __jmp_buf;
     }
+    else version (HPPA)
+    {
+        struct __jmp_buf
+        {
+	    int __r3;
+	    int[15] __r4_r18;
+	    int __r19;
+	    int __r27;
+	    int __sp;
+	    int __rp;
+	    int __pad1;
+	    double[10] __fr12_fr21;
+	}
+    }
     else version (PPC)
     {
         alias int[64 + (12*4)] __jmp_buf;
Index: libdruntime/core/sys/posix/signal.d
===================================================================
--- libdruntime/core/sys/posix/signal.d	(revision 266930)
+++ libdruntime/core/sys/posix/signal.d	(working copy)
@@ -27,6 +27,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -258,6 +259,30 @@ 
         enum SIGUSR2    = 12;
         enum SIGURG     = 23;
     }
+    else version (HPPA_Any)
+    {
+	//SIGABRT (defined in core.stdc.signal)
+	enum SIGALRM    = 14;
+	enum SIGBUS     = 10;
+	enum SIGCHLD    = 18;
+	enum SIGCONT    = 26;
+	//SIGFPE (defined in core.stdc.signal)
+	enum SIGHUP     = 1;
+	//SIGILL (defined in core.stdc.signal)
+	//SIGINT (defined in core.stdc.signal)
+	enum SIGKILL    = 9;
+	enum SIGPIPE    = 13;
+	enum SIGQUIT    = 3;
+	//SIGSEGV (defined in core.stdc.signal)
+	enum SIGSTOP    = 24;
+	//SIGTERM (defined in core.stdc.signal)
+	enum SIGTSTP    = 25;
+	enum SIGTTIN    = 27;
+	enum SIGTTOU    = 28;
+	enum SIGUSR1    = 16;
+	enum SIGUSR2    = 17;
+	enum SIGURG     = 29;
+    }
     else version (MIPS_Any)
     {
         //SIGABRT (defined in core.stdc.signal)
@@ -2015,6 +2040,16 @@ 
         enum SIGXCPU        = 24;
         enum SIGXFSZ        = 25;
     }
+    else version (HPPA_Any)
+    {
+	enum SIGPOLL    = 22;
+	enum SIGPROF    = 21;
+	enum SIGSYS     = 31;
+	enum SIGTRAP    = 5;
+	enum SIGVTALRM  = 20;
+	enum SIGXCPU    = 12;
+	enum SIGXFSZ    = 30;
+    }
     else version (MIPS_Any)
     {
         enum SIGPOLL    = 22;
Index: libdruntime/core/sys/posix/sys/socket.d
===================================================================
--- libdruntime/core/sys/posix/sys/socket.d	(revision 266930)
+++ libdruntime/core/sys/posix/sys/socket.d	(working copy)
@@ -29,6 +29,7 @@ 
 
 version (ARM)     version = ARM_Any;
 version (AArch64) version = ARM_Any;
+version (HPPA)    version = HPPA_Any;
 version (MIPS32)  version = MIPS_Any;
 version (MIPS64)  version = MIPS_Any;
 version (PPC)     version = PPC_Any;
@@ -290,6 +291,40 @@ 
             SO_TYPE         = 3
         }
     }
+    else version (HPPA_Any)
+    {
+        enum
+        {
+            SOCK_DGRAM      = 2,
+            SOCK_SEQPACKET  = 5,
+            SOCK_STREAM     = 1,
+        }
+
+        enum
+        {
+            SOL_SOCKET      = 0xffff
+        }
+
+        enum
+        {
+            SO_ACCEPTCONN   = 0x401c,
+            SO_BROADCAST    = 0x0020,
+            SO_DEBUG        = 0x0001,
+            SO_DONTROUTE    = 0x0010,
+            SO_ERROR        = 0x1007,
+            SO_KEEPALIVE    = 0x0008,
+            SO_LINGER       = 0x0080,
+            SO_OOBINLINE    = 0x0100,
+            SO_RCVBUF       = 0x1002,
+            SO_RCVLOWAT     = 0x1004,
+            SO_RCVTIMEO     = 0x1006,
+            SO_REUSEADDR    = 0x0004,
+            SO_SNDBUF       = 0x1001,
+            SO_SNDLOWAT     = 0x1003,
+            SO_SNDTIMEO     = 0x1005,
+            SO_TYPE         = 0x1008,
+        }
+    }
     else version (MIPS_Any)
     {
         enum
Index: libdruntime/core/sys/posix/sys/stat.d
===================================================================
--- libdruntime/core/sys/posix/sys/stat.d	(revision 266930)
+++ libdruntime/core/sys/posix/sys/stat.d	(working copy)
@@ -186,6 +186,101 @@ 
             slong_t[3]     __unused;
         }
     }
+    else version (HPPA)
+    {
+        private
+        {
+            alias __dev_t = ulong;
+            alias __ino_t = c_ulong;
+            alias __ino64_t = ulong;
+            alias __mode_t = uint;
+            alias __nlink_t = size_t;
+            alias __uid_t = uint;
+            alias __gid_t = uint;
+            alias __off_t = c_long;
+            alias __off64_t = long;
+            alias __blksize_t = c_long;
+            alias __blkcnt_t = c_long;
+            alias __blkcnt64_t = long;
+            alias __timespec = timespec;
+            alias __time_t = time_t;
+        }
+        struct stat_t
+        {
+            __dev_t st_dev;
+            ushort __pad1;
+
+            static if (!__USE_FILE_OFFSET64)
+            {
+                __ino_t st_ino;
+            }
+            else
+            {
+                __ino_t __st_ino;
+            }
+            __mode_t st_mode;
+            __nlink_t st_nlink;
+            __uid_t st_uid;
+            __gid_t st_gid;
+            __dev_t st_rdev;
+            ushort __pad2;
+
+            static if (!__USE_FILE_OFFSET64)
+            {
+                __off_t st_size;
+            }
+            else
+            {
+                __off64_t st_size;
+            }
+            __blksize_t st_blksize;
+
+            static if (!__USE_FILE_OFFSET64)
+            {
+                __blkcnt_t st_blocks;
+            }
+            else
+            {
+                __blkcnt64_t st_blocks;
+            }
+
+            static if ( __USE_MISC || __USE_XOPEN2K8)
+            {
+                __timespec st_atim;
+                __timespec st_mtim;
+                __timespec st_ctim;
+                extern(D)
+                {
+                    @property ref time_t st_atime() { return st_atim.tv_sec; }
+                    @property ref time_t st_mtime() { return st_mtim.tv_sec; }
+                    @property ref time_t st_ctime() { return st_ctim.tv_sec; }
+                }
+            }
+            else
+            {
+                __time_t st_atime;
+                c_ulong st_atimensec;
+                __time_t st_mtime;
+                c_ulong st_mtimensec;
+                __time_t st_ctime;
+                c_ulong st_ctimensec;
+            }
+
+            static if (!__USE_FILE_OFFSET64)
+            {
+                c_ulong __unused4;
+                c_ulong __unused5;
+            }
+            else
+            {
+                __ino64_t st_ino;
+            }
+        }
+        static if (__USE_FILE_OFFSET64)
+            static assert(stat_t.sizeof == 104);
+        else
+            static assert(stat_t.sizeof == 88);
+    }
     else version (MIPS_O32)
     {
         struct stat_t
Index: libdruntime/core/sys/posix/sys/types.d
===================================================================
--- libdruntime/core/sys/posix/sys/types.d	(revision 266930)
+++ libdruntime/core/sys/posix/sys/types.d	(working copy)
@@ -545,6 +545,18 @@ 
         enum __SIZEOF_PTHREAD_BARRIER_T = 20;
         enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4;
     }
+    else version (HPPA)
+    {
+        enum __SIZEOF_PTHREAD_ATTR_T = 36;
+        enum __SIZEOF_PTHREAD_MUTEX_T = 48;
+        enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4;
+        enum __SIZEOF_PTHREAD_COND_T = 48;
+        enum __SIZEOF_PTHREAD_CONDATTR_T = 4;
+        enum __SIZEOF_PTHREAD_RWLOCK_T = 64;
+        enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8;
+        enum __SIZEOF_PTHREAD_BARRIER_T = 48;
+        enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4;
+    }
     else version (IA64)
     {
         enum __SIZEOF_PTHREAD_ATTR_T = 56;
Index: libdruntime/core/sys/posix/ucontext.d
===================================================================
--- libdruntime/core/sys/posix/ucontext.d	(revision 266930)
+++ libdruntime/core/sys/posix/ucontext.d	(working copy)
@@ -197,6 +197,48 @@ 
             _libc_fpstate   __fpregs_mem;
         }
     }
+    else version (HPPA)
+    {
+        private
+        {
+            enum NGREG  = 80;
+            enum NFPREG = 32;
+
+            alias c_ulong        greg_t;
+
+	    struct gregset_t
+	    {
+		greg_t[32] g_regs;
+		greg_t[8] sr_regs;
+		greg_t[24] cr_regs;
+		greg_t[16] g_pad;
+	    }
+
+            struct fpregset_t
+            {
+                double[32] fpregs;
+            }
+        }
+
+        struct mcontext_t
+        {
+	    greg_t sc_flags;
+	    greg_t[32] sc_gr;
+	    fpregset_t sc_fr;
+	    greg_t[2] sc_iasq;
+	    greg_t[2] sc_iaoq;
+	    greg_t sc_sar;
+        }
+
+        struct ucontext_t
+        {
+            c_ulong     uc_flags;
+            ucontext_t* uc_link;
+            stack_t     uc_stack;
+	    mcontext_t uc_mcontext;
+            sigset_t    uc_sigmask;
+        }
+    }
     else version (MIPS32)
     {
         private
Index: libdruntime/rt/sections_elf_shared.d
===================================================================
--- libdruntime/rt/sections_elf_shared.d	(revision 266930)
+++ libdruntime/rt/sections_elf_shared.d	(working copy)
@@ -979,6 +979,8 @@ 
     enum TLS_DTV_OFFSET = 0x800;
 else version (RISCV64)
     enum TLS_DTV_OFFSET = 0x800;
+else version (HPPA)
+    enum TLS_DTV_OFFSET = 0x;
 else version (SPARC)
     enum TLS_DTV_OFFSET = 0x0;
 else version (SPARC64)
Index: src/std/experimental/allocator/building_blocks/region.d
===================================================================
--- src/std/experimental/allocator/building_blocks/region.d	(revision 266930)
+++ src/std/experimental/allocator/building_blocks/region.d	(working copy)
@@ -387,6 +387,7 @@ 
     else version (X86_64) enum growDownwards = Yes.growDownwards;
     else version (ARM) enum growDownwards = Yes.growDownwards;
     else version (AArch64) enum growDownwards = Yes.growDownwards;
+    else version (HPPA) enum growDownwards = No.growDownwards;
     else version (PPC) enum growDownwards = Yes.growDownwards;
     else version (PPC64) enum growDownwards = Yes.growDownwards;
     else version (MIPS32) enum growDownwards = Yes.growDownwards;
Index: src/std/math.d
===================================================================
--- src/std/math.d	(revision 266930)
+++ src/std/math.d	(working copy)
@@ -5132,6 +5132,21 @@ 
                                  | inexactException | subnormalException,
         }
     }
+    else version (HPPA)
+    {
+        enum : ExceptionMask
+        {
+            inexactException      = 0x01,
+            underflowException    = 0x02,
+            overflowException     = 0x04,
+            divByZeroException    = 0x08,
+            invalidException      = 0x10,
+            severeExceptions   = overflowException | divByZeroException
+                                 | invalidException,
+            allExceptions      = severeExceptions | underflowException
+                                 | inexactException,
+        }
+    }
     else version (MIPS_Any)
     {
         enum : ExceptionMask
@@ -5284,6 +5299,10 @@ 
     {
         alias ControlState = uint;
     }
+    else version (HPPA)
+    {
+        alias ControlState = uint;
+    }
     else version (PPC_Any)
     {
         alias ControlState = uint;