################################################################################
# Global flags
################################################################################
-LIBNEWLIBC_CFLAGS-y += -DMISSING_SYSCALL_NAMES -DMALLOC_PROVIDED
+LIBNEWLIB_GLOBAL_FLAGS-y += -DMISSING_SYSCALL_NAMES -DMALLOC_PROVIDED
+LIBNEWLIB_GLOBAL_FLAGS-y += -D_POSIX_REALTIME_SIGNALS
+
+CFLAGS-y += $(LIBNEWLIB_GLOBAL_FLAGS-y)
+CXXFLAGS-y += $(LIBNEWLIB_GLOBAL_FLAGS-y)
# Suppress some warnings to make the build process look neater
LIBNEWLIB_SUPPRESS_FLAGS-y += \
--- /dev/null
+From 7d668a38739f734ed1edc6aab925baf9f19f5ca4 Mon Sep 17 00:00:00 2001
+From: Costin Lupu <costin.lup@gmail.com>
+Date: Fri, 16 Aug 2019 20:19:14 +0200
+Subject: [PATCH] Add si_addr field for siginfo_t and use __rtems__
+ declarations
+
+Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
+---
+ newlib/libc/include/sys/signal.h | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
+index ab35718..f87ed6c 100644
+--- a/newlib/libc/include/sys/signal.h
++++ b/newlib/libc/include/sys/signal.h
+@@ -69,10 +69,27 @@ typedef struct {
+ int si_signo; /* Signal number */
+ int si_code; /* Cause of the signal */
+ union sigval si_value; /* Signal value */
++
++ union {
++ struct {
++ void *si_addr;
++ short si_addr_lsb;
++ union {
++ struct {
++ void *si_lower;
++ void *si_upper;
++ } __addr_bnd;
++ unsigned si_pkey;
++ } __first;
++ } __sigfault;
++ } __si_fields;
++
+ } siginfo_t;
++
++#define si_addr __si_fields.__sigfault.si_addr
+ #endif /* defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309 */
+
+-#if defined(__rtems__)
++#if defined(__rtems__) || defined(__Unikraft__)
+
+ /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
+
+--
+2.20.1
+
--- /dev/null
+From a73ec52fac6847dcb16a4aa458a11d33cf3cceb5 Mon Sep 17 00:00:00 2001
+From: Costin Lupu <costin.lup@gmail.com>
+Date: Sat, 17 Aug 2019 00:13:48 +0200
+Subject: [PATCH] Add forward declaration in order to avoid warnings because of
+ circular inclusion
+
+Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
+---
+ newlib/libc/include/time.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
+index 8806b98..32baed9 100644
+--- a/newlib/libc/include/time.h
++++ b/newlib/libc/include/time.h
+@@ -189,6 +189,7 @@ int _EXFUN(clock_getres, (clockid_t clock_id, struct timespec *res));
+
+ /* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
+
++struct sigevent;
+ int _EXFUN(timer_create,
+ (clockid_t clock_id,
+ struct sigevent *__restrict evp,
+--
+2.20.1
+