Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 1 | From 81da32c3404b58cbad7b3af00854e0cf2dc3dbf1 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Fri, 23 Aug 2019 10:19:48 +0800 |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 4 | Subject: [PATCH] musl-utils |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 5 | |
| 6 | Provide missing defines which otherwise are available on glibc system headers |
| 7 | |
| 8 | Alter the error API to match posix version |
| 9 | use qsort instead of qsort_r which is glibc specific API |
| 10 | |
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 12 | Upstream-Status: Inappropriate [workaround for musl] |
| 13 | |
| 14 | Rebase to 0.177 |
| 15 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 16 | |
| 17 | --- |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 18 | 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | |
| 24 | diff --git a/src/arlib.h b/src/arlib.h |
| 25 | index 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; |
| 41 | diff --git a/src/elfcompress.c b/src/elfcompress.c |
Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 42 | index 92f2fac..0b037a5 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 43 | --- 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 59 | diff --git a/src/strip.c b/src/strip.c |
Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 60 | index 30a1f9d..e89a7f0 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 61 | --- 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. */ |
| 77 | diff --git a/src/unstrip.c b/src/unstrip.c |
Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 78 | index 3472637..40c73f3 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 79 | --- a/src/unstrip.c |
| 80 | +++ b/src/unstrip.c |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 81 | @@ -52,6 +52,15 @@ |
| 82 | #include "libeu.h" |
| 83 | #include "printversion.h" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 84 | |
| 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 | |