From 281b007d48b86fd15adb10fb52e6ea10d40009c4 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 19 Sep 2017 21:14:27 -0700 Subject: flatbuffers: Fix build with clang on big-endian machines Signed-off-by: Khem Raj Signed-off-by: Martin Jansa --- ..._builtin_bswap16-when-building-with-clang.patch | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 meta-oe/recipes-devtools/flatbuffers/files/0002-use-__builtin_bswap16-when-building-with-clang.patch (limited to 'meta-oe/recipes-devtools/flatbuffers/files/0002-use-__builtin_bswap16-when-building-with-clang.patch') diff --git a/meta-oe/recipes-devtools/flatbuffers/files/0002-use-__builtin_bswap16-when-building-with-clang.patch b/meta-oe/recipes-devtools/flatbuffers/files/0002-use-__builtin_bswap16-when-building-with-clang.patch new file mode 100644 index 0000000000..460159f275 --- /dev/null +++ b/meta-oe/recipes-devtools/flatbuffers/files/0002-use-__builtin_bswap16-when-building-with-clang.patch @@ -0,0 +1,30 @@ +From 626fe5e043de25e970ebdf061b88c646fa689113 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 19 Sep 2017 10:09:31 -0700 +Subject: [PATCH 2/2] use __builtin_bswap16 when building with clang + +clang pretends to be gcc 4.2.0 and therefore the code does +not use __builtin_bswap16 but tries to synthesize it + +Signed-off-by: Khem Raj +--- +Upstream-Status: Submitted + include/flatbuffers/base.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h +index c73fb2d..13e8fac 100644 +--- a/include/flatbuffers/base.h ++++ b/include/flatbuffers/base.h +@@ -156,7 +156,7 @@ template T EndianSwap(T t) { + #define FLATBUFFERS_BYTESWAP32 _byteswap_ulong + #define FLATBUFFERS_BYTESWAP64 _byteswap_uint64 + #else +- #if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ < 408 ++ #if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ < 408 && !defined(__clang__) + // __builtin_bswap16 was missing prior to GCC 4.8. + #define FLATBUFFERS_BYTESWAP16(x) \ + static_cast(__builtin_bswap32(static_cast(x) << 16)) +-- +2.14.1 + -- cgit 1.2.3-korg