@@ -24,6 +24,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
\
file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \
+ file://0003-localedef-cdefs.h-define-__glibc_has_attribute.patch;patchdir=localedef \
\
file://0010-eglibc-Cross-building-and-testing-instructions.patch \
file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \
new file mode 100644
@@ -0,0 +1,51 @@
+From a90ba625410f8b49205adbe03652bc2fd0c35cec Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@gmail.com>
+Date: Thu, 17 Aug 2023 01:23:59 +0200
+Subject: [PATCH] cdefs.h: define __glibc_has_attribute
+
+Older glibc on host might be missing __glibc_has_attribute added in glibc-2.34 with:
+
+https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=misc/sys/cdefs.h;h=8e244a77cf6271f09cbd26d18b1e07b1d1641404;hp=57ca262bdfb642bf4a945645532f2319ec1ff437;hb=c8ba52ab3350c334d6e34b1439a4c0c1431351f3;hpb=7dd416491e080456fc7742d884c520526509413e
+
+Fixes:
+In file included from ../git/localedef/include/programs/xmalloc.h:21,
+ from glibc/locale/programs/localedef.h:124,
+ from glibc/locale/programs/localedef.c:36:
+../git/localedef/include/sys/cdefs.h:85:51: error: missing binary operator before token "("
+ 85 | #if __GNUC_PREREQ (4, 3) || __glibc_has_attribute (__cold__)
+ | ^
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+Upstream-Status: Submitted [https://github.com/kraj/localedef/pull/4]
+---
+ include/sys/cdefs.h | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
+index 0f32fdb..8530054 100644
+--- a/include/sys/cdefs.h
++++ b/include/sys/cdefs.h
+@@ -37,6 +37,23 @@
+ #endif
+ #endif
+
++#if !defined __glibc_has_attribute
++/* Older glibc on host might be missing __glibc_has_attribute added in glibc-2.34 with:
++ https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=misc/sys/cdefs.h;h=8e244a77cf6271f09cbd26d18b1e07b1d1641404;hp=57ca262bdfb642bf4a945645532f2319ec1ff437;hb=c8ba52ab3350c334d6e34b1439a4c0c1431351f3;hpb=7dd416491e080456fc7742d884c520526509413e
++*/
++/* Compilers that lack __has_attribute may object to
++ #if defined __has_attribute && __has_attribute (...)
++ even though they do not need to evaluate the right-hand side of the &&.
++ Similarly for __has_builtin, etc. */
++#if (defined __has_attribute \
++ && (!defined __clang_minor__ \
++ || 3 < __clang_major__ + (5 <= __clang_minor__)))
++# define __glibc_has_attribute(attr) __has_attribute (attr)
++#else
++# define __glibc_has_attribute(attr) 0
++#endif
++#endif
++
+ #if !defined(__REDIRECT_NTH) && defined(__GNUC__) && __GNUC__ >= 2
+ # ifdef __cplusplus
+ # define __REDIRECT_NTH(name, proto, alias) \
Older glibc on host might be missing __glibc_has_attribute added in glibc-2.34 with: https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=misc/sys/cdefs.h;h=8e244a77cf6271f09cbd26d18b1e07b1d1641404;hp=57ca262bdfb642bf4a945645532f2319ec1ff437;hb=c8ba52ab3350c334d6e34b1439a4c0c1431351f3;hpb=7dd416491e080456fc7742d884c520526509413e Fixes: In file included from ../git/localedef/include/programs/xmalloc.h:21, from glibc/locale/programs/localedef.h:124, from glibc/locale/programs/localedef.c:36: ../git/localedef/include/sys/cdefs.h:85:51: error: missing binary operator before token "(" 85 | #if __GNUC_PREREQ (4, 3) || __glibc_has_attribute (__cold__) | ^ Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> --- .../glibc/cross-localedef-native_2.38.bb | 1 + ...cdefs.h-define-__glibc_has_attribute.patch | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0003-localedef-cdefs.h-define-__glibc_has_attribute.patch