blob: 230ea88f4180f683767b05d3428af784ccc09c3c [file] [log] [blame]
Patrick Williamsb58112e2024-03-07 11:16:36 -06001From aab5985a29bd7ab6e0b06eaab190b42a04e10f70 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>
Andrew Geissler82c905d2020-04-13 13:39:40 -050016---
Andrew Geissler90fd73c2021-03-05 15:25:55 -060017 src/arlib.h | 6 ++++++
18 src/elfcompress.c | 7 +++++++
19 src/strip.c | 7 +++++++
20 src/unstrip.c | 9 +++++++++
21 4 files changed, 29 insertions(+)
Andrew Geissler82c905d2020-04-13 13:39:40 -050022
23diff --git a/src/arlib.h b/src/arlib.h
Patrick Williamse760df82023-05-26 11:10:49 -050024index d4a4221..f6336d9 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050025--- a/src/arlib.h
26+++ b/src/arlib.h
27@@ -29,6 +29,12 @@
28 #include <stdint.h>
29 #include <sys/types.h>
30
31+#if !defined(ALLPERMS)
32+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
33+#endif
34+#if !defined(DEFFILEMODE)
35+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
36+#endif
37
38 /* State of -D/-U flags. */
39 extern bool arlib_deterministic_output;
40diff --git a/src/elfcompress.c b/src/elfcompress.c
Patrick Williamsb58112e2024-03-07 11:16:36 -060041index f771b92..263de62 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050042--- a/src/elfcompress.c
43+++ b/src/elfcompress.c
44@@ -37,6 +37,13 @@
45 #include "libeu.h"
46 #include "printversion.h"
47
48+#if !defined(ALLPERMS)
49+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
50+#endif
51+#if !defined(FNM_EXTMATCH)
52+# define FNM_EXTMATCH (0)
53+#endif
54+
55 /* Name and version of program. */
56 ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
57
Andrew Geissler82c905d2020-04-13 13:39:40 -050058diff --git a/src/strip.c b/src/strip.c
Patrick Williamsb58112e2024-03-07 11:16:36 -060059index 6436443..1608496 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050060--- a/src/strip.c
61+++ b/src/strip.c
Patrick Williamse760df82023-05-26 11:10:49 -050062@@ -45,6 +45,13 @@
Andrew Geissler82c905d2020-04-13 13:39:40 -050063 #include <system.h>
64 #include <printversion.h>
65
66+#if !defined(ACCESSPERMS)
67+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
68+#endif
69+#if !defined(FNM_EXTMATCH)
70+# define FNM_EXTMATCH (0)
71+#endif
72+
73 typedef uint8_t GElf_Byte;
74
75 /* Name and version of program. */
76diff --git a/src/unstrip.c b/src/unstrip.c
Patrick Williamsb58112e2024-03-07 11:16:36 -060077index d70053d..b8a6ff3 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050078--- a/src/unstrip.c
79+++ b/src/unstrip.c
Patrick Williamse760df82023-05-26 11:10:49 -050080@@ -51,6 +51,15 @@
Andrew Geissler90fd73c2021-03-05 15:25:55 -060081 #include "libeu.h"
82 #include "printversion.h"
Andrew Geissler82c905d2020-04-13 13:39:40 -050083
84+#ifndef strndupa
85+#define strndupa(s, n) \
86+ ({const char *__in = (s); \
87+ size_t __len = strnlen (__in, (n)) + 1; \
88+ char *__out = (char *) alloca (__len); \
89+ __out[__len-1] = '\0'; \
90+ (char *) memcpy (__out, __in, __len-1);})
91+#endif
92+
93 /* Name and version of program. */
94 ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
95