On 29/4/25 16:30, Hongbo Li wrote:


On 2025/4/29 15:30, Alexander Egorenkov wrote:
From: Super User <[email protected]>

Macros __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN are defined in
user space header 'endian.h'. Not including this header results in
the condition #if __BYTE_ORDER == __LITTLE_ENDIAN being always true, even on BE architectures (e.g. s390x). Due to this bug the compressor library was
built for LE byte-order on BE arch s390x.

Fixes: bc99c763e3fe ("erofs-utils: switch to effective unaligned access")
Signed-off-by: Alexander Egorenkov <[email protected]>
---
  include/erofs/defs.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/include/erofs/defs.h b/include/erofs/defs.h
index 051a270531ca..196dfa8191a8 100644
--- a/include/erofs/defs.h
+++ b/include/erofs/defs.h
@@ -19,6 +19,7 @@ extern "C"
  #include <inttypes.h>
  #include <limits.h>
  #include <stdbool.h>
+#include <endian.h>

Reviewed-by: Hongbo Li <[email protected]>

Yes, it makes sense.

Reviewed-by: Ian Kent <[email protected]>


Reply via email to