0002-Fix-endianess-detection-with-musl-based-toolchains.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 4135bd2e13880866deb0440855d1a869397e5024 Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Fri, 4 Nov 2016 19:44:37 +0100
  4. Subject: [PATCH] Fix endianess detection with musl-based toolchains
  5. Musl does not define __GLIBC__ and will not provide a __MUSL__ macro:
  6. http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F
  7. This patch checks for the presence of endian.h and promotes the result
  8. to src/amd/Makefile.addrlib.am which executes the broken build command.
  9. Fixes compile errors detected by the autobuilder infrastructure of the
  10. buildroot project:
  11. http://autobuild.buildroot.net/results/e27/e27a9a95f72dba3076549beb2a2ccfdbea2fcfee/
  12. http://autobuild.buildroot.net/results/e27/e27a9a95f72dba3076549beb2a2ccfdbea2fcfee/
  13. Patch sent upstream: https://patchwork.freedesktop.org/patch/119961/
  14. [Bernd: rebase on mesa 18.0.0]
  15. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  16. [Romain: rebase on mesa 17.3.1]
  17. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  18. ---
  19. configure.ac | 1 +
  20. src/amd/Makefile.addrlib.am | 1 +
  21. src/util/u_endian.h | 2 +-
  22. 3 files changed, 3 insertions(+), 1 deletion(-)
  23. diff --git a/configure.ac b/configure.ac
  24. index a02173f244..ee03d6f582 100644
  25. --- a/configure.ac
  26. +++ b/configure.ac
  27. @@ -791,6 +791,7 @@ fi
  28. AC_HEADER_MAJOR
  29. AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
  30. AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
  31. +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"])
  32. AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
  33. AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
  34. AC_CHECK_FUNC([memfd_create], [DEFINES="$DEFINES -DHAVE_MEMFD_CREATE"])
  35. diff --git a/src/amd/Makefile.addrlib.am b/src/amd/Makefile.addrlib.am
  36. index 46689637f9..508edfd0d5 100644
  37. --- a/src/amd/Makefile.addrlib.am
  38. +++ b/src/amd/Makefile.addrlib.am
  39. @@ -29,7 +29,8 @@
  40. -I$(srcdir)/addrlib/inc/chip/gfx9 \
  41. -I$(srcdir)/addrlib/inc/chip/r800 \
  42. -I$(srcdir)/addrlib/gfx9/chip \
  43. - -I$(srcdir)/addrlib/r800/chip
  44. + -I$(srcdir)/addrlib/r800/chip \
  45. + $(DEFINES)
  46. addrlib_libamdgpu_addrlib_la_CXXFLAGS = \
  47. $(VISIBILITY_CXXFLAGS) $(CXX11_CXXFLAGS)
  48. diff --git a/src/util/u_endian.h b/src/util/u_endian.h
  49. index 9e09f80181..038a28fac9 100644
  50. --- a/src/util/u_endian.h
  51. +++ b/src/util/u_endian.h
  52. @@ -27,7 +27,7 @@
  53. #ifndef U_ENDIAN_H
  54. #define U_ENDIAN_H
  55. -#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__)
  56. +#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) || defined(HAVE_ENDIAN_H)
  57. #include <endian.h>
  58. #if __BYTE_ORDER == __LITTLE_ENDIAN
  59. --
  60. 2.14.3