bobbobgo / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

support the new ppc64le platform #131

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For now, the lz4 application fails during the tests when building on ppc64 
Little Endina architecture. 

It fails to identify the platform as 64 bits and as little endian.

The following patch fixes the problem (This patch was based on William Grant 
"Fix __GLIBC__ endianness check to include stdlib.h" patch)

Index: lz4-0.0~r117/lz4.c
===================================================================
--- lz4-0.0~r117.orig/lz4.c 2014-06-11 12:46:02.000000000 +0000
+++ lz4-0.0~r117/lz4.c  2014-06-11 12:48:00.000000000 +0000
@@ -56,7 +56,9 @@
 **************************************/
 /* 32 or 64 bits ? */
 #if (defined(__x86_64__) || defined(_M_X64) || defined(_WIN64) \
-  || defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) \
+  || defined(__powerpc64__) || defined(__powerpc64le__) \
+  || defined(__ppc64__) || defined(__ppc64le__) \
+  || defined(__PPC64__) || defined(__PPC64LE__) \
   || defined(__64BIT__) || defined(_LP64) || defined(__LP64__) \
   || defined(__ia64) || defined(__itanium__) || defined(_M_IA64) )   /* Detects 64 bits mode */
 #  define LZ4_ARCH64 1
@@ -68,6 +70,7 @@
  * Little Endian or Big Endian ?
  * Overwrite the #define below if you know your architecture endianess
  */
+#include <stdlib.h>
 #if defined (__GLIBC__)
 #  include <endian.h>
 #  if (__BYTE_ORDER == __BIG_ENDIAN)
Index: lz4-0.0~r117/lz4hc.c
===================================================================
--- lz4-0.0~r117.orig/lz4hc.c   2014-06-11 12:46:02.000000000 +0000
+++ lz4-0.0~r117/lz4hc.c    2014-06-11 12:48:26.000000000 +0000
@@ -54,7 +54,9 @@
 **************************************/
 /* 32 or 64 bits ? */
 #if (defined(__x86_64__) || defined(_M_X64) || defined(_WIN64) \
-  || defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) \
+  || defined(__powerpc64__) || defined(__powerpc64le__) \
+  || defined(__ppc64__) || defined(__ppc64le__) \
+  || defined(__PPC64__) || defined(__PPC64LE__) \
   || defined(__64BIT__) || defined(_LP64) || defined(__LP64__) \
   || defined(__ia64) || defined(__itanium__) || defined(_M_IA64) )   /* Detects 64 bits mode */
 #  define LZ4_ARCH64 1
@@ -66,6 +68,7 @@
  * Little Endian or Big Endian ?
  * Overwrite the #define below if you know your architecture endianess
  */
+#include <stdlib.h>
 #if defined (__GLIBC__)
 #  include <endian.h>
 #  if (__BYTE_ORDER == __BIG_ENDIAN)

Original issue reported on code.google.com by breno.le...@gmail.com on 11 Jun 2014 at 12:57

GoogleCodeExporter commented 9 years ago

Original comment by yann.col...@gmail.com on 11 Jun 2014 at 2:46

GoogleCodeExporter commented 9 years ago
Thanks for the patch.
It looks clear and simple.

I would love to find a way to test such a configuration.
Is there a way to setup a kind of virtual machine, using qemu for example, 
which would reproduce the issue ?

Regards

Original comment by yann.col...@gmail.com on 11 Jun 2014 at 2:47

GoogleCodeExporter commented 9 years ago
hi,  thanks for the interest and for accepting the patch.

you can try our rootfs on qemu (https://wiki.debian.org/ppc64el/Installation) 
or you can try to use on of our machines, through the following process:

   https://wiki.debian.org/ppc64el#Development_machines

Original comment by breno.le...@gmail.com on 11 Jun 2014 at 3:03

GoogleCodeExporter commented 9 years ago
Thanks Breno,

I'll certainly have a look at both in the near future.

Regards

Original comment by yann.col...@gmail.com on 11 Jun 2014 at 3:50

GoogleCodeExporter commented 9 years ago
The patch has been integrated into the "dev" LZ4 branch on github mirror :

https://github.com/Cyan4973/lz4/tree/dev

Original comment by yann.col...@gmail.com on 11 Jun 2014 at 9:09

GoogleCodeExporter commented 9 years ago
Fixed into r118

Original comment by yann.col...@gmail.com on 26 Jun 2014 at 9:50

GoogleCodeExporter commented 9 years ago
Great. Thank you!

Original comment by breno.le...@gmail.com on 26 Jun 2014 at 12:27