summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/debugedit
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-09-22 14:05:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-26 10:35:28 +0100
commitfc6b2a989b6c4fabca2bfb7ee5e9727cf950994f (patch)
tree742ecb94c26a4d030f59ebe2b9337302e37b7dd4 /meta/recipes-devtools/debugedit
parentbb89cec62e48fc527b85403811769c7700e33ec9 (diff)
downloadpoky-fc6b2a989b6c4fabca2bfb7ee5e9727cf950994f.tar.gz
debugedit: Use musl-legacy-error
Use error.h to provide GNU extentions for error API Drop the patch trying to do something about it (From OE-Core rev: b621363ab52669afc2915544b5686cc4fe455d5e) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/debugedit')
-rw-r--r--meta/recipes-devtools/debugedit/debugedit_5.0.bb4
-rw-r--r--meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch102
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
12SRC_URI = "https://sourceware.org/ftp/debugedit/${PV}/debugedit-${PV}.tar.xz" 12SRC_URI = "https://sourceware.org/ftp/debugedit/${PV}/debugedit-${PV}.tar.xz"
13 13
14SRC_URI:append:libc-musl = " \ 14SRC_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 = " \
20SRC_URI[sha256sum] = "e9ecd7d350bebae1f178ce6776ca19a648b6fe8fa22f5b3044b38d7899aa553e" 19SRC_URI[sha256sum] = "e9ecd7d350bebae1f178ce6776ca19a648b6fe8fa22f5b3044b38d7899aa553e"
21 20
22DEPENDS = "elfutils" 21DEPENDS = "elfutils"
22DEPENDS:append:libc-musl = " musl-legacy-error"
23 23
24inherit pkgconfig autotools 24inherit 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 @@
1From 4c797d3b559ba51bd9ccd9a2036245819acce843 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Thu, 23 Mar 2023 10:54:21 +0800
4Subject: [PATCH] tools: Add error.h for non-glibc case
5
6error is glibc specific API, so this patch will mostly not accepted
7upstream given that elfutils has been closely tied to glibc
8
9This is a OE specific workaround for musl.
10
11Upstream-Status: Inappropriate [OE Specific]
12
13Signed-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
21diff --git a/tools/debugedit.c b/tools/debugedit.c
22index 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
46diff --git a/tools/error.h b/tools/error.h
47new file mode 100644
48index 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_ */
79diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c
80index 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--
1012.17.1
102