diff options
| -rw-r--r-- | meta/recipes-devtools/debugedit/debugedit_5.0.bb | 4 | ||||
| -rw-r--r-- | meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch | 102 |
2 files changed, 2 insertions, 104 deletions
diff --git a/meta/recipes-devtools/debugedit/debugedit_5.0.bb b/meta/recipes-devtools/debugedit/debugedit_5.0.bb index 257238fa24..63ad7babd9 100644 --- a/meta/recipes-devtools/debugedit/debugedit_5.0.bb +++ b/meta/recipes-devtools/debugedit/debugedit_5.0.bb | |||
| @@ -11,8 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ | |||
| 11 | 11 | ||
| 12 | SRC_URI = "https://sourceware.org/ftp/debugedit/${PV}/debugedit-${PV}.tar.xz" | 12 | SRC_URI = "https://sourceware.org/ftp/debugedit/${PV}/debugedit-${PV}.tar.xz" |
| 13 | 13 | ||
| 14 | SRC_URI:append:libc-musl = " \ | 14 | SRC_URI:append:libc-musl = "\ |
| 15 | file://0001-tools-Add-error.h-for-non-glibc-case.patch \ | ||
| 16 | file://0002-sepdebugcrcfix.c-do-not-use-64bit-variants.patch \ | 15 | file://0002-sepdebugcrcfix.c-do-not-use-64bit-variants.patch \ |
| 17 | file://0003-Makefile.am-do-not-update-manual.patch \ | 16 | file://0003-Makefile.am-do-not-update-manual.patch \ |
| 18 | " | 17 | " |
| @@ -20,6 +19,7 @@ SRC_URI:append:libc-musl = " \ | |||
| 20 | SRC_URI[sha256sum] = "e9ecd7d350bebae1f178ce6776ca19a648b6fe8fa22f5b3044b38d7899aa553e" | 19 | SRC_URI[sha256sum] = "e9ecd7d350bebae1f178ce6776ca19a648b6fe8fa22f5b3044b38d7899aa553e" |
| 21 | 20 | ||
| 22 | DEPENDS = "elfutils" | 21 | DEPENDS = "elfutils" |
| 22 | DEPENDS:append:libc-musl = " musl-legacy-error" | ||
| 23 | 23 | ||
| 24 | inherit pkgconfig autotools | 24 | inherit pkgconfig autotools |
| 25 | 25 | ||
diff --git a/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch b/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch deleted file mode 100644 index f6d64cb4e7..0000000000 --- a/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch +++ /dev/null | |||
| @@ -1,102 +0,0 @@ | |||
| 1 | From 4c797d3b559ba51bd9ccd9a2036245819acce843 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
| 3 | Date: Thu, 23 Mar 2023 10:54:21 +0800 | ||
| 4 | Subject: [PATCH] tools: Add error.h for non-glibc case | ||
| 5 | |||
| 6 | error is glibc specific API, so this patch will mostly not accepted | ||
| 7 | upstream given that elfutils has been closely tied to glibc | ||
| 8 | |||
| 9 | This is a OE specific workaround for musl. | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [OE Specific] | ||
| 12 | |||
| 13 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 14 | --- | ||
| 15 | tools/debugedit.c | 7 ++++++- | ||
| 16 | tools/error.h | 27 +++++++++++++++++++++++++++ | ||
| 17 | tools/sepdebugcrcfix.c | 7 ++++++- | ||
| 18 | 3 files changed, 39 insertions(+), 2 deletions(-) | ||
| 19 | create mode 100644 tools/error.h | ||
| 20 | |||
| 21 | diff --git a/tools/debugedit.c b/tools/debugedit.c | ||
| 22 | index 668777a..a72c3c0 100644 | ||
| 23 | --- a/tools/debugedit.c | ||
| 24 | +++ b/tools/debugedit.c | ||
| 25 | @@ -25,7 +25,6 @@ | ||
| 26 | #include <byteswap.h> | ||
| 27 | #include <endian.h> | ||
| 28 | #include <errno.h> | ||
| 29 | -#include <error.h> | ||
| 30 | #include <limits.h> | ||
| 31 | #include <string.h> | ||
| 32 | #include <stdlib.h> | ||
| 33 | @@ -40,6 +39,12 @@ | ||
| 34 | #include <gelf.h> | ||
| 35 | #include <dwarf.h> | ||
| 36 | |||
| 37 | +#ifdef __GLIBC__ | ||
| 38 | +#include <error.h> | ||
| 39 | +#else | ||
| 40 | +#include "error.h" | ||
| 41 | +#endif | ||
| 42 | + | ||
| 43 | #ifndef MAX | ||
| 44 | #define MAX(m, n) ((m) < (n) ? (n) : (m)) | ||
| 45 | #endif | ||
| 46 | diff --git a/tools/error.h b/tools/error.h | ||
| 47 | new file mode 100644 | ||
| 48 | index 0000000..9b24418 | ||
| 49 | --- /dev/null | ||
| 50 | +++ b/tools/error.h | ||
| 51 | @@ -0,0 +1,27 @@ | ||
| 52 | +#ifndef _ERROR_H_ | ||
| 53 | +#define _ERROR_H_ | ||
| 54 | + | ||
| 55 | +#include <stdarg.h> | ||
| 56 | +#include <stdio.h> | ||
| 57 | +#include <stdlib.h> | ||
| 58 | +#include <string.h> | ||
| 59 | +#include <errno.h> | ||
| 60 | + | ||
| 61 | +static unsigned int error_message_count = 0; | ||
| 62 | + | ||
| 63 | +static inline void error(int status, int errnum, const char* format, ...) | ||
| 64 | +{ | ||
| 65 | + va_list ap; | ||
| 66 | + fprintf(stderr, "%s: ", program_invocation_name); | ||
| 67 | + va_start(ap, format); | ||
| 68 | + vfprintf(stderr, format, ap); | ||
| 69 | + va_end(ap); | ||
| 70 | + if (errnum) | ||
| 71 | + fprintf(stderr, ": %s", strerror(errnum)); | ||
| 72 | + fprintf(stderr, "\n"); | ||
| 73 | + error_message_count++; | ||
| 74 | + if (status) | ||
| 75 | + exit(status); | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +#endif /* _ERROR_H_ */ | ||
| 79 | diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c | ||
| 80 | index da50e6c..c4a9d56 100644 | ||
| 81 | --- a/tools/sepdebugcrcfix.c | ||
| 82 | +++ b/tools/sepdebugcrcfix.c | ||
| 83 | @@ -29,10 +29,15 @@ | ||
| 84 | #include <endian.h> | ||
| 85 | #include <stdio.h> | ||
| 86 | #include <stdlib.h> | ||
| 87 | -#include <error.h> | ||
| 88 | #include <libelf.h> | ||
| 89 | #include <gelf.h> | ||
| 90 | |||
| 91 | +#ifdef __GLIBC__ | ||
| 92 | +#include <error.h> | ||
| 93 | +#else | ||
| 94 | +#include "error.h" | ||
| 95 | +#endif | ||
| 96 | + | ||
| 97 | #ifndef _ | ||
| 98 | #define _(x) x | ||
| 99 | #endif | ||
| 100 | -- | ||
| 101 | 2.17.1 | ||
| 102 | |||
