diff options
author | Nicola Lunghi <nick83ola@gmail.com> | 2019-11-21 12:57:11 +0000 |
---|---|---|
committer | Ross Burton <ross.burton@intel.com> | 2019-11-25 12:24:21 +0000 |
commit | a67a5fd160f97129a6afd65f107cd2cbdfec41e7 (patch) | |
tree | a51a17c63ce51685166cb622a394903aafdf04d6 | |
parent | 0f4eecc000f66d114ad258fa31aed66afa292166 (diff) | |
download | meta-gplv2-a67a5fd160f97129a6afd65f107cd2cbdfec41e7.tar.gz |
diffutils: use mempcpy instead of __mempcpy3.1_M1
musl (like uclibc) doesn't define __mempcpy.
This patch will replace __mempcpy with mempcpy in the internal regex.c and
getopt.c implementation (similar to what is done in grep in this same repo
with the uclibc-fix.patch
This also render the line:
EXTRA_OECONF_libc-uclibc = "--without-included-regex"
not needed anymore so it drops it.
Signed-off-by: Nicola Lunghi <nick83ola@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
3 files changed, 57 insertions, 7 deletions
diff --git a/recipes-extended/diffutils/diffutils-2.8.1/0002-included-libc-use-mempcpy-instead-of.patch b/recipes-extended/diffutils/diffutils-2.8.1/0002-included-libc-use-mempcpy-instead-of.patch new file mode 100644 index 0000000..6994ec7 --- /dev/null +++ b/recipes-extended/diffutils/diffutils-2.8.1/0002-included-libc-use-mempcpy-instead-of.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From 61db4da387676690c0f731ef2eccc014d85c23a6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nicola Lunghi <nicola.lunghi@jci.com> | ||
3 | Date: Wed, 20 Nov 2019 18:30:10 +0000 | ||
4 | Subject: [PATCH] included libc: use mempcpy instead of __mempcpy | ||
5 | |||
6 | Fix to use mempcpy instead of __mempcpy. This is needed for uclibc and musl | ||
7 | which doesn't define __mempcpy, only mempcpy. Since they all have | ||
8 | mempcpy, we'll just use that instead. | ||
9 | |||
10 | Signed-off-by: Nicola Lunghi <nick83ola@gmail.com> | ||
11 | |||
12 | Patch source: OpenEmbedded (grep) | ||
13 | Upstream-Status: Inappropriate [licensing] | ||
14 | --- | ||
15 | lib/getopt.c | 4 ++-- | ||
16 | lib/regex.c | 2 +- | ||
17 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
18 | |||
19 | diff --git a/lib/getopt.c b/lib/getopt.c | ||
20 | index ed32692..6626f5e 100644 | ||
21 | --- a/lib/getopt.c | ||
22 | +++ b/lib/getopt.c | ||
23 | @@ -334,7 +334,7 @@ exchange (argv) | ||
24 | nonoption_flags_len = nonoption_flags_max_len = 0; | ||
25 | else | ||
26 | { | ||
27 | - memset (__mempcpy (new_str, __getopt_nonoption_flags, | ||
28 | + memset (mempcpy (new_str, __getopt_nonoption_flags, | ||
29 | nonoption_flags_max_len), | ||
30 | '\0', top + 1 - nonoption_flags_max_len); | ||
31 | nonoption_flags_max_len = top + 1; | ||
32 | @@ -445,7 +445,7 @@ _getopt_initialize (argc, argv, optstring) | ||
33 | if (__getopt_nonoption_flags == NULL) | ||
34 | nonoption_flags_max_len = -1; | ||
35 | else | ||
36 | - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), | ||
37 | + memset (mempcpy (__getopt_nonoption_flags, orig_str, len), | ||
38 | '\0', nonoption_flags_max_len - len); | ||
39 | } | ||
40 | } | ||
41 | diff --git a/lib/regex.c b/lib/regex.c | ||
42 | index 6daec76..797b20a 100644 | ||
43 | --- a/lib/regex.c | ||
44 | +++ b/lib/regex.c | ||
45 | @@ -8314,7 +8314,7 @@ regerror (errcode, preg, errbuf, errbuf_size) | ||
46 | if (msg_size > errbuf_size) | ||
47 | { | ||
48 | #if defined HAVE_MEMPCPY || defined _LIBC | ||
49 | - *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; | ||
50 | + *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; | ||
51 | #else | ||
52 | memcpy (errbuf, msg, errbuf_size - 1); | ||
53 | errbuf[errbuf_size - 1] = 0; | ||
54 | -- | ||
55 | 2.20.1 | ||
56 | |||
diff --git a/recipes-extended/diffutils/diffutils.inc b/recipes-extended/diffutils/diffutils.inc index 243341a..c81348b 100644 --- a/recipes-extended/diffutils/diffutils.inc +++ b/recipes-extended/diffutils/diffutils.inc | |||
@@ -6,13 +6,6 @@ SECTION = "base" | |||
6 | 6 | ||
7 | inherit autotools texinfo update-alternatives gettext | 7 | inherit autotools texinfo update-alternatives gettext |
8 | 8 | ||
9 | # diffutils assumes non-glibc compilation with uclibc and | ||
10 | # this causes it to generate its own implementations of | ||
11 | # standard functionality. regex.c actually breaks compilation | ||
12 | # because it uses __mempcpy, there are other things (TBD: | ||
13 | # see diffutils.mk in buildroot) | ||
14 | EXTRA_OECONF_libc-uclibc = "--without-included-regex" | ||
15 | |||
16 | ALTERNATIVE_${PN} = "diff cmp" | 9 | ALTERNATIVE_${PN} = "diff cmp" |
17 | ALTERNATIVE_PRIORITY = "100" | 10 | ALTERNATIVE_PRIORITY = "100" |
18 | 11 | ||
diff --git a/recipes-extended/diffutils/diffutils_2.8.1.bb b/recipes-extended/diffutils/diffutils_2.8.1.bb index 466bf28..5a71c94 100644 --- a/recipes-extended/diffutils/diffutils_2.8.1.bb +++ b/recipes-extended/diffutils/diffutils_2.8.1.bb | |||
@@ -9,6 +9,7 @@ SRC_URI = "${GNU_MIRROR}/diffutils/diffutils-${PV}.tar.gz \ | |||
9 | file://diffutils_fix_for_automake-1.12.patch \ | 9 | file://diffutils_fix_for_automake-1.12.patch \ |
10 | file://fix_gcc6.patch \ | 10 | file://fix_gcc6.patch \ |
11 | file://0001-Make-it-build-with-compile-time-hardening-enabled.patch \ | 11 | file://0001-Make-it-build-with-compile-time-hardening-enabled.patch \ |
12 | file://0002-included-libc-use-mempcpy-instead-of.patch \ | ||
12 | " | 13 | " |
13 | 14 | ||
14 | SRC_URI[md5sum] = "71f9c5ae19b60608f6c7f162da86a428" | 15 | SRC_URI[md5sum] = "71f9c5ae19b60608f6c7f162da86a428" |