[libphobos] Committed hppa-linux-gnu bindings

Message ID CABOHX+cWwQwidqVi4hnWT_OVU7xAWoVX520+Hc5T-v67cCVcrQ@mail.gmail.com
State New
Headers show
Series
  • [libphobos] Committed hppa-linux-gnu bindings
Related show

Commit Message

Iain Buclaw Jan. 18, 2019, 12:49 a.m.
Hi,

This patch adds one part of libphobos support for hppa-linux-gnu, as
posted by John.  Apologies for it taking a while to get round to
downstreaming this.

Preliminary testsuite runs have been done which show some promising
results, but still a little more to do, particularly with handling the
stack growth direction.

Bootstrapped and regression tested on x86_64-linux-gnu, which only
verifies that all scoping is correct.

Committed to trunk as r268055.

-- 
Iain
---

Patch

diff --git a/libphobos/libdruntime/core/stdc/errno.d b/libphobos/libdruntime/core/stdc/errno.d
index eaf4867a942..03c88d79cb8 100644
--- a/libphobos/libdruntime/core/stdc/errno.d
+++ b/libphobos/libdruntime/core/stdc/errno.d
@@ -25,6 +25,7 @@  else version (WatchOS)
 
 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 @@  else version (linux)
         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;         ///
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index abfdcde5330..d4abc12f502 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -30,6 +30,7 @@  nothrow:
 
 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 @@  version (GNUFP)
 
         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)
     {
@@ -575,6 +587,28 @@  else
             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.
diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index b121f050747..e93f8533342 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -26,6 +26,7 @@  else version (WatchOS)
 
 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 @@  else version (CRuntime_Glibc)
         ///
         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)
     {
         ///
diff --git a/libphobos/libdruntime/core/sys/linux/dlfcn.d b/libphobos/libdruntime/core/sys/linux/dlfcn.d
index 4f0e66201fb..f2decc2b3ec 100644
--- a/libphobos/libdruntime/core/sys/linux/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/linux/dlfcn.d
@@ -12,6 +12,7 @@  nothrow:
 
 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 @@  version (X86_Any)
         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
diff --git a/libphobos/libdruntime/core/sys/linux/epoll.d b/libphobos/libdruntime/core/sys/linux/epoll.d
index c6ee2204815..5b4431a066c 100644
--- a/libphobos/libdruntime/core/sys/linux/epoll.d
+++ b/libphobos/libdruntime/core/sys/linux/epoll.d
@@ -17,6 +17,7 @@  nothrow:
 
 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 @@  else version (PPC_Any)
         epoll_data_t data;
     }
 }
+else version (HPPA_Any)
+{
+    struct epoll_event
+    {
+        uint events;
+        epoll_data_t data;
+    }
+}
 else version (MIPS_Any)
 {
     struct epoll_event
diff --git a/libphobos/libdruntime/core/sys/linux/link.d b/libphobos/libdruntime/core/sys/linux/link.d
index 3587ead8d85..b57b5e5d00f 100644
--- a/libphobos/libdruntime/core/sys/linux/link.d
+++ b/libphobos/libdruntime/core/sys/linux/link.d
@@ -11,6 +11,7 @@  nothrow:
 
 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 @@  version (X86_Any)
     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
diff --git a/libphobos/libdruntime/core/sys/linux/sys/eventfd.d b/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
index 83e78964763..7fdd693d815 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
@@ -14,6 +14,7 @@  nothrow:
 
 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 @@  version (X86_Any)
     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;
diff --git a/libphobos/libdruntime/core/sys/linux/sys/inotify.d b/libphobos/libdruntime/core/sys/linux/sys/inotify.d
index 39d69a27727..67545a80cd6 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/inotify.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/inotify.d
@@ -13,6 +13,7 @@  nothrow:
 
 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 @@  version (X86_Any)
     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
diff --git a/libphobos/libdruntime/core/sys/posix/dlfcn.d b/libphobos/libdruntime/core/sys/posix/dlfcn.d
index 2378a331f8a..f36669dd0b3 100644
--- a/libphobos/libdruntime/core/sys/posix/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/posix/dlfcn.d
@@ -27,6 +27,7 @@  else version (WatchOS)
 
 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 @@  version (CRuntime_Glibc)
         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;
diff --git a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
index 8f563ef9420..817790ab7eb 100644
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d
@@ -30,6 +30,7 @@  else version (WatchOS)
 
 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 @@  version (CRuntime_Glibc)
         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;
diff --git a/libphobos/libdruntime/core/sys/posix/setjmp.d b/libphobos/libdruntime/core/sys/posix/setjmp.d
index e8a3d1fdd02..9028dbc65fc 100644
--- a/libphobos/libdruntime/core/sys/posix/setjmp.d
+++ b/libphobos/libdruntime/core/sys/posix/setjmp.d
@@ -77,6 +77,20 @@  version (CRuntime_Glibc)
     {
         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;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index 1ddcba91049..68739dd7892 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -27,6 +27,7 @@  else version (WatchOS)
 
 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 @@  version (linux)
         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 @@  version (CRuntime_Glibc)
         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;
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
index 3489a4aec26..6a3f708ed81 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
@@ -29,6 +29,7 @@  else version (WatchOS)
 
 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 @@  version (CRuntime_Glibc)
             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
diff --git a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
index 512f48a1505..8c78ba677a4 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d
@@ -186,6 +186,101 @@  version (CRuntime_Glibc)
             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
diff --git a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
index 185f5661527..53c78735bb7 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d
@@ -545,6 +545,18 @@  version (CRuntime_Glibc)
         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;
diff --git a/libphobos/libdruntime/core/sys/posix/ucontext.d b/libphobos/libdruntime/core/sys/posix/ucontext.d
index 9e7d6436e7e..0a341e50ada 100644
--- a/libphobos/libdruntime/core/sys/posix/ucontext.d
+++ b/libphobos/libdruntime/core/sys/posix/ucontext.d
@@ -197,6 +197,48 @@  version (CRuntime_Glibc)
             _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
diff --git a/libphobos/libdruntime/rt/sections_elf_shared.d b/libphobos/libdruntime/rt/sections_elf_shared.d
index b392eb1aff9..3d4d75d025c 100644
--- a/libphobos/libdruntime/rt/sections_elf_shared.d
+++ b/libphobos/libdruntime/rt/sections_elf_shared.d
@@ -979,6 +979,8 @@  else version (RISCV32)
     enum TLS_DTV_OFFSET = 0x800;
 else version (RISCV64)
     enum TLS_DTV_OFFSET = 0x800;
+else version (HPPA)
+    enum TLS_DTV_OFFSET = 0x0;
 else version (SPARC)
     enum TLS_DTV_OFFSET = 0x0;
 else version (SPARC64)