logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

0006-add-musl-support-to-gcc.patch (3086B)


  1. SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
  2. SPDX-FileCopyrightText: 2015 Szabolcs Nagy <szabolcs.nagy@arm.com>
  3. SPDX-License-Identifier: GPL-2.0-or-later
  4. Backported from upstream commit 07ad804bfdbe0fa3406c5f2ff51d7c4c29a783c8
  5. Add musl support to GCC
  6. 2015-05-08 Szabolcs Nagy <szabolcs.nagy@arm.com>
  7. * config/glibc-stdint.h (OPTION_MUSL): Define.
  8. (INT_FAST16_TYPE, INT_FAST32_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE):
  9. Change the definition based on OPTION_MUSL for 64 bit targets.
  10. * config/linux.h (OPTION_MUSL): Redefine.
  11. * config/alpha/linux.h (OPTION_MUSL): Redefine.
  12. * config/rs6000/linux.h (OPTION_MUSL): Redefine.
  13. * config/rs6000/linux64.h (OPTION_MUSL): Redefine.
  14. From-SVN: r222905
  15. --- gcc-4.7.4/gcc/config/glibc-stdint.h
  16. +++ gcc-4.7.4/gcc/config/glibc-stdint.h
  17. @@ -22,6 +22,12 @@ a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. +/* Systems using musl libc should use this header and make sure
  21. + OPTION_MUSL is defined correctly before using the TYPE macros. */
  22. +#ifndef OPTION_MUSL
  23. +#define OPTION_MUSL 0
  24. +#endif
  25. +
  26. #define SIG_ATOMIC_TYPE "int"
  27. #define INT8_TYPE "signed char"
  28. @@ -43,12 +49,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  29. #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
  30. #define INT_FAST8_TYPE "signed char"
  31. -#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  32. -#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  33. +#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
  34. +#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
  35. #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
  36. #define UINT_FAST8_TYPE "unsigned char"
  37. -#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
  38. -#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
  39. +#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
  40. +#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
  41. #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
  42. #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  43. --- gcc-4.7.4/gcc/config/linux.h
  44. +++ gcc-4.7.4/gcc/config/linux.h
  45. @@ -33,11 +33,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  46. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  47. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  48. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  49. +#undef OPTION_MUSL
  50. #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  51. #else
  52. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  53. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  54. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  55. +#undef OPTION_MUSL
  56. #define OPTION_MUSL (linux_libc == LIBC_MUSL)
  57. #endif