1*4882a593SmuzhiyunFrom e94589ed36c4a311355efc46ba3f76523c546057 Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 3*4882a593SmuzhiyunDate: Wed, 7 Aug 2019 16:17:16 +0200 4*4882a593SmuzhiyunSubject: [PATCH] Add RISC-V endian detection 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun3rdparty/msgpack-c/include/msgpack/predef/other/endian.h (which comes 7*4882a593Smuzhiyunfrom Boost) two ways of detecting the endianess: 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun (1) It includes <endian.h> if BOOST_LIB_C_GNU is defined, and then 10*4882a593Smuzhiyun use __BYTE_ORDER to decide the endianness. 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun (2) Otherwise, if (1) was not possible for some reason, it uses 13*4882a593Smuzhiyun architecture defines to decide the endianness. 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun(1) works perfectly fine with glibc toolchains, because 16*4882a593SmuzhiyunBOOST_LIB_C_GNU is defined, but it doesn't work with musl. Due to 17*4882a593Smuzhiyunthis, <endian.h> is not included, __BYTE_ORDER is not defined, and 18*4882a593Smuzhiyunmethod (1) does not work, causing build failures on musl toolchains 19*4882a593Smuzhiyunthat don't have explicit handling by architecture name (method 2). 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunSo this commit fixes RISC-V musl build by adding support for the 22*4882a593Smuzhiyun__riscv architecture define, to determine that the endianness is 23*4882a593Smuzhiyunlittle endian. 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 26*4882a593Smuzhiyun--- 27*4882a593Smuzhiyun 3rdparty/msgpack-c/include/msgpack/predef/other/endian.h | 3 ++- 28*4882a593Smuzhiyun 1 file changed, 2 insertions(+), 1 deletion(-) 29*4882a593Smuzhiyun 30*4882a593Smuzhiyundiff --git a/3rdparty/msgpack-c/include/msgpack/predef/other/endian.h b/3rdparty/msgpack-c/include/msgpack/predef/other/endian.h 31*4882a593Smuzhiyunindex 3c609fa..63a5722 100644 32*4882a593Smuzhiyun--- a/3rdparty/msgpack-c/include/msgpack/predef/other/endian.h 33*4882a593Smuzhiyun+++ b/3rdparty/msgpack-c/include/msgpack/predef/other/endian.h 34*4882a593Smuzhiyun@@ -127,7 +127,8 @@ information and acquired knowledge: 35*4882a593Smuzhiyun defined(__AARCH64EL__) || \ 36*4882a593Smuzhiyun defined(_MIPSEL) || \ 37*4882a593Smuzhiyun defined(__MIPSEL) || \ 38*4882a593Smuzhiyun- defined(__MIPSEL__) 39*4882a593Smuzhiyun+ defined(__MIPSEL__) || \ 40*4882a593Smuzhiyun+ defined(__riscv) 41*4882a593Smuzhiyun # undef MSGPACK_ENDIAN_LITTLE_BYTE 42*4882a593Smuzhiyun # define MSGPACK_ENDIAN_LITTLE_BYTE MSGPACK_VERSION_NUMBER_AVAILABLE 43*4882a593Smuzhiyun # endif 44*4882a593Smuzhiyun-- 45*4882a593Smuzhiyun2.21.0 46*4882a593Smuzhiyun 47