0004-add-riscv-endian-detection.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. Add RISC-V endian detection
  2. boost/predef/other/endian.h has two ways of detecting the endianess:
  3. (1) It includes <endian.h> if BOOST_LIB_C_GNU is defined, and then
  4. use __BYTE_ORDER to decide the endianness.
  5. (2) Otherwise, if (1) was not possible for some reason, it uses
  6. architecture defines to decide the endianness.
  7. (1) works perfectly fine with glibc toolchains, because
  8. BOOST_LIB_C_GNU is defined, but it doesn't work with musl. Due to
  9. this, <endian.h> is not included, __BYTE_ORDER is not defined, and
  10. method (1) does not work, causing build failures on musl toolchains
  11. that don't have explicit handling by architecture name (method 2).
  12. So this commit fixes RISC-V musl build by adding support for the
  13. __riscv architecture define, to determine that the endianness is
  14. little endian.
  15. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  16. Index: b/boost/predef/other/endian.h
  17. ===================================================================
  18. --- a/boost/predef/other/endian.h
  19. +++ b/boost/predef/other/endian.h
  20. @@ -127,7 +127,8 @@
  21. defined(__AARCH64EL__) || \
  22. defined(_MIPSEL) || \
  23. defined(__MIPSEL) || \
  24. - defined(__MIPSEL__)
  25. + defined(__MIPSEL__) || \
  26. + defined(__riscv)
  27. # undef BOOST_ENDIAN_LITTLE_BYTE
  28. # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE
  29. # endif