All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] imx-usb-loader: fix build with older gcc
Date: Tue, 19 Jun 2018 17:44:41 +0300	[thread overview]
Message-ID: <53fcb79e408e468aaa45b7adc6ba0f92aba03702.1529419481.git.baruch@tkos.co.il> (raw)

Since the last version bump imx-usb-loader uses __builtin_bswap16 which
is not universally available in gcc older than version 4.8. Add a patch
switching to a local 16-bit bytes swap implementation.

Should fix:
http://autobuild.buildroot.net/results/a63/a63b593b7ef3b6d32e755afe42b77d47dbf0276e/
http://autobuild.buildroot.net/results/48c/48c95cfc65f99fa02be81a11303ba8999f57091a/
http://autobuild.buildroot.net/results/c9d/c9d4f99b49ddb9b2ce08fce7672dd7c70cf62912/

Cc: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 ....h-fix-build-with-gcc-older-than-4.8.patch | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 package/imx-usb-loader/0001-portable.h-fix-build-with-gcc-older-than-4.8.patch

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 000000000000..c0aabed542c6
--- /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 <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'
+
+Use a local implementation instead.
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+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
+
-- 
2.17.1

             reply	other threads:[~2018-06-19 14:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 14:44 Baruch Siach [this message]
2018-06-19 20:52 ` [Buildroot] [PATCH] imx-usb-loader: fix build with older gcc Peter Korsgaard
2018-06-21 21:56   ` Arnout Vandecappelle
2018-06-22 10:22     ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53fcb79e408e468aaa45b7adc6ba0f92aba03702.1529419481.git.baruch@tkos.co.il \
    --to=baruch@tkos.co.il \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.