elfutils: update to 0.180
[openwrt/openwrt.git] / package / libs / elfutils / patches / 100-musl-compat.patch
1 https://sourceware.org/bugzilla/show_bug.cgi?id=21002
2
3 --- a/lib/system.h
4 +++ b/lib/system.h
5 @@ -30,7 +30,18 @@
6 #define LIB_SYSTEM_H 1
7
8 #include <errno.h>
9 -#include <error.h>
10 +#ifdef HAVE_ERROR_H
11 +#include "error.h"
12 +#else
13 +#include "err.h"
14 +#include <stdio.h>
15 +#define error(status, errno, ...) \
16 + do { \
17 + fflush(stdout); \
18 + warn(__VA_ARGS__); \
19 + if (status) exit(status); \
20 + } while(0)
21 +#endif
22 #include <stddef.h>
23 #include <stdint.h>
24 #include <sys/param.h>
25 --- a/libdw/libdw_alloc.c
26 +++ b/libdw/libdw_alloc.c
27 @@ -152,5 +152,5 @@ __attribute ((noreturn)) attribute_hidde
28 __libdw_oom (void)
29 {
30 while (1)
31 - error (EXIT_FAILURE, ENOMEM, "libdw");
32 + error (EXIT_FAILURE, errno, gettext ("cannot allocate memory"));
33 }
34 --- a/libdwfl/dwfl_error.c
35 +++ b/libdwfl/dwfl_error.c
36 @@ -154,7 +154,11 @@ dwfl_errmsg (int error)
37 switch (error &~ 0xffff)
38 {
39 case OTHER_ERROR (ERRNO):
40 +#if defined(__GLIBC__) && !defined(__UCLIBC__)
41 return strerror_r (error & 0xffff, "bad", 0);
42 +#else
43 + return strerror (error & 0xffff);
44 +#endif
45 case OTHER_ERROR (LIBELF):
46 return elf_errmsg (error & 0xffff);
47 case OTHER_ERROR (LIBDW):