target.mk: improve handling of default enabled SECCOMP
[openwrt/openwrt.git] / package / libs / elfutils / patches / 100-musl-compat.patch
index f8e9a29235edb266eb8d0a0f783bd07117c14869..3fa095bd74dc2e54e971df7958cf0cad727c37fe 100644 (file)
@@ -1,39 +1,6 @@
-https://sourceware.org/bugzilla/show_bug.cgi?id=21002
-
---- a/lib/system.h
-+++ b/lib/system.h
-@@ -30,7 +30,16 @@
- #define LIB_SYSTEM_H  1
- #include <errno.h>
--#include <error.h>
-+#ifdef HAVE_ERROR_H
-+#include "error.h"
-+#else
-+#include "err.h"
-+#include <stdio.h>
-+#define error(status, errno, ...) \
-+      fflush(stdout); \
-+      warn(__VA_ARGS__); \
-+      if (status) exit(status)
-+#endif
- #include <stddef.h>
- #include <stdint.h>
- #include <sys/param.h>
-@@ -38,6 +47,10 @@
- #include <byteswap.h>
- #include <unistd.h>
-+#ifndef __GLIBC__
-+#define canonicalize_file_name(name) realpath(name,NULL)
-+#endif
-+
- #if __BYTE_ORDER == __LITTLE_ENDIAN
- # define LE32(n)      (n)
- # define LE64(n)      (n)
 --- a/libdw/libdw_alloc.c
 +++ b/libdw/libdw_alloc.c
-@@ -73,5 +73,5 @@ __attribute ((noreturn)) attribute_hidde
+@@ -152,5 +152,5 @@ __attribute ((noreturn)) attribute_hidde
  __libdw_oom (void)
  {
    while (1)
@@ -42,21 +9,21 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002
  }
 --- a/libdwfl/dwfl_error.c
 +++ b/libdwfl/dwfl_error.c
-@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
- const char *
dwfl_errmsg (int error)
+@@ -139,6 +139,7 @@ __libdwfl_seterrno (Dwfl_Error error)
static const char *
errnomsg(int error)
  {
-+  static __thread char s[64] = "";
-   if (error == 0 || error == -1)
-     {
-       int last_error = global_error;
-@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
-   switch (error &~ 0xffff)
-     {
-     case OTHER_ERROR (ERRNO):
--      return strerror_r (error & 0xffff, "bad", 0);
-+      strerror_r (error & 0xffff, s, sizeof(s));
-+      return s;
-     case OTHER_ERROR (LIBELF):
-       return elf_errmsg (error & 0xffff);
-     case OTHER_ERROR (LIBDW):
++#if defined(__GLIBC__) && !defined(__UCLIBC__)
+   /* Won't be changed by strerror_r, but not const so compiler doesn't throw warning */
+   static char unknown[] = "unknown error";
+@@ -149,6 +150,9 @@ errnomsg(int error)
+   static __thread char msg[128];
+   return strerror_r (error, msg, sizeof (msg)) ? unknown : msg;
+ #endif
++#else
++  return strerror (error & 0xffff);
++#endif
+ }
+ const char *