summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/diffutils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/diffutils')
-rw-r--r--meta/recipes-extended/diffutils/diffutils-3.5/diffutils-3.5-gcc7.patch228
-rw-r--r--meta/recipes-extended/diffutils/diffutils_3.5.bb6
2 files changed, 231 insertions, 3 deletions
diff --git a/meta/recipes-extended/diffutils/diffutils-3.5/diffutils-3.5-gcc7.patch b/meta/recipes-extended/diffutils/diffutils-3.5/diffutils-3.5-gcc7.patch
new file mode 100644
index 0000000000..52bcd7c6ae
--- /dev/null
+++ b/meta/recipes-extended/diffutils/diffutils-3.5/diffutils-3.5-gcc7.patch
@@ -0,0 +1,228 @@
1Cumulative Backports from upstream to address gcc 7 portablility issues
2Imported from Fedora
3
4Upstream-Status: Backport
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7diff -up diffutils-3.5/lib/intprops.h.than diffutils-3.5/lib/intprops.h
8--- diffutils-3.5/lib/intprops.h.than 2017-02-21 09:08:39.470417367 -0500
9+++ diffutils-3.5/lib/intprops.h 2017-02-21 09:46:57.090996508 -0500
10@@ -1,6 +1,6 @@
11 /* intprops.h -- properties of integer types
12
13- Copyright (C) 2001-2016 Free Software Foundation, Inc.
14+ Copyright (C) 2001-2017 Free Software Foundation, Inc.
15
16 This program is free software: you can redistribute it and/or modify it
17 under the terms of the GNU General Public License as published
18@@ -47,12 +47,16 @@
19
20 /* Minimum and maximum values for integer types and expressions. */
21
22+/* The width in bits of the integer type or expression T.
23+ Padding bits are not supported; this is checked at compile-time below. */
24+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
25+
26 /* The maximum and minimum values for the integer type T. */
27 #define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
28 #define TYPE_MAXIMUM(t) \
29 ((t) (! TYPE_SIGNED (t) \
30 ? (t) -1 \
31- : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
32+ : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
33
34 /* The maximum and minimum values for the type of the expression E,
35 after integer promotion. E should not have side effects. */
36@@ -65,7 +69,13 @@
37 ? _GL_SIGNED_INT_MAXIMUM (e) \
38 : _GL_INT_NEGATE_CONVERT (e, 1))
39 #define _GL_SIGNED_INT_MAXIMUM(e) \
40- (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
41+ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1)
42+
43+/* Work around OpenVMS incompatibility with C99. */
44+#if !defined LLONG_MAX && defined __INT64_MAX
45+# define LLONG_MAX __INT64_MAX
46+# define LLONG_MIN __INT64_MIN
47+#endif
48
49 /* This include file assumes that signed types are two's complement without
50 padding bits; the above macros have undefined behavior otherwise.
51@@ -84,10 +94,15 @@ verify (TYPE_MAXIMUM (long int) == LONG_
52 verify (TYPE_MINIMUM (long long int) == LLONG_MIN);
53 verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
54 #endif
55+/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */
56+#ifdef UINT_WIDTH
57+verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
58+#endif
59
60 /* Does the __typeof__ keyword work? This could be done by
61 'configure', but for now it's easier to do it by hand. */
62-#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
63+#if (2 <= __GNUC__ \
64+ || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
65 || (0x5110 <= __SUNPRO_C && !__STDC__))
66 # define _GL_HAVE___TYPEOF__ 1
67 #else
68@@ -116,8 +131,7 @@ verify (TYPE_MAXIMUM (long long int) ==
69 signed, this macro may overestimate the true bound by one byte when
70 applied to unsigned types of size 2, 4, 16, ... bytes. */
71 #define INT_STRLEN_BOUND(t) \
72- (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \
73- - _GL_SIGNED_TYPE_OR_EXPR (t)) \
74+ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \
75 + _GL_SIGNED_TYPE_OR_EXPR (t))
76
77 /* Bound on buffer size needed to represent an integer type or expression T,
78@@ -222,20 +236,23 @@ verify (TYPE_MAXIMUM (long long int) ==
79 ? (a) < (min) >> (b) \
80 : (max) >> (b) < (a))
81
82-/* True if __builtin_add_overflow (A, B, P) works when P is null. */
83-#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__)
84+/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */
85+#define _GL_HAS_BUILTIN_OVERFLOW (5 <= __GNUC__)
86+
87+/* True if __builtin_add_overflow_p (A, B, C) works. */
88+#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
89
90 /* The _GL*_OVERFLOW macros have the same restrictions as the
91 *_RANGE_OVERFLOW macros, except that they do not assume that operands
92 (e.g., A and B) have the same type as MIN and MAX. Instead, they assume
93 that the result (e.g., A + B) has that type. */
94-#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL
95-# define _GL_ADD_OVERFLOW(a, b, min, max)
96- __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
97-# define _GL_SUBTRACT_OVERFLOW(a, b, min, max)
98- __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0)
99-# define _GL_MULTIPLY_OVERFLOW(a, b, min, max)
100- __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0)
101+#if _GL_HAS_BUILTIN_OVERFLOW_P
102+# define _GL_ADD_OVERFLOW(a, b, min, max) \
103+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
104+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
105+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
106+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
107+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
108 #else
109 # define _GL_ADD_OVERFLOW(a, b, min, max) \
110 ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
111@@ -315,7 +332,7 @@ verify (TYPE_MAXIMUM (long long int) ==
112 _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
113 #define INT_SUBTRACT_OVERFLOW(a, b) \
114 _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
115-#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL
116+#if _GL_HAS_BUILTIN_OVERFLOW_P
117 # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
118 #else
119 # define INT_NEGATE_OVERFLOW(a) \
120@@ -349,10 +366,6 @@ verify (TYPE_MAXIMUM (long long int) ==
121 #define INT_MULTIPLY_WRAPV(a, b, r) \
122 _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW)
123
124-#ifndef __has_builtin
125-# define __has_builtin(x) 0
126-#endif
127-
128 /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See:
129 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
130 https://llvm.org/bugs/show_bug.cgi?id=25390
131@@ -369,7 +382,7 @@ verify (TYPE_MAXIMUM (long long int) ==
132 the operation. BUILTIN is the builtin operation, and OVERFLOW the
133 overflow predicate. Return 1 if the result overflows. See above
134 for restrictions. */
135-#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)
136+#if _GL_HAS_BUILTIN_OVERFLOW
137 # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r)
138 #elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
139 # define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
140@@ -412,7 +425,7 @@ verify (TYPE_MAXIMUM (long long int) ==
141 # else
142 # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
143 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
144- long int, LONG_MIN, LONG_MAX))
145+ long int, LONG_MIN, LONG_MAX)
146 # endif
147 #endif
148
149diff -up diffutils-3.5/lib/xalloc-oversized.h.than diffutils-3.5/lib/xalloc-oversized.h
150--- diffutils-3.5/lib/xalloc-oversized.h.than 2017-02-21 09:45:13.729168233 -0500
151+++ diffutils-3.5/lib/xalloc-oversized.h 2017-02-21 09:45:18.309249247 -0500
152@@ -1,6 +1,6 @@
153 /* xalloc-oversized.h -- memory allocation size checking
154
155- Copyright (C) 1990-2000, 2003-2004, 2006-2016 Free Software Foundation, Inc.
156+ Copyright (C) 1990-2000, 2003-2004, 2006-2017 Free Software Foundation, Inc.
157
158 This program is free software: you can redistribute it and/or modify
159 it under the terms of the GNU General Public License as published by
160@@ -19,48 +19,37 @@
161 #define XALLOC_OVERSIZED_H_
162
163 #include <stddef.h>
164+#include <stdint.h>
165
166-/* Default for (non-Clang) compilers that lack __has_builtin. */
167-#ifndef __has_builtin
168-# define __has_builtin(x) 0
169-#endif
170-
171-/* True if N * S would overflow in a size calculation.
172+/* True if N * S would overflow in a size_t calculation,
173+ or would generate a value larger than PTRDIFF_MAX.
174 This expands to a constant expression if N and S are both constants.
175 By gnulib convention, SIZE_MAX represents overflow in size
176- calculations, so the conservative dividend to use here is
177- SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
178- However, malloc (SIZE_MAX) fails on all known hosts where
179- sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
180- exactly-SIZE_MAX allocations on such hosts; this avoids a test and
181- branch when S is known to be 1. */
182+ calculations, so the conservative size_t-based dividend to use here
183+ is SIZE_MAX - 1. */
184 #define __xalloc_oversized(n, s) \
185- ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
186+ ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n))
187
188+#if PTRDIFF_MAX < SIZE_MAX
189+typedef ptrdiff_t __xalloc_count_type;
190+#else
191+typedef size_t __xalloc_count_type;
192+#endif
193
194-/* Return 1 if an array of N objects, each of size S, cannot exist due
195- to size arithmetic overflow. S must be positive and N must be
196- nonnegative. This is a macro, not a function, so that it
197- works correctly even when SIZE_MAX < N. */
198+/* Return 1 if an array of N objects, each of size S, cannot exist
199+ reliably due to size or ptrdiff_t arithmetic overflow. S must be
200+ positive and N must be nonnegative. This is a macro, not a
201+ function, so that it works correctly even when SIZE_MAX < N. */
202
203-/* GCC 7 __builtin_mul_overflow should easily compute this. See:
204- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68120 */
205 #if 7 <= __GNUC__
206-# define xalloc_oversized(n, s) __builtin_mul_overflow (n, s, (size_t *) NULL)
207-
208-/* GCC 5 and Clang __builtin_mul_overflow needs a temporary, and
209- should be used only for non-constant operands, so that
210- xalloc_oversized is a constant expression if both arguments are.
211- Do not use this if pedantic, since pedantic GCC issues a diagnostic
212- for ({ ... }). */
213-#elif ((5 <= __GNUC__ \
214- || (__has_builtin (__builtin_mul_overflow) \
215- && __has_builtin (__builtin_constant_p))) \
216- && !__STRICT_ANSI__)
217+# define xalloc_oversized(n, s) \
218+ __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1)
219+#elif 5 <= __GNUC__ && !__STRICT_ANSI__
220 # define xalloc_oversized(n, s) \
221 (__builtin_constant_p (n) && __builtin_constant_p (s) \
222 ? __xalloc_oversized (n, s) \
223- : ({ size_t __xalloc_size; __builtin_mul_overflow (n, s, &__xalloc_size); }))
224+ : ({ __xalloc_count_type __xalloc_count; \
225+ __builtin_mul_overflow (n, s, &__xalloc_count); }))
226
227 /* Other compilers use integer division; this may be slower but is
228 more portable. */
diff --git a/meta/recipes-extended/diffutils/diffutils_3.5.bb b/meta/recipes-extended/diffutils/diffutils_3.5.bb
index 243584be01..354a6e84fb 100644
--- a/meta/recipes-extended/diffutils/diffutils_3.5.bb
+++ b/meta/recipes-extended/diffutils/diffutils_3.5.bb
@@ -5,8 +5,11 @@ require diffutils.inc
5 5
6SRC_URI = "${GNU_MIRROR}/diffutils/diffutils-${PV}.tar.xz \ 6SRC_URI = "${GNU_MIRROR}/diffutils/diffutils-${PV}.tar.xz \
7 file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ 7 file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
8 file://diffutils-3.5-gcc7.patch \
8 file://run-ptest \ 9 file://run-ptest \
9" 10"
11SRC_URI[md5sum] = "569354697ff1cfc9a9de3781361015fa"
12SRC_URI[sha256sum] = "dad398ccd5b9faca6b0ab219a036453f62a602a56203ac659b43e889bec35533"
10 13
11EXTRA_OECONF += "--without-libsigsegv-prefix" 14EXTRA_OECONF += "--without-libsigsegv-prefix"
12 15
@@ -20,9 +23,6 @@ do_configure_prepend () {
20 done 23 done
21} 24}
22 25
23SRC_URI[md5sum] = "569354697ff1cfc9a9de3781361015fa"
24SRC_URI[sha256sum] = "dad398ccd5b9faca6b0ab219a036453f62a602a56203ac659b43e889bec35533"
25
26inherit ptest 26inherit ptest
27 27
28do_install_ptest() { 28do_install_ptest() {