1From d4717a38d2287c2f583fefb2a0ed273337a92bb6 Mon Sep 17 00:00:00 2001 2From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> 3Date: Mon, 11 Jan 2021 18:18:26 +0100 4Subject: [PATCH] msgpack/predef: add riscV support 5 6When the target CPU is riscV, msgpack is unable to detect endianness with a list of errors like: 7 8uhd/host/lib/deps/rpclib/include/rpc/msgpack/pack.hpp:190:2: error: #error msgpack-c supports only big endian and little endian 9 190 | #error msgpack-c supports only big endian and little endian 10 | ^~~~~ 11 12and with subsequent errors: 13 14uhd0/host/lib/deps/rpclib/include/rpc/msgpack/pack.hpp:236:46: error: there are no arguments to 'take8_8' that depend on a template parameter, so a declaration of 'take8_8' must be available [-fpermissive] 15 236 | char buf[2] = {static_cast<char>(0xccu), take8_8(d)}; 16 | 17 18This is due to a missing support for this architecture in msgpack. 19This patch adapt commit from https://github.com/boostorg/predef 20 21[backported from https://github.com/EttusResearch/uhd/pull/400] 22 23Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> 24--- 25 .../include/rpc/msgpack/predef/architecture.h | 1 + 26 .../rpc/msgpack/predef/architecture/riscv.h | 48 +++++++++++++++++++ 27 .../include/rpc/msgpack/predef/other/endian.h | 3 +- 28 3 files changed, 51 insertions(+), 1 deletion(-) 29 create mode 100644 host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture/riscv.h 30 31diff --git a/host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture.h b/host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture.h 32index 4a0ce2749..1bd998c59 100644 33--- a/host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture.h 34+++ b/host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture.h 35@@ -18,6 +18,7 @@ http://www.boost.org/LICENSE_1_0.txt) 36 #include <rpc/msgpack/predef/architecture/parisc.h> 37 #include <rpc/msgpack/predef/architecture/ppc.h> 38 #include <rpc/msgpack/predef/architecture/pyramid.h> 39+#include <rpc/msgpack/predef/architecture/riscv.h> 40 #include <rpc/msgpack/predef/architecture/rs6k.h> 41 #include <rpc/msgpack/predef/architecture/sparc.h> 42 #include <rpc/msgpack/predef/architecture/superh.h> 43diff --git a/host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture/riscv.h b/host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture/riscv.h 44new file mode 100644 45index 000000000..8b819d77e 46--- /dev/null 47+++ b/host/lib/deps/rpclib/include/rpc/msgpack/predef/architecture/riscv.h 48@@ -0,0 +1,48 @@ 49+/* 50+Copyright Andreas Schwab 2019 51+Distributed under the Boost Software License, Version 1.0. 52+(See accompanying file LICENSE_1_0.txt or copy at 53+http://www.boost.org/LICENSE_1_0.txt) 54+*/ 55+ 56+#ifndef BOOST_PREDEF_ARCHITECTURE_RISCV_H 57+#define BOOST_PREDEF_ARCHITECTURE_RISCV_H 58+ 59+#include <boost/predef/version_number.h> 60+#include <boost/predef/make.h> 61+ 62+/* tag::reference[] 63+= `BOOST_ARCH_RISCV` 64+ 65+http://en.wikipedia.org/wiki/RISC-V[RISC-V] architecture. 66+ 67+[options="header"] 68+|=== 69+| {predef_symbol} | {predef_version} 70+ 71+| `+__riscv+` | {predef_detection} 72+|=== 73+*/ // end::reference[] 74+ 75+#define BOOST_ARCH_RISCV BOOST_VERSION_NUMBER_NOT_AVAILABLE 76+ 77+#if defined(__riscv) 78+# undef BOOST_ARCH_RISCV 79+# define BOOST_ARCH_RISCV BOOST_VERSION_NUMBER_AVAILABLE 80+#endif 81+ 82+#if BOOST_ARCH_RISCV 83+# define BOOST_ARCH_RISCV_AVAILABLE 84+#endif 85+ 86+#if BOOST_ARCH_RISCV 87+# undef BOOST_ARCH_WORD_BITS_32 88+# define BOOST_ARCH_WORD_BITS_32 BOOST_VERSION_NUMBER_AVAILABLE 89+#endif 90+ 91+#define BOOST_ARCH_RISCV_NAME "RISC-V" 92+ 93+#endif 94+ 95+#include <boost/predef/detail/test.h> 96+BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_RISCV,BOOST_ARCH_RISCV_NAME) 97diff --git a/host/lib/deps/rpclib/include/rpc/msgpack/predef/other/endian.h b/host/lib/deps/rpclib/include/rpc/msgpack/predef/other/endian.h 98index 3f367b3d4..a7c1fb4dc 100644 99--- a/host/lib/deps/rpclib/include/rpc/msgpack/predef/other/endian.h 100+++ b/host/lib/deps/rpclib/include/rpc/msgpack/predef/other/endian.h 101@@ -127,7 +127,8 @@ information and acquired knowledge: 102 defined(__AARCH64EL__) || \ 103 defined(_MIPSEL) || \ 104 defined(__MIPSEL) || \ 105- defined(__MIPSEL__) 106+ defined(__MIPSEL__) || \ 107+ defined(__riscv) 108 # undef MSGPACK_ENDIAN_LITTLE_BYTE 109 # define MSGPACK_ENDIAN_LITTLE_BYTE MSGPACK_VERSION_NUMBER_AVAILABLE 110 # endif 111-- 1122.26.2 113 114