1
0

250-add-musl.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. --- a/gcc/config/alpha/linux.h
  17. +++ b/gcc/config/alpha/linux.h
  18. @@ -61,10 +61,14 @@ along with GCC; see the file COPYING3.
  19. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  20. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  21. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  22. +#undef OPTION_MUSL
  23. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  24. #else
  25. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  26. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  27. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  28. +#undef OPTION_MUSL
  29. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  30. #endif
  31. /* Determine what functions are present at the runtime;
  32. --- a/gcc/config/glibc-stdint.h
  33. +++ b/gcc/config/glibc-stdint.h
  34. @@ -22,6 +22,12 @@ a copy of the GCC Runtime Library Except
  35. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  36. <http://www.gnu.org/licenses/>. */
  37. +/* Systems using musl libc should use this header and make sure
  38. + OPTION_MUSL is defined correctly before using the TYPE macros. */
  39. +#ifndef OPTION_MUSL
  40. +#define OPTION_MUSL 0
  41. +#endif
  42. +
  43. #define SIG_ATOMIC_TYPE "int"
  44. #define INT8_TYPE "signed char"
  45. @@ -43,12 +49,12 @@ see the files COPYING3 and COPYING.RUNTI
  46. #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
  47. #define INT_FAST8_TYPE "signed char"
  48. -#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  49. -#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  50. +#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
  51. +#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
  52. #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
  53. #define UINT_FAST8_TYPE "unsigned char"
  54. -#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
  55. -#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
  56. +#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
  57. +#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
  58. #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
  59. #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
  60. --- a/gcc/config/linux.h
  61. +++ b/gcc/config/linux.h
  62. @@ -32,11 +32,13 @@ see the files COPYING3 and COPYING.RUNTI
  63. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  64. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  65. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  66. +#undef OPTION_MUSL
  67. #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  68. #else
  69. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  70. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  71. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  72. +#undef OPTION_MUSL
  73. #define OPTION_MUSL (linux_libc == LIBC_MUSL)
  74. #endif
  75. --- a/gcc/config/rs6000/linux.h
  76. +++ b/gcc/config/rs6000/linux.h
  77. @@ -30,10 +30,14 @@
  78. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  79. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  80. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  81. +#undef OPTION_MUSL
  82. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  83. #else
  84. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  85. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  86. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  87. +#undef OPTION_MUSL
  88. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  89. #endif
  90. /* Determine what functions are present at the runtime;
  91. --- a/gcc/config/rs6000/linux64.h
  92. +++ b/gcc/config/rs6000/linux64.h
  93. @@ -299,10 +299,14 @@ extern int dot_symbols;
  94. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  95. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  96. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  97. +#undef OPTION_MUSL
  98. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  99. #else
  100. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  101. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  102. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  103. +#undef OPTION_MUSL
  104. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  105. #endif
  106. /* Determine what functions are present at the runtime;