Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 1 | From aab5985a29bd7ab6e0b06eaab190b42a04e10f70 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> |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 16 | --- |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 17 | 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | |
| 23 | diff --git a/src/arlib.h b/src/arlib.h |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 24 | index d4a4221..f6336d9 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 25 | --- 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; |
| 40 | diff --git a/src/elfcompress.c b/src/elfcompress.c |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 41 | index f771b92..263de62 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 42 | --- 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 58 | diff --git a/src/strip.c b/src/strip.c |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 59 | index 6436443..1608496 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 60 | --- a/src/strip.c |
| 61 | +++ b/src/strip.c |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 62 | @@ -45,6 +45,13 @@ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 63 | #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. */ |
| 76 | diff --git a/src/unstrip.c b/src/unstrip.c |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 77 | index d70053d..b8a6ff3 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 78 | --- a/src/unstrip.c |
| 79 | +++ b/src/unstrip.c |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 80 | @@ -51,6 +51,15 @@ |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 81 | #include "libeu.h" |
| 82 | #include "printversion.h" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 83 | |
| 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 | |