1From 8b48c580bae0b0ffc773b0b829c50d33a907853c Mon Sep 17 00:00:00 2001 2From: Hongxu Jia <hongxu.jia@windriver.com> 3Date: Fri, 23 Aug 2019 10:19:48 +0800 4Subject: [PATCH] musl-utils 5 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--- 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(+) 23 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 42index 2c6d91b..608646e 100644 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 59diff --git a/src/strip.c b/src/strip.c 60index d5b753d..d6e1b64 100644 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. */ 77diff --git a/src/unstrip.c b/src/unstrip.c 78index aacc9aa..5e71290 100644 79--- a/src/unstrip.c 80+++ b/src/unstrip.c 81@@ -52,6 +52,15 @@ 82 #include "libeu.h" 83 #include "printversion.h" 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 97