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