summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2023-03-23 16:11:15 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-27 15:44:02 +0100
commit4ffcbe98e82c73c543aa46105413de2586aa1cee (patch)
treef57162b00c9e866d491e6e8324f1a46fa89f7cfa /meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch
parenta94ca827c2066b22c746003f5144b89d28b13a1a (diff)
downloadpoky-4ffcbe98e82c73c543aa46105413de2586aa1cee.tar.gz
debugedit: add recipe
This recipe provides find-debuginfo which is used by rpm, more specifically rpmbuild. RPM upstream removed find-debuginfo and switched to use debugedit in the following commit. https://github.com/rpm-software-management/rpm/commit/04b0805a756cdd9466fb9dc717846f5bf15518cc Without debugedit, rpmbuild fails to generate debuginfo package when %debug_package is added to spec file. (From OE-Core rev: f7ada8b4d003473abce5b589cc38aec1e5e5f18a) Signed-off-by: Chen Qi <Qi.Chen@windriver.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/files/0001-tools-Add-error.h-for-non-glibc-case.patch')
-rw-r--r--meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch102
1 files changed, 102 insertions, 0 deletions
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
new file mode 100644
index 0000000000..f6d64cb4e7
--- /dev/null
+++ b/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch
@@ -0,0 +1,102 @@
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