2018-06-22 13:44:05 +02:00
|
|
|
From b9cb60a911c35650c26995c7e6f7051fdf702d22 Mon Sep 17 00:00:00 2001
|
2018-06-19 16:44:41 +02:00
|
|
|
From: Baruch Siach <baruch@tkos.co.il>
|
|
|
|
Date: Tue, 19 Jun 2018 15:31:52 +0300
|
|
|
|
Subject: [PATCH] portable.h: fix build with gcc older than 4.8
|
|
|
|
|
|
|
|
__builtin_bswap16 is available in all gcc architectures only since
|
|
|
|
version 4.8. Older gcc versions fail to build:
|
|
|
|
|
|
|
|
imx_sdp.o: In function `perform_dcd':
|
|
|
|
.../imx_sdp.c:1138: undefined reference to `__builtin_bswap16'
|
|
|
|
imx_sdp.o: In function `write_dcd_table_ivt':
|
|
|
|
.../imx_sdp.c:457: undefined reference to `__builtin_bswap16'
|
|
|
|
imx_sdp.o: In function `write_dcd':
|
|
|
|
.../imx_sdp.c:410: undefined reference to `__builtin_bswap16'
|
|
|
|
imx_sdp.o: In function `init_header':
|
|
|
|
.../imx_sdp.c:1075: undefined reference to `__builtin_bswap16'
|
|
|
|
|
2018-06-22 13:44:05 +02:00
|
|
|
Use a local implementation instead. The implementation suggested by
|
|
|
|
Arnout Vandecappelle on the Buildroot mailing list.
|
2018-06-19 16:44:41 +02:00
|
|
|
|
|
|
|
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
|
|
|
|
---
|
|
|
|
Upstream status: https://github.com/boundarydevices/imx_usb_loader/pull/82
|
|
|
|
|
2018-06-22 13:44:05 +02:00
|
|
|
portable.h | 6 +++++-
|
|
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
2018-06-19 16:44:41 +02:00
|
|
|
|
|
|
|
diff --git a/portable.h b/portable.h
|
2018-06-22 13:44:05 +02:00
|
|
|
index 364fe47b212a..b8a302bae400 100644
|
2018-06-19 16:44:41 +02:00
|
|
|
--- a/portable.h
|
|
|
|
+++ b/portable.h
|
2018-06-22 13:44:05 +02:00
|
|
|
@@ -58,7 +58,11 @@ extern int debugmode;
|
2018-06-19 16:44:41 +02:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
|
|
#define BE32(x) __builtin_bswap32(x)
|
|
|
|
-#define BE16(x) __builtin_bswap16(x)
|
2018-06-22 13:44:05 +02:00
|
|
|
+#define BE16(x) \
|
|
|
|
+({ \
|
|
|
|
+ typeof(x) __x = (x); \
|
|
|
|
+ (__x<<8 | __x>>8); \
|
|
|
|
+})
|
2018-06-19 16:44:41 +02:00
|
|
|
#else
|
|
|
|
#define BE32(x) x
|
|
|
|
#define BE16(x) x
|
|
|
|
--
|
|
|
|
2.17.1
|
|
|
|
|