diff options
| author | Khem Raj <raj.khem@gmail.com> | 2019-07-20 11:00:57 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-07-23 22:26:28 +0100 |
| commit | d5b73bdb45c906cfbcfc395d191537a0a7b4ff38 (patch) | |
| tree | 8a151075dd66ccbf6b48480bd004fb5dc9c53b56 /meta/recipes-devtools/elfutils/files/musl-libs.patch | |
| parent | 002c33a38f87c19bd68d58d936a8d822bcf484f8 (diff) | |
| download | poky-d5b73bdb45c906cfbcfc395d191537a0a7b4ff38.tar.gz | |
elfutils: Fix eu-* utils builds for musl
Re-organize the musl patches in three different areas namely
libs, utils and tests, this will help maintain them in future
version bumps
Add obstack dependency on musl targets which is needed for eu-*
PN and PN-binutils is not empty anymore on musl
(From OE-Core rev: a747239978e63f22d4107e6e12c75b5f78043cce)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/elfutils/files/musl-libs.patch')
| -rw-r--r-- | meta/recipes-devtools/elfutils/files/musl-libs.patch | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/files/musl-libs.patch b/meta/recipes-devtools/elfutils/files/musl-libs.patch new file mode 100644 index 0000000000..51ca630ef8 --- /dev/null +++ b/meta/recipes-devtools/elfutils/files/musl-libs.patch | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | Collection of fixes needed to compile libelf and other libraries | ||
| 2 | provided by elfutils for musl targets | ||
| 3 | |||
| 4 | error is glibc specific API, so this patch will mostly not accepted | ||
| 5 | upstream given that elfutils has been closely tied to glibc | ||
| 6 | |||
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 8 | Upstream-Status: Inappropriate [workaround for musl] | ||
| 9 | |||
| 10 | --- /dev/null | ||
| 11 | +++ b/lib/error.h | ||
| 12 | @@ -0,0 +1,27 @@ | ||
| 13 | +#ifndef _ERROR_H_ | ||
| 14 | +#define _ERROR_H_ | ||
| 15 | + | ||
| 16 | +#include <stdarg.h> | ||
| 17 | +#include <stdio.h> | ||
| 18 | +#include <stdlib.h> | ||
| 19 | +#include <string.h> | ||
| 20 | +#include <errno.h> | ||
| 21 | + | ||
| 22 | +static unsigned int error_message_count = 0; | ||
| 23 | + | ||
| 24 | +static inline void error(int status, int errnum, const char* format, ...) | ||
| 25 | +{ | ||
| 26 | + va_list ap; | ||
| 27 | + fprintf(stderr, "%s: ", program_invocation_name); | ||
| 28 | + va_start(ap, format); | ||
| 29 | + vfprintf(stderr, format, ap); | ||
| 30 | + va_end(ap); | ||
| 31 | + if (errnum) | ||
| 32 | + fprintf(stderr, ": %s", strerror(errnum)); | ||
| 33 | + fprintf(stderr, "\n"); | ||
| 34 | + error_message_count++; | ||
| 35 | + if (status) | ||
| 36 | + exit(status); | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +#endif /* _ERROR_H_ */ | ||
| 40 | --- a/lib/fixedsizehash.h | ||
| 41 | +++ b/lib/fixedsizehash.h | ||
| 42 | @@ -30,7 +30,6 @@ | ||
| 43 | #include <errno.h> | ||
| 44 | #include <stdlib.h> | ||
| 45 | #include <string.h> | ||
| 46 | -#include <sys/cdefs.h> | ||
| 47 | |||
| 48 | #include <system.h> | ||
| 49 | |||
| 50 | --- a/lib/libeu.h | ||
| 51 | +++ b/lib/libeu.h | ||
| 52 | @@ -29,6 +29,7 @@ | ||
| 53 | #ifndef LIBEU_H | ||
| 54 | #define LIBEU_H | ||
| 55 | |||
| 56 | +#include "system.h" | ||
| 57 | #include <stddef.h> | ||
| 58 | #include <stdint.h> | ||
| 59 | |||
| 60 | --- a/libdwfl/dwfl_error.c | ||
| 61 | +++ b/libdwfl/dwfl_error.c | ||
| 62 | @@ -154,7 +154,16 @@ dwfl_errmsg (int error) | ||
| 63 | switch (error &~ 0xffff) | ||
| 64 | { | ||
| 65 | case OTHER_ERROR (ERRNO): | ||
| 66 | +#if defined(__GLIBC__) | ||
| 67 | return strerror_r (error & 0xffff, "bad", 0); | ||
| 68 | +#else | ||
| 69 | + { | ||
| 70 | + static __thread char buf[128] = ""; | ||
| 71 | + if (strerror_r (error & 0xffff, buf, sizeof(buf)) == 0) | ||
| 72 | + return buf; | ||
| 73 | + } | ||
| 74 | + return "strerror_r() failed"; | ||
| 75 | +#endif | ||
| 76 | case OTHER_ERROR (LIBELF): | ||
| 77 | return elf_errmsg (error & 0xffff); | ||
| 78 | case OTHER_ERROR (LIBDW): | ||
| 79 | --- a/libdwfl/linux-kernel-modules.c | ||
| 80 | +++ b/libdwfl/linux-kernel-modules.c | ||
| 81 | @@ -50,6 +50,7 @@ | ||
| 82 | #include <sys/utsname.h> | ||
| 83 | #include <fcntl.h> | ||
| 84 | #include <unistd.h> | ||
| 85 | +#include "system.h" | ||
| 86 | |||
| 87 | /* If fts.h is included before config.h, its indirect inclusions may not | ||
| 88 | give us the right LFS aliases of these functions, so map them manually. */ | ||
| 89 | --- a/libelf/elf.h | ||
| 90 | +++ b/libelf/elf.h | ||
| 91 | @@ -21,7 +21,9 @@ | ||
| 92 | |||
| 93 | #include <features.h> | ||
| 94 | |||
| 95 | -__BEGIN_DECLS | ||
| 96 | +#ifdef __cplusplus | ||
| 97 | +extern "C" { | ||
| 98 | +#endif | ||
| 99 | |||
| 100 | /* Standard ELF types. */ | ||
| 101 | |||
| 102 | @@ -3937,6 +3939,7 @@ enum | ||
| 103 | #define R_METAG_TLS_LE_HI16 60 | ||
| 104 | #define R_METAG_TLS_LE_LO16 61 | ||
| 105 | |||
| 106 | -__END_DECLS | ||
| 107 | - | ||
| 108 | +#ifdef __cplusplus | ||
| 109 | +} | ||
| 110 | +#endif | ||
| 111 | #endif /* elf.h */ | ||
