aboutsummaryrefslogtreecommitdiffstats
path: root/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2018-01-29 00:05:07 +0100
committerArmin Kuster <akuster808@gmail.com>2018-02-11 11:50:56 -0800
commitedbe41f53ec15eeae4673498c41a1f3a42ac813b (patch)
treed27d63b3249b2d4ebfee8ad5e837466d256e7ac2 /meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
parent75356b6a76e965f6e282e8219e88afc1ab4f3240 (diff)
downloadmeta-openembedded-contrib-edbe41f53ec15eeae4673498c41a1f3a42ac813b.tar.gz
ubi-utils-klibc_1.5.2: fix build for qemuarm
Building the recipe with TUNE_FEATURES = "aarch64" and TARGET_FPU = "" fails. See patch headers for more details. Patch sent upstream for master, here rebased for 1.5.2. Tested runtime on armv5. While there backport one more patch fixing warnings in libmtd.c and move the patches in their specific dir, preparing for v2.0.1. Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch')
-rw-r--r--meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
new file mode 100644
index 0000000000..2f31fb4a26
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
@@ -0,0 +1,88 @@
+From b668cb75cb7e72ff92055209130d4cd4b3cacbdb Mon Sep 17 00:00:00 2001
+From: Thorsten Glaser <tg@mirbsd.org>
+Date: Fri, 20 Jun 2014 10:56:27 +0000
+Subject: [PATCH 4/9] Restore compatibility to dietlibc, klibc, musl libc after
+ commit 4f1b108
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Each C library has their own way to define off_t, and the <features.h>
+header is nonstandard and specific to the GNU libc and those that clone
+it (uClibc). Fefe’s dietlibc uses different flags, and klibc always uses
+a 64-bit off_t (like the BSDs); musl libc cannot be recognised using cpp
+instructions, so we assume 64 bit there (and on unknown C libraries) and
+leave it to the user to submit a follow-up fix if we guess wrong. I also
+added a static assertion to verify the 64 bit guess is correct.
+
+It would be really better using a configure script for this instead.
+
+Fixes:
+| CC lib/libmtd.o
+| In file included from ubi-utils/ubiutils-common.c:35:0:
+| ./include/common.h:29:22: fatal error: features.h: No such file or directory
+| #include <features.h>
+| ^
+| compilation terminated.
+
+Upstream-Status: Submitted
+
+Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+---
+ include/common.h | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/include/common.h b/include/common.h
+index fb0ca83..5a20964 100644
+--- a/include/common.h
++++ b/include/common.h
+@@ -26,7 +26,9 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ #include <features.h>
++#endif
+ #include <inttypes.h>
+ #include "version.h"
+
+@@ -67,6 +69,21 @@ extern "C" {
+ #endif
+
+ /* define a print format specifier for off_t */
++#if defined(__KLIBC__)
++/* always 64 bit on klibc */
++#define PRIxoff_t PRIx64
++#define PRIdoff_t PRId64
++#elif defined(__dietlibc__)
++/* depends on compiler flags on dietlibc */
++#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
++#define PRIxoff_t PRIx64
++#define PRIdoff_t PRId64
++#else
++#define PRIxoff_t "l"PRIx32
++#define PRIdoff_t "l"PRId32
++#endif
++#elif defined(__GLIBC__) || defined(__UCLIBC__)
++/* depends on compiler flags on glibc and uClibc */
+ #ifdef __USE_FILE_OFFSET64
+ #define PRIxoff_t PRIx64
+ #define PRIdoff_t PRId64
+@@ -74,6 +91,13 @@ extern "C" {
+ #define PRIxoff_t "l"PRIx32
+ #define PRIdoff_t "l"PRId32
+ #endif
++#else
++/* unknown libc or musl */
++#define PRIxoff_t PRIx64
++#define PRIdoff_t PRId64
++/* verify our guess of 64 bit is correct */
++static char __PRIxoff_t_static_assert[sizeof(off_t) == 8 ? 1 : -1];
++#endif
+
+ /* Verbose messages */
+ #define bareverbose(verbose, fmt, ...) do { \
+--
+2.7.4
+