0001-Add-RISC-V-endian-detection.patch 1.8 KB

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