diff --git a/package/imx-usb-loader/0001-portable.h-fix-build-with-gcc-older-than-4.8.patch b/package/imx-usb-loader/0001-portable.h-fix-build-with-gcc-older-than-4.8.patch new file mode 100644 index 0000000000..c0aabed542 --- /dev/null +++ b/package/imx-usb-loader/0001-portable.h-fix-build-with-gcc-older-than-4.8.patch @@ -0,0 +1,42 @@ +From c581e6037ec7ab2f9cd615f6ffa149b4d0a5638c Mon Sep 17 00:00:00 2001 +From: Baruch Siach +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' + +Use a local implementation instead. + +Signed-off-by: Baruch Siach +--- +Upstream status: https://github.com/boundarydevices/imx_usb_loader/pull/82 + + portable.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/portable.h b/portable.h +index 364fe47b212a..364832b5ea69 100644 +--- a/portable.h ++++ b/portable.h +@@ -58,7 +58,7 @@ extern int debugmode; + #ifdef __GNUC__ + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + #define BE32(x) __builtin_bswap32(x) +-#define BE16(x) __builtin_bswap16(x) ++#define BE16(x) (x<<8 | x>>8) + #else + #define BE32(x) x + #define BE16(x) x +-- +2.17.1 +