905-add-musl-support-to-gcc.patch 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
  2. Date: Fri, 8 May 2015 08:30:40 +0000 (+0000)
  3. Subject: [PATCH 0/13] Add musl support to GCC
  4. X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=f2d678afa5b8385d763b93772d73d6bf80a9739e
  5. [PATCH 0/13] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222905 138bc75d-0d04-0410-961f-82ee72b054a4
  15. ---
  16. Index: b/gcc/config/alpha/linux.h
  17. ===================================================================
  18. --- a/gcc/config/alpha/linux.h
  19. +++ b/gcc/config/alpha/linux.h
  20. @@ -61,10 +61,14 @@
  21. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  22. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  23. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  24. +#undef OPTION_MUSL
  25. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  26. #else
  27. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  28. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  29. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  30. +#undef OPTION_MUSL
  31. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  32. #endif
  33. /* Determine what functions are present at the runtime;
  34. Index: b/gcc/config/glibc-stdint.h
  35. ===================================================================
  36. --- a/gcc/config/glibc-stdint.h
  37. +++ b/gcc/config/glibc-stdint.h
  38. @@ -22,6 +22,12 @@
  39. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  40. <http://www.gnu.org/licenses/>. */
  41. +/* Systems using musl libc should use this header and make sure
  42. + OPTION_MUSL is defined correctly before using the TYPE macros. */
  43. +#ifndef OPTION_MUSL
  44. +#define OPTION_MUSL 0
  45. +#endif
  46. +
  47. #define SIG_ATOMIC_TYPE "int"
  48. #define INT8_TYPE "signed char"
  49. @@ -43,12 +49,12 @@
  50. #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
  51. #define INT_FAST8_TYPE "signed char"
  52. -#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  53. -#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  54. +#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
  55. +#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
  56. #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
  57. #define UINT_FAST8_TYPE "unsigned char"
  58. -#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
  59. -#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
  60. +#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
  61. +#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
  62. #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
  63. #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  64. Index: b/gcc/config/linux.h
  65. ===================================================================
  66. --- a/gcc/config/linux.h
  67. +++ b/gcc/config/linux.h
  68. @@ -32,11 +32,13 @@
  69. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  70. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  71. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  72. +#undef OPTION_MUSL
  73. #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  74. #else
  75. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  76. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  77. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  78. +#undef OPTION_MUSL
  79. #define OPTION_MUSL (linux_libc == LIBC_MUSL)
  80. #endif
  81. Index: b/gcc/config/rs6000/linux.h
  82. ===================================================================
  83. --- a/gcc/config/rs6000/linux.h
  84. +++ b/gcc/config/rs6000/linux.h
  85. @@ -30,10 +30,14 @@
  86. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  87. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  88. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  89. +#undef OPTION_MUSL
  90. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  91. #else
  92. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  93. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  94. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  95. +#undef OPTION_MUSL
  96. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  97. #endif
  98. /* Determine what functions are present at the runtime;
  99. Index: b/gcc/config/rs6000/linux64.h
  100. ===================================================================
  101. --- a/gcc/config/rs6000/linux64.h
  102. +++ b/gcc/config/rs6000/linux64.h
  103. @@ -299,10 +299,14 @@
  104. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  105. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  106. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  107. +#undef OPTION_MUSL
  108. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  109. #else
  110. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  111. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  112. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  113. +#undef OPTION_MUSL
  114. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  115. #endif
  116. /* Determine what functions are present at the runtime;