--- libdw/libdw.h	2015-08-21 14:22:37.000000000 +0200
+++ libdw/libdw.h	2015-11-20 08:31:14.160067056 +0100
@@ -33,7 +33,27 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <unistd.h>
+#include <alloca.h>
+#include <string.h>
 
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+#endif
+
+#ifndef strndupa
+#define strndupa(s, n) \
+       (__extension__ ({const char *__in = (s); \
+                        size_t __len = strnlen (__in, (n)) + 1; \
+                        char *__out = (char *) alloca (__len); \
+                        __out[__len-1] = '\0'; \
+                        (char *) memcpy (__out, __in, __len-1);}))
+#endif
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
 # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
--- src/ld.h	2015-08-21 14:22:37.000000000 +0200
+++ src/ld.h	2015-11-20 07:58:05.722222192 +0100
@@ -24,6 +24,19 @@
 #include <stdio.h>
 #include "xelf.h"
 
+#if !defined(DL_CALL_FCT)
+# define DL_CALL_FCT(fctp, args) (*fctp) args
+#endif	/* !defined(DL_CALL_FCT) */
+
+#if !defined(ACCESSPERMS)
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+#if !defined(ALLPERMS)
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+#if !defined(DEFFILEMODE)
+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
+#endif
 
 /* Recommended size of the buffer passed to ld_strerror.  */
 #define ERRBUFSIZE	(512)
--- src/arlib.h	2015-08-21 14:22:37.000000000 +0200
+++ src/arlib.h	2015-11-20 08:02:55.153199611 +0100
@@ -29,6 +29,16 @@
 #include <stdint.h>
 #include <sys/types.h>
 
+#if !defined(ACCESSPERMS)
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+#if !defined(ALLPERMS)
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+#if !defined(DEFFILEMODE)
+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
+#endif
+
 
 /* State of -D/-U flags.  */
 extern bool arlib_deterministic_output;
