1From ec1c348b4fd67619fa0c2f55ae644f6a8014d971 Mon Sep 17 00:00:00 2001 2From: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3Date: Sun, 19 Sep 2021 21:17:44 +0200 4Subject: build: Add reallocarray to missing.h 5 6reallocarray has been added to glibc relatively recently (version 2.26, 7from 2017) and apparently not all users run new enough glibc. Moreover, 8reallocarray is not available with uclibc-ng. So use realloc if 9reallocarray is not available to avoid the following build failure 10raised since commit 891b78e9e892a3bcd800eb3a298e6380e9a15dd1: 11 12/home/giuliobenetti/autobuild/run/instance-3/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/10.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: src/sae.o: in function `sae_rx_authenticate': 13sae.c:(.text+0xd74): undefined reference to `reallocarray' 14 15Fixes: 16 - http://autobuild.buildroot.org/results/c6d3f86282c44645b4f1c61882dc63ccfc8eb35a 17 18[Retrieved from: 19https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/?id=ec1c348b4fd67619fa0c2f55ae644f6a8014d971] 20Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 21--- 22 configure.ac | 1 + 23 src/missing.h | 7 +++++++ 24 2 files changed, 8 insertions(+) 25 26diff --git a/configure.ac b/configure.ac 27index c6250401..51d9da93 100644 28--- a/configure.ac 29+++ b/configure.ac 30@@ -129,6 +129,7 @@ AC_DEFINE_UNQUOTED(WIRED_STORAGEDIR, "${wired_storagedir}", 31 32 AC_CHECK_FUNCS(explicit_bzero) 33 AC_CHECK_FUNCS(rawmemchr) 34+AC_CHECK_FUNCS(reallocarray) 35 36 AC_CHECK_HEADERS(linux/types.h linux/if_alg.h) 37 38diff --git a/src/missing.h b/src/missing.h 39index 2cc80aee..a5b92952 100644 40--- a/src/missing.h 41+++ b/src/missing.h 42@@ -37,3 +37,10 @@ _Pragma("GCC diagnostic ignored \"-Wstringop-overflow=\"") 43 _Pragma("GCC diagnostic pop") 44 } 45 #endif 46+ 47+#ifndef HAVE_REALLOCARRAY 48+static inline void *reallocarray(void *ptr, size_t nmemb, size_t size) 49+{ 50+ return realloc(ptr, nmemb * size); 51+} 52+#endif 53-- 54cgit 1.2.3-1.el7 55 56