meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch
Andrea Adami edbe41f53e 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>
2018-02-11 11:50:56 -08:00

89 lines
2.7 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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