summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre McCurdy <armccurdy@gmail.com>2017-12-18 14:08:07 -0800
committerRoss Burton <ross.burton@intel.com>2017-12-19 20:40:31 +0000
commita0f8716d07324e945f0462b82f9309fa0934af17 (patch)
tree04e7f0333e3f789d8e7ed904ea21feb72ddff0c0
parente154211af41329265f43d22bc30b4158db28ef79 (diff)
downloadmeta-gplv2-a0f8716d07324e945f0462b82f9309fa0934af17.tar.gz
elfutils_0.148: musl build fixes
Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--recipes-devtools/elfutils/elfutils-0.148/musl-support-for-elfutils-0.148.patch133
-rw-r--r--recipes-devtools/elfutils/elfutils_0.148.bb9
2 files changed, 140 insertions, 2 deletions
diff --git a/recipes-devtools/elfutils/elfutils-0.148/musl-support-for-elfutils-0.148.patch b/recipes-devtools/elfutils/elfutils-0.148/musl-support-for-elfutils-0.148.patch
new file mode 100644
index 0000000..5a52d6d
--- /dev/null
+++ b/recipes-devtools/elfutils/elfutils-0.148/musl-support-for-elfutils-0.148.patch
@@ -0,0 +1,133 @@
1From 8a6cefcd35fb0ba6e12afc6611cfeb600865ca17 Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <armccurdy@gmail.com>
3Date: Wed, 27 Sep 2017 21:32:27 -0700
4Subject: [PATCH] musl build fixes
5
6Upstream-Status: Inappropriate [legacy version]
7
8Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
9---
10 lib/fixedsizehash.h | 4 ++--
11 lib/system.h | 11 +++++++++++
12 libelf/elf.h | 8 ++++++--
13 libelf/elf_begin.c | 4 ++--
14 libelf/elf_getarsym.c | 2 +-
15 libelf/libelf.h | 1 +
16 6 files changed, 23 insertions(+), 7 deletions(-)
17
18diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
19index a686051..3118954 100644
20--- a/lib/fixedsizehash.h
21+++ b/lib/fixedsizehash.h
22@@ -51,12 +51,12 @@
23 #include <errno.h>
24 #include <stdlib.h>
25 #include <string.h>
26-#include <sys/cdefs.h>
27 #include <sys/param.h>
28
29 #include <system.h>
30
31-#define CONCAT(t1,t2) __CONCAT (t1,t2)
32+#define CONCAT1(x,y) x##y
33+#define CONCAT(x,y) CONCAT1(x,y)
34
35 /* Before including this file the following macros must be defined:
36
37diff --git a/lib/system.h b/lib/system.h
38index 10b4734..a9cb35e 100644
39--- a/lib/system.h
40+++ b/lib/system.h
41@@ -52,6 +52,17 @@
42 #include <stddef.h>
43 #include <stdint.h>
44
45+#ifndef TEMP_FAILURE_RETRY
46+#define TEMP_FAILURE_RETRY(expression) \
47+ (__extension__ \
48+ ({ long int __result; \
49+ do __result = (long int) (expression); \
50+ while (__result == -1L && errno == EINTR); \
51+ __result; }))
52+#endif
53+
54+#define error(status, errno, ...) err(status, __VA_ARGS__)
55+
56 extern void *xmalloc (size_t) __attribute__ ((__malloc__));
57 extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
58 extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));
59diff --git a/libelf/elf.h b/libelf/elf.h
60index 4158764..6d9af96 100644
61--- a/libelf/elf.h
62+++ b/libelf/elf.h
63@@ -23,7 +23,9 @@
64
65 #include <features.h>
66
67-__BEGIN_DECLS
68+#ifdef __cplusplus
69+extern "C" {
70+#endif
71
72 /* Standard ELF types. */
73
74@@ -2909,6 +2911,8 @@ typedef Elf32_Addr Elf32_Conflict;
75 #define R_M32R_NUM 256 /* Keep this the last entry. */
76
77
78-__END_DECLS
79+#ifdef __cplusplus
80+}
81+#endif
82
83 #endif /* elf.h */
84diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
85index 0b38991..9083736 100644
86--- a/libelf/elf_begin.c
87+++ b/libelf/elf_begin.c
88@@ -819,7 +819,7 @@ __libelf_next_arhdr_wrlock (elf)
89 }
90
91 /* Copy the raw name over to a NUL terminated buffer. */
92- *((char *) __mempcpy (elf->state.ar.raw_name, ar_hdr->ar_name, 16)) = '\0';
93+ *((char *) mempcpy (elf->state.ar.raw_name, ar_hdr->ar_name, 16)) = '\0';
94
95 elf_ar_hdr = &elf->state.ar.elf_ar_hdr;
96
97@@ -911,7 +911,7 @@ __libelf_next_arhdr_wrlock (elf)
98 const char *string = ar_hdr->FIELD; \
99 if (ar_hdr->FIELD[sizeof (ar_hdr->FIELD) - 1] != ' ') \
100 { \
101- *((char *) __mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIELD))) \
102+ *((char *) mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIELD))) \
103 = '\0'; \
104 string = buf; \
105 } \
106diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
107index 9ff7f29..74339ce 100644
108--- a/libelf/elf_getarsym.c
109+++ b/libelf/elf_getarsym.c
110@@ -257,7 +257,7 @@ elf_getarsym (elf, ptr)
111 else
112 arsym[cnt].as_off = file_data[cnt];
113 arsym[cnt].as_hash = _dl_elf_hash (str_data);
114- str_data = rawmemchr (str_data, '\0') + 1;
115+ str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
116 }
117 /* At the end a special entry. */
118 arsym[n].as_name = NULL;
119diff --git a/libelf/libelf.h b/libelf/libelf.h
120index b0b3a8d..ec15c43 100644
121--- a/libelf/libelf.h
122+++ b/libelf/libelf.h
123@@ -50,6 +50,7 @@
124 #ifndef _LIBELF_H
125 #define _LIBELF_H 1
126
127+#include <fcntl.h>
128 #include <sys/types.h>
129
130 /* Get the ELF types. */
131--
1321.9.1
133
diff --git a/recipes-devtools/elfutils/elfutils_0.148.bb b/recipes-devtools/elfutils/elfutils_0.148.bb
index 892a523..a03b74e 100644
--- a/recipes-devtools/elfutils/elfutils_0.148.bb
+++ b/recipes-devtools/elfutils/elfutils_0.148.bb
@@ -40,6 +40,10 @@ SRC_URI += "\
40 file://0001-Make-it-compile-with-GCC-7.patch \ 40 file://0001-Make-it-compile-with-GCC-7.patch \
41 file://0002-Make-it-build-with-GCC-7-and-compile-time-hardening-.patch \ 41 file://0002-Make-it-build-with-GCC-7-and-compile-time-hardening-.patch \
42" 42"
43
44# Only apply when building musl based target recipe
45SRC_URI_append_libc-musl = " file://musl-support-for-elfutils-0.148.patch"
46
43# Only apply when building uclibc based target recipe 47# Only apply when building uclibc based target recipe
44SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.148.patch" 48SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.148.patch"
45 49
@@ -63,10 +67,11 @@ do_configure_prepend() {
63 cp ${WORKDIR}/*dis.h ${S}/libcpu 67 cp ${WORKDIR}/*dis.h ${S}/libcpu
64} 68}
65 69
66# we can not build complete elfutils when using uclibc 70# we can not build complete elfutils when using uclibc or musl
67# but some recipes e.g. gcc 4.5 depends on libelf so we 71# but some recipes e.g. gcc 4.5 depends on libelf so we
68# build only libelf for uclibc case 72# build only libelf for uclibc and musl cases
69 73
74EXTRA_OEMAKE_libc-musl = "-C libelf"
70EXTRA_OEMAKE_libc-uclibc = "-C libelf" 75EXTRA_OEMAKE_libc-uclibc = "-C libelf"
71EXTRA_OEMAKE_class-native = "" 76EXTRA_OEMAKE_class-native = ""
72EXTRA_OEMAKE_class-nativesdk = "" 77EXTRA_OEMAKE_class-nativesdk = ""