0004-Fix-endianess-detection-with-musl-based-toolchains.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 61b076689b6308b1c9d0d84ee8654a47e65e67ae 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 1/1] 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. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  15. ---
  16. configure.ac | 1 +
  17. src/amd/Makefile.addrlib.am | 1 +
  18. src/util/u_endian.h | 2 +-
  19. 3 files changed, 3 insertions(+), 1 deletion(-)
  20. diff --git a/configure.ac b/configure.ac
  21. index 4761c59..7991b52 100644
  22. --- a/configure.ac
  23. +++ b/configure.ac
  24. @@ -786,6 +786,7 @@ fi
  25. AC_HEADER_MAJOR
  26. AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
  27. AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
  28. +AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"])
  29. AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
  30. AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
  31. diff --git a/src/amd/Makefile.addrlib.am b/src/amd/Makefile.addrlib.am
  32. index 64823fc..4e2fb1d 100644
  33. --- a/src/amd/Makefile.addrlib.am
  34. +++ b/src/amd/Makefile.addrlib.am
  35. @@ -28,6 +28,7 @@ addrlib_libamdgpu_addrlib_la_CPPFLAGS = \
  36. -I$(srcdir)/addrlib/core \
  37. -I$(srcdir)/addrlib/inc/chip/r800 \
  38. -I$(srcdir)/addrlib/r800/chip \
  39. + $(DEFINES) \
  40. -DBRAHMA_BUILD=1
  41. addrlib_libamdgpu_addrlib_la_CXXFLAGS = \
  42. diff --git a/src/util/u_endian.h b/src/util/u_endian.h
  43. index b9d563d..266fb4a 100644
  44. --- a/src/util/u_endian.h
  45. +++ b/src/util/u_endian.h
  46. @@ -27,7 +27,7 @@
  47. #ifndef U_ENDIAN_H
  48. #define U_ENDIAN_H
  49. -#if defined(__GLIBC__) || defined(ANDROID)
  50. +#if defined(__GLIBC__) || defined(ANDROID) || defined(HAVE_ENDIAN_H)
  51. #include <endian.h>
  52. #if __BYTE_ORDER == __LITTLE_ENDIAN
  53. --
  54. 2.10.1