blob: 2e379cdba65ed0bea4bc2cb7fab2205049b3e9d0 [file] [log] [blame]
Andrew Geissler09036742021-06-25 14:25:14 -05001From 2f94d488bf3daaa6a8548ee77120fc2506a9bbe3 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 Geissler09036742021-06-25 14:25:14 -050042index 2c6d91b..608646e 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 Geissler09036742021-06-25 14:25:14 -050060index 70fc8c0..d035d9e 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 Geissler09036742021-06-25 14:25:14 -050078index e488e81..0e44456 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