openwrt/package/libs/elfutils/patches/100-musl-compat.patch
Rosen Penev d27623b542 elfutils: update to 0.179
Removed sys/cdefs usage. The header is deprecated.

Removed canonicalize_file_name define. It's already fixed upstream.

Added --disable-debuginfod. Seems to be needed.

Modified patch 005 to build more stuff. It was failing before. It still
only builds libraries.

Modified patch 100 to use strerror under non-glibc. It is used under
glibc as strerror is not thread safe. It is under musl and uClibc-ng.
strerror_l is not available under uClibc-ng.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-13 22:40:19 +02:00

48 lines
1.1 KiB
Diff

https://sourceware.org/bugzilla/show_bug.cgi?id=21002
--- a/lib/system.h
+++ b/lib/system.h
@@ -30,7 +30,18 @@
#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, ...) \
+ do { \
+ fflush(stdout); \
+ warn(__VA_ARGS__); \
+ if (status) exit(status); \
+ } while(0)
+#endif
#include <stddef.h>
#include <stdint.h>
#include <sys/param.h>
--- a/libdw/libdw_alloc.c
+++ b/libdw/libdw_alloc.c
@@ -147,5 +147,5 @@ __attribute ((noreturn)) attribute_hidde
__libdw_oom (void)
{
while (1)
- error (EXIT_FAILURE, ENOMEM, "libdw");
+ error (EXIT_FAILURE, errno, gettext ("cannot allocate memory"));
}
--- a/libdwfl/dwfl_error.c
+++ b/libdwfl/dwfl_error.c
@@ -154,7 +154,11 @@ dwfl_errmsg (int error)
switch (error &~ 0xffff)
{
case OTHER_ERROR (ERRNO):
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
return strerror_r (error & 0xffff, "bad", 0);
+#else
+ return strerror (error & 0xffff);
+#endif
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):