blob: 1c7cde6d7dd2f5a754593e02e54e23d80a7f64dd [file] [log] [blame]
Andrew Geisslerd5838332022-05-27 11:33:10 -05001From 81da32c3404b58cbad7b3af00854e0cf2dc3dbf1 Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 23 Aug 2019 10:19:48 +0800
Andrew Geissler475cb722020-07-10 16:00:51 -05004Subject: [PATCH] musl-utils
Andrew Geissler82c905d2020-04-13 13:39:40 -05005
6Provide missing defines which otherwise are available on glibc system headers
7
8Alter the error API to match posix version
9use qsort instead of qsort_r which is glibc specific API
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Upstream-Status: Inappropriate [workaround for musl]
13
14Rebase to 0.177
15Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
16
17---
Andrew Geissler90fd73c2021-03-05 15:25:55 -060018 src/arlib.h | 6 ++++++
19 src/elfcompress.c | 7 +++++++
20 src/strip.c | 7 +++++++
21 src/unstrip.c | 9 +++++++++
22 4 files changed, 29 insertions(+)
Andrew Geissler82c905d2020-04-13 13:39:40 -050023
24diff --git a/src/arlib.h b/src/arlib.h
25index e117166..8326f6c 100644
26--- a/src/arlib.h
27+++ b/src/arlib.h
28@@ -29,6 +29,12 @@
29 #include <stdint.h>
30 #include <sys/types.h>
31
32+#if !defined(ALLPERMS)
33+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
34+#endif
35+#if !defined(DEFFILEMODE)
36+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
37+#endif
38
39 /* State of -D/-U flags. */
40 extern bool arlib_deterministic_output;
41diff --git a/src/elfcompress.c b/src/elfcompress.c
Andrew Geisslerd5838332022-05-27 11:33:10 -050042index 92f2fac..0b037a5 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050043--- a/src/elfcompress.c
44+++ b/src/elfcompress.c
45@@ -37,6 +37,13 @@
46 #include "libeu.h"
47 #include "printversion.h"
48
49+#if !defined(ALLPERMS)
50+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
51+#endif
52+#if !defined(FNM_EXTMATCH)
53+# define FNM_EXTMATCH (0)
54+#endif
55+
56 /* Name and version of program. */
57 ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
58
Andrew Geissler82c905d2020-04-13 13:39:40 -050059diff --git a/src/strip.c b/src/strip.c
Andrew Geisslerd5838332022-05-27 11:33:10 -050060index 30a1f9d..e89a7f0 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050061--- a/src/strip.c
62+++ b/src/strip.c
63@@ -46,6 +46,13 @@
64 #include <system.h>
65 #include <printversion.h>
66
67+#if !defined(ACCESSPERMS)
68+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
69+#endif
70+#if !defined(FNM_EXTMATCH)
71+# define FNM_EXTMATCH (0)
72+#endif
73+
74 typedef uint8_t GElf_Byte;
75
76 /* Name and version of program. */
77diff --git a/src/unstrip.c b/src/unstrip.c
Andrew Geisslerd5838332022-05-27 11:33:10 -050078index 3472637..40c73f3 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050079--- a/src/unstrip.c
80+++ b/src/unstrip.c
Andrew Geissler90fd73c2021-03-05 15:25:55 -060081@@ -52,6 +52,15 @@
82 #include "libeu.h"
83 #include "printversion.h"
Andrew Geissler82c905d2020-04-13 13:39:40 -050084
85+#ifndef strndupa
86+#define strndupa(s, n) \
87+ ({const char *__in = (s); \
88+ size_t __len = strnlen (__in, (n)) + 1; \
89+ char *__out = (char *) alloca (__len); \
90+ __out[__len-1] = '\0'; \
91+ (char *) memcpy (__out, __in, __len-1);})
92+#endif
93+
94 /* Name and version of program. */
95 ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
96