musl-cross.patch 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. # HG changeset patch
  2. # Parent df1a439b9058b07024ca556225d55535f5feb5dd
  3. Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
  4. diff -r df1a439b9058 libstdc++-v3/configure.host
  5. --- a/libstdc++-v3/configure.host Tue Dec 31 14:52:24 2013 -0500
  6. +++ b/libstdc++-v3/configure.host Tue Dec 31 14:54:49 2013 -0500
  7. @@ -264,6 +264,13 @@
  8. os_include_dir="os/bsd/freebsd"
  9. ;;
  10. gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
  11. + # check for musl by target
  12. + case "${host_os}" in
  13. + *-musl*)
  14. + os_include_dir="os/generic"
  15. + ;;
  16. + *)
  17. +
  18. if [ "$uclibc" = "yes" ]; then
  19. os_include_dir="os/uclibc"
  20. elif [ "$bionic" = "yes" ]; then
  21. @@ -272,6 +279,9 @@
  22. os_include_dir="os/gnu-linux"
  23. fi
  24. ;;
  25. +
  26. + esac
  27. + ;;
  28. hpux*)
  29. os_include_dir="os/hpux"
  30. ;;
  31. # HG changeset patch
  32. # Parent e5b4564f249f8634194bdabef4b3057d0e54ee97
  33. Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
  34. diff -r e5b4564f249f gcc/config.gcc
  35. --- a/gcc/config.gcc Tue Dec 31 14:54:49 2013 -0500
  36. +++ b/gcc/config.gcc Tue Dec 31 14:54:52 2013 -0500
  37. @@ -550,7 +550,7 @@
  38. esac
  39. # Common C libraries.
  40. -tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
  41. +tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
  42. # Common parts for widely ported systems.
  43. case ${target} in
  44. @@ -653,6 +653,9 @@
  45. *-*-*uclibc*)
  46. tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
  47. ;;
  48. + *-*-*musl*)
  49. + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
  50. + ;;
  51. *)
  52. tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
  53. ;;
  54. diff -r e5b4564f249f gcc/config/linux.h
  55. --- a/gcc/config/linux.h Tue Dec 31 14:54:49 2013 -0500
  56. +++ b/gcc/config/linux.h Tue Dec 31 14:54:52 2013 -0500
  57. @@ -32,10 +32,12 @@
  58. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  59. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  60. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  61. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  62. #else
  63. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  64. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  65. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  66. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  67. #endif
  68. #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
  69. @@ -53,18 +55,21 @@
  70. uClibc or Bionic is the default C library and whether
  71. -muclibc or -mglibc or -mbionic has been passed to change the default. */
  72. -#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
  73. - "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
  74. +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
  75. + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
  76. #if DEFAULT_LIBC == LIBC_GLIBC
  77. -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  78. - CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
  79. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  80. + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
  81. #elif DEFAULT_LIBC == LIBC_UCLIBC
  82. -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  83. - CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
  84. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  85. + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
  86. #elif DEFAULT_LIBC == LIBC_BIONIC
  87. -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  88. - CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
  89. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  90. + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
  91. +#elif DEFAULT_LIBC == LIBC_MUSL
  92. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  93. + CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
  94. #else
  95. #error "Unsupported DEFAULT_LIBC"
  96. #endif /* DEFAULT_LIBC */
  97. @@ -84,21 +89,21 @@
  98. #define GNU_USER_DYNAMIC_LINKER \
  99. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
  100. - BIONIC_DYNAMIC_LINKER)
  101. + BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  102. #define GNU_USER_DYNAMIC_LINKER32 \
  103. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
  104. - BIONIC_DYNAMIC_LINKER32)
  105. + BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  106. #define GNU_USER_DYNAMIC_LINKER64 \
  107. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
  108. - BIONIC_DYNAMIC_LINKER64)
  109. + BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  110. #define GNU_USER_DYNAMIC_LINKERX32 \
  111. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
  112. - BIONIC_DYNAMIC_LINKERX32)
  113. + BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
  114. /* Determine whether the entire c99 runtime
  115. is present in the runtime library. */
  116. #undef TARGET_C99_FUNCTIONS
  117. -#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
  118. +#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
  119. /* Whether we have sincos that follows the GNU extension. */
  120. #undef TARGET_HAS_SINCOS
  121. @@ -107,3 +112,74 @@
  122. /* Whether we have Bionic libc runtime */
  123. #undef TARGET_HAS_BIONIC
  124. #define TARGET_HAS_BIONIC (OPTION_BIONIC)
  125. +
  126. +/* musl avoids problematic includes by rearranging the include directories.
  127. + * Unfortunately, this is mostly duplicated from cppdefault.c */
  128. +#if DEFAULT_LIBC == LIBC_MUSL
  129. +#define INCLUDE_DEFAULTS_MUSL_GPP \
  130. + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
  131. + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
  132. + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
  133. + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
  134. + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
  135. + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
  136. +
  137. +#ifdef LOCAL_INCLUDE_DIR
  138. +#define INCLUDE_DEFAULTS_MUSL_LOCAL \
  139. + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
  140. + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
  141. +#else
  142. +#define INCLUDE_DEFAULTS_MUSL_LOCAL
  143. +#endif
  144. +
  145. +#ifdef PREFIX_INCLUDE_DIR
  146. +#define INCLUDE_DEFAULTS_MUSL_PREFIX \
  147. + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
  148. +#else
  149. +#define INCLUDE_DEFAULTS_MUSL_PREFIX
  150. +#endif
  151. +
  152. +#ifdef CROSS_INCLUDE_DIR
  153. +#define INCLUDE_DEFAULTS_MUSL_CROSS \
  154. + { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
  155. +#else
  156. +#define INCLUDE_DEFAULTS_MUSL_CROSS
  157. +#endif
  158. +
  159. +#ifdef TOOL_INCLUDE_DIR
  160. +#define INCLUDE_DEFAULTS_MUSL_TOOL \
  161. + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
  162. +#else
  163. +#define INCLUDE_DEFAULTS_MUSL_TOOL
  164. +#endif
  165. +
  166. +#ifdef NATIVE_SYSTEM_HEADER_DIR
  167. +#define INCLUDE_DEFAULTS_MUSL_NATIVE \
  168. + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
  169. + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
  170. +#else
  171. +#define INCLUDE_DEFAULTS_MUSL_NATIVE
  172. +#endif
  173. +
  174. +#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
  175. +# undef INCLUDE_DEFAULTS_MUSL_LOCAL
  176. +# define INCLUDE_DEFAULTS_MUSL_LOCAL
  177. +# undef INCLUDE_DEFAULTS_MUSL_NATIVE
  178. +# define INCLUDE_DEFAULTS_MUSL_NATIVE
  179. +#else
  180. +# undef INCLUDE_DEFAULTS_MUSL_CROSS
  181. +# define INCLUDE_DEFAULTS_MUSL_CROSS
  182. +#endif
  183. +
  184. +#undef INCLUDE_DEFAULTS
  185. +#define INCLUDE_DEFAULTS \
  186. + { \
  187. + INCLUDE_DEFAULTS_MUSL_GPP \
  188. + INCLUDE_DEFAULTS_MUSL_PREFIX \
  189. + INCLUDE_DEFAULTS_MUSL_CROSS \
  190. + INCLUDE_DEFAULTS_MUSL_TOOL \
  191. + INCLUDE_DEFAULTS_MUSL_NATIVE \
  192. + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
  193. + { 0, 0, 0, 0, 0, 0 } \
  194. + }
  195. +#endif
  196. diff -r e5b4564f249f gcc/config/linux.opt
  197. --- a/gcc/config/linux.opt Tue Dec 31 14:54:49 2013 -0500
  198. +++ b/gcc/config/linux.opt Tue Dec 31 14:54:52 2013 -0500
  199. @@ -30,3 +30,7 @@
  200. muclibc
  201. Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
  202. Use uClibc C library
  203. +
  204. +mmusl
  205. +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
  206. +Use musl C library
  207. diff -r e5b4564f249f gcc/ginclude/stddef.h
  208. --- a/gcc/ginclude/stddef.h Tue Dec 31 14:54:49 2013 -0500
  209. +++ b/gcc/ginclude/stddef.h Tue Dec 31 14:54:52 2013 -0500
  210. @@ -181,6 +181,7 @@
  211. #ifndef _GCC_SIZE_T
  212. #ifndef _SIZET_
  213. #ifndef __size_t
  214. +#ifndef __DEFINED_size_t /* musl */
  215. #define __size_t__ /* BeOS */
  216. #define __SIZE_T__ /* Cray Unicos/Mk */
  217. #define _SIZE_T
  218. @@ -197,6 +198,7 @@
  219. #define ___int_size_t_h
  220. #define _GCC_SIZE_T
  221. #define _SIZET_
  222. +#define __DEFINED_size_t /* musl */
  223. #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
  224. || defined(__FreeBSD_kernel__)
  225. /* __size_t is a typedef on FreeBSD 5, must not trash it. */
  226. @@ -214,6 +216,7 @@
  227. typedef long ssize_t;
  228. #endif /* __BEOS__ */
  229. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  230. +#endif /* __DEFINED_size_t */
  231. #endif /* __size_t */
  232. #endif /* _SIZET_ */
  233. #endif /* _GCC_SIZE_T */
  234. # HG changeset patch
  235. # Parent e08e44e39f5edde422f444487422046147d5821e
  236. A fix for libgomp to correctly request a POSIX version for time support.
  237. diff -r e08e44e39f5e libgomp/config/posix/time.c
  238. --- a/libgomp/config/posix/time.c Tue Dec 31 14:54:52 2013 -0500
  239. +++ b/libgomp/config/posix/time.c Tue Dec 31 14:54:55 2013 -0500
  240. @@ -28,6 +28,8 @@
  241. The following implementation uses the most simple POSIX routines.
  242. If present, POSIX 4 clocks should be used instead. */
  243. +#define _POSIX_C_SOURCE 199309L /* for clocks */
  244. +
  245. #include "libgomp.h"
  246. #include <unistd.h>
  247. #if TIME_WITH_SYS_TIME
  248. diff -r 809c85574bfe libgcc/unwind-dw2-fde-dip.c
  249. --- a/libgcc/unwind-dw2-fde-dip.c Tue Dec 31 14:54:55 2013 -0500
  250. +++ b/libgcc/unwind-dw2-fde-dip.c Tue Dec 31 14:54:58 2013 -0500
  251. @@ -46,33 +46,13 @@
  252. #include "unwind-compat.h"
  253. #include "gthr.h"
  254. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  255. - && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
  256. - || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
  257. +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
  258. # define USE_PT_GNU_EH_FRAME
  259. -#endif
  260. -
  261. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  262. - && defined(__BIONIC__)
  263. -# define USE_PT_GNU_EH_FRAME
  264. -#endif
  265. -
  266. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  267. - && defined(__FreeBSD__) && __FreeBSD__ >= 7
  268. -# define ElfW __ElfN
  269. -# define USE_PT_GNU_EH_FRAME
  270. -#endif
  271. -
  272. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  273. - && defined(__OpenBSD__)
  274. -# define ElfW(type) Elf_##type
  275. -# define USE_PT_GNU_EH_FRAME
  276. -#endif
  277. -
  278. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  279. - && defined(TARGET_DL_ITERATE_PHDR) \
  280. - && defined(__sun__) && defined(__svr4__)
  281. -# define USE_PT_GNU_EH_FRAME
  282. +# ifdef __OpenBSD__
  283. +# define ElfW(type) Elf_##typ
  284. +# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
  285. +# define ElfW __ElfN
  286. +# endif
  287. #endif
  288. #if defined(USE_PT_GNU_EH_FRAME)
  289. diff -r 03604918697c gcc/configure
  290. --- a/gcc/configure Tue Dec 31 14:54:58 2013 -0500
  291. +++ b/gcc/configure Tue Dec 31 14:55:01 2013 -0500
  292. @@ -26739,6 +26739,9 @@
  293. else
  294. gcc_cv_libc_provides_ssp=no
  295. case "$target" in
  296. + *-*-musl*)
  297. + # All versions of musl provide stack protector
  298. + gcc_cv_libc_provides_ssp=yes;;
  299. *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
  300. # glibc 2.4 and later provides __stack_chk_fail and
  301. # either __stack_chk_guard, or TLS access to stack guard canary.
  302. @@ -26772,6 +26775,7 @@
  303. # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  304. # simply assert that glibc does provide this, which is true for all
  305. # realistically usable GNU/Hurd configurations.
  306. + # All supported versions of musl provide it as well
  307. gcc_cv_libc_provides_ssp=yes;;
  308. *-*-darwin* | *-*-freebsd*)
  309. ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
  310. @@ -26854,6 +26858,9 @@
  311. gcc_cv_target_dl_iterate_phdr=no
  312. fi
  313. ;;
  314. + *-linux-musl*)
  315. + gcc_cv_target_dl_iterate_phdr=yes
  316. + ;;
  317. esac
  318. if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  319. diff -r 03604918697c gcc/configure.ac
  320. --- a/gcc/configure.ac Tue Dec 31 14:54:58 2013 -0500
  321. +++ b/gcc/configure.ac Tue Dec 31 14:55:01 2013 -0500
  322. @@ -4722,6 +4722,9 @@
  323. gcc_cv_libc_provides_ssp,
  324. [gcc_cv_libc_provides_ssp=no
  325. case "$target" in
  326. + *-*-musl*)
  327. + # All versions of musl provide stack protector
  328. + gcc_cv_libc_provides_ssp=yes;;
  329. *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
  330. [# glibc 2.4 and later provides __stack_chk_fail and
  331. # either __stack_chk_guard, or TLS access to stack guard canary.
  332. @@ -4755,6 +4758,7 @@
  333. # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  334. # simply assert that glibc does provide this, which is true for all
  335. # realistically usable GNU/Hurd configurations.
  336. + # All supported versions of musl provide it as well
  337. gcc_cv_libc_provides_ssp=yes;;
  338. *-*-darwin* | *-*-freebsd*)
  339. AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
  340. @@ -4820,6 +4824,9 @@
  341. gcc_cv_target_dl_iterate_phdr=no
  342. fi
  343. ;;
  344. + *-linux-musl*)
  345. + gcc_cv_target_dl_iterate_phdr=yes
  346. + ;;
  347. esac
  348. GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
  349. if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  350. # HG changeset patch
  351. # Parent 600a8a422ccaf5627ad1f5a138e7398df2b9e9d8
  352. Get rid of ever-broken fixincludes on musl.
  353. diff -r 600a8a422cca fixincludes/mkfixinc.sh
  354. --- a/fixincludes/mkfixinc.sh Tue Dec 31 14:55:01 2013 -0500
  355. +++ b/fixincludes/mkfixinc.sh Tue Dec 31 14:55:04 2013 -0500
  356. @@ -19,7 +19,8 @@
  357. powerpc-*-eabi* | \
  358. powerpc-*-rtems* | \
  359. powerpcle-*-eabisim* | \
  360. - powerpcle-*-eabi* )
  361. + powerpcle-*-eabi* | \
  362. + *-musl* )
  363. # IF there is no include fixing,
  364. # THEN create a no-op fixer and exit
  365. (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
  366. # HG changeset patch
  367. # Parent 4696c3bf3d913eca88e9385ea9717541dfe1e033
  368. Support for i386-linux-musl and x86_64-linux-musl.
  369. diff -r 4696c3bf3d91 gcc/config/i386/linux.h
  370. --- a/gcc/config/i386/linux.h Tue Dec 31 14:55:04 2013 -0500
  371. +++ b/gcc/config/i386/linux.h Tue Dec 31 14:55:08 2013 -0500
  372. @@ -21,3 +21,4 @@
  373. #define GNU_USER_LINK_EMULATION "elf_i386"
  374. #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  375. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
  376. diff -r 4696c3bf3d91 gcc/config/i386/linux64.h
  377. --- a/gcc/config/i386/linux64.h Tue Dec 31 14:55:04 2013 -0500
  378. +++ b/gcc/config/i386/linux64.h Tue Dec 31 14:55:08 2013 -0500
  379. @@ -30,3 +30,7 @@
  380. #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
  381. #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
  382. #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
  383. +
  384. +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
  385. +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
  386. +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
  387. diff -r 4696c3bf3d91 libitm/config/linux/x86/tls.h
  388. --- a/libitm/config/linux/x86/tls.h Tue Dec 31 14:55:04 2013 -0500
  389. +++ b/libitm/config/linux/x86/tls.h Tue Dec 31 14:55:08 2013 -0500
  390. @@ -25,16 +25,19 @@
  391. #ifndef LIBITM_X86_TLS_H
  392. #define LIBITM_X86_TLS_H 1
  393. -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  394. +#if defined(__GLIBC_PREREQ)
  395. +#if __GLIBC_PREREQ(2, 10)
  396. /* Use slots in the TCB head rather than __thread lookups.
  397. GLIBC has reserved words 10 through 13 for TM. */
  398. #define HAVE_ARCH_GTM_THREAD 1
  399. #define HAVE_ARCH_GTM_THREAD_DISP 1
  400. #endif
  401. +#endif
  402. #include "config/generic/tls.h"
  403. -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  404. +#if defined(__GLIBC_PREREQ)
  405. +#if __GLIBC_PREREQ(2, 10)
  406. namespace GTM HIDDEN {
  407. #ifdef __x86_64__
  408. @@ -101,5 +104,6 @@
  409. } // namespace GTM
  410. #endif /* >= GLIBC 2.10 */
  411. +#endif
  412. #endif // LIBITM_X86_TLS_H
  413. # HG changeset patch
  414. # Parent 6738fd6f6fcc2a72f2ba527bda3325642af26885
  415. Support for arm-linux-musl.
  416. diff -r 6738fd6f6fcc gcc/config/arm/linux-eabi.h
  417. --- a/gcc/config/arm/linux-eabi.h Tue Dec 31 14:55:08 2013 -0500
  418. +++ b/gcc/config/arm/linux-eabi.h Tue Dec 31 14:55:11 2013 -0500
  419. @@ -77,6 +77,23 @@
  420. %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
  421. %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
  422. +/* For ARM musl currently supports four dynamic linkers:
  423. + - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
  424. + - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
  425. + - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
  426. + - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
  427. + musl does not support the legacy OABI mode.
  428. + All the dynamic linkers live in /lib.
  429. + We default to soft-float, EL. */
  430. +#undef MUSL_DYNAMIC_LINKER
  431. +#if TARGET_BIG_ENDIAN_DEFAULT
  432. +#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
  433. +#else
  434. +#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
  435. +#endif
  436. +#define MUSL_DYNAMIC_LINKER \
  437. + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
  438. +
  439. /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
  440. use the GNU/Linux version, not the generic BPABI version. */
  441. #undef LINK_SPEC
  442. diff -r 6738fd6f6fcc libitm/config/arm/hwcap.cc
  443. --- a/libitm/config/arm/hwcap.cc Tue Dec 31 14:55:08 2013 -0500
  444. +++ b/libitm/config/arm/hwcap.cc Tue Dec 31 14:55:11 2013 -0500
  445. @@ -40,7 +40,11 @@
  446. #ifdef __linux__
  447. #include <unistd.h>
  448. +#ifdef __GLIBC__
  449. #include <sys/fcntl.h>
  450. +#else
  451. +#include <fcntl.h>
  452. +#endif
  453. #include <elf.h>
  454. static void __attribute__((constructor))
  455. # HG changeset patch
  456. # Parent 7d7383f638705a01fdc18e0e7e0c9cdb6387fc5d
  457. Support for mips-linux-musl.
  458. diff -r 7d7383f63870 gcc/config/mips/linux.h
  459. --- a/gcc/config/mips/linux.h Tue Dec 31 14:55:11 2013 -0500
  460. +++ b/gcc/config/mips/linux.h Tue Dec 31 14:55:14 2013 -0500
  461. @@ -18,3 +18,10 @@
  462. <http://www.gnu.org/licenses/>. */
  463. #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  464. +
  465. +#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
  466. +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
  467. +#else
  468. +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
  469. +#endif
  470. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
  471. # HG changeset patch
  472. # Parent 89df6d7e91c686da676ce27ef9b9d10522810c26
  473. Support for powerpc-linux-musl.
  474. diff -r 89df6d7e91c6 gcc/config.gcc
  475. --- a/gcc/config.gcc Tue Dec 31 14:55:14 2013 -0500
  476. +++ b/gcc/config.gcc Tue Dec 31 14:55:17 2013 -0500
  477. @@ -2117,6 +2117,10 @@
  478. powerpc*-*-linux*paired*)
  479. tm_file="${tm_file} rs6000/750cl.h" ;;
  480. esac
  481. + case ${target} in
  482. + *-linux*-musl*)
  483. + enable_secureplt=yes ;;
  484. + esac
  485. if test x${enable_secureplt} = xyes; then
  486. tm_file="rs6000/secureplt.h ${tm_file}"
  487. fi
  488. diff -r 89df6d7e91c6 gcc/config/rs6000/linux64.h
  489. --- a/gcc/config/rs6000/linux64.h Tue Dec 31 14:55:14 2013 -0500
  490. +++ b/gcc/config/rs6000/linux64.h Tue Dec 31 14:55:17 2013 -0500
  491. @@ -354,17 +354,21 @@
  492. #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
  493. #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
  494. #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
  495. +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
  496. +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
  497. #if DEFAULT_LIBC == LIBC_UCLIBC
  498. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  499. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  500. #elif DEFAULT_LIBC == LIBC_GLIBC
  501. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  502. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  503. +#elif DEFAULT_LIBC == LIBC_MUSL
  504. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  505. #else
  506. #error "Unsupported DEFAULT_LIBC"
  507. #endif
  508. #define GNU_USER_DYNAMIC_LINKER32 \
  509. - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
  510. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  511. #define GNU_USER_DYNAMIC_LINKER64 \
  512. - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
  513. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  514. #undef DEFAULT_ASM_ENDIAN
  515. #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
  516. diff -r 89df6d7e91c6 gcc/config/rs6000/secureplt.h
  517. --- a/gcc/config/rs6000/secureplt.h Tue Dec 31 14:55:14 2013 -0500
  518. +++ b/gcc/config/rs6000/secureplt.h Tue Dec 31 14:55:17 2013 -0500
  519. @@ -18,3 +18,4 @@
  520. <http://www.gnu.org/licenses/>. */
  521. #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
  522. +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
  523. diff -r 89df6d7e91c6 gcc/config/rs6000/sysv4.h
  524. --- a/gcc/config/rs6000/sysv4.h Tue Dec 31 14:55:14 2013 -0500
  525. +++ b/gcc/config/rs6000/sysv4.h Tue Dec 31 14:55:17 2013 -0500
  526. @@ -550,6 +550,9 @@
  527. #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
  528. #define CC1_SECURE_PLT_DEFAULT_SPEC ""
  529. #endif
  530. +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
  531. +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
  532. +#endif
  533. /* Pass -G xxx to the compiler and set correct endian mode. */
  534. #define CC1_SPEC "%{G*} %(cc1_cpu)" \
  535. @@ -600,7 +603,8 @@
  536. /* Override the default target of the linker. */
  537. #define LINK_TARGET_SPEC \
  538. - ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
  539. + ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
  540. + "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
  541. /* Any specific OS flags. */
  542. #define LINK_OS_SPEC "\
  543. @@ -778,15 +782,18 @@
  544. #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  545. #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
  546. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
  547. #if DEFAULT_LIBC == LIBC_UCLIBC
  548. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  549. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  550. +#elif DEFAULT_LIBC == LIBC_MUSL
  551. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  552. #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
  553. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  554. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  555. #else
  556. #error "Unsupported DEFAULT_LIBC"
  557. #endif
  558. #define GNU_USER_DYNAMIC_LINKER \
  559. - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
  560. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  561. #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
  562. %{rdynamic:-export-dynamic} \
  563. @@ -912,6 +919,7 @@
  564. { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
  565. { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
  566. { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
  567. + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
  568. { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
  569. { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
  570. { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
  571. diff -r d7ce17b2f2d6 gcc/config/aarch64/aarch64-linux.h
  572. --- a/gcc/config/aarch64/aarch64-linux.h Tue Dec 31 14:55:17 2013 -0500
  573. +++ b/gcc/config/aarch64/aarch64-linux.h Tue Dec 31 14:55:20 2013 -0500
  574. @@ -21,7 +21,11 @@
  575. #ifndef GCC_AARCH64_LINUX_H
  576. #define GCC_AARCH64_LINUX_H
  577. +/* The AArch64 port currently supports two dynamic linkers:
  578. + - ld-linux-aarch64.so.1 - GLIBC dynamic linker
  579. + - ld-musl-aarch64.so.1 - musl libc dynamic linker */
  580. #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
  581. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
  582. #define CPP_SPEC "%{pthread:-D_REENTRANT}"
  583. # HG changeset patch
  584. # Parent f2601e4063d0d58d8ab04185e8baefd560d09496
  585. Microblaze support (again).
  586. diff -r f2601e4063d0 -r 0736dfe1aa0d gcc/config/microblaze/linux.h
  587. --- a/gcc/config/microblaze/linux.h Tue Dec 31 14:55:20 2013 -0500
  588. +++ b/gcc/config/microblaze/linux.h Tue Dec 31 15:09:52 2013 -0500
  589. @@ -25,7 +25,22 @@
  590. #undef TLS_NEEDS_GOT
  591. #define TLS_NEEDS_GOT 1
  592. -#define DYNAMIC_LINKER "/lib/ld.so.1"
  593. +#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
  594. +#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
  595. +#else
  596. +#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
  597. +#endif
  598. +
  599. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
  600. +#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  601. +
  602. +#if DEFAULT_LIBC == LIBC_MUSL
  603. +#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
  604. +#else
  605. +#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
  606. +#endif
  607. +
  608. +
  609. #undef SUBTARGET_EXTRA_SPECS
  610. #define SUBTARGET_EXTRA_SPECS \
  611. { "dynamic_linker", DYNAMIC_LINKER }
  612. From 478ee0c03a08e2ef9371fd88d516738936943e78 Mon Sep 17 00:00:00 2001
  613. From: David Holsgrove <david.holsgrove@xilinx.com>
  614. Date: Fri, 28 Sep 2012 16:32:03 +1000
  615. Subject: [PATCH 06/11] [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to
  616. microblaze.h
  617. Fixes warnings like;
  618. warning: format '%zX' expects argument of type 'size_t',
  619. but argument 3 has type 'unsigned int' [-Wformat]
  620. Changelog
  621. 2013-03-18 David Holsgrove <david.holsgrove@xilinx.com>
  622. * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
  623. and PTRDIFF_TYPE.
  624. Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
  625. ---
  626. gcc/config/microblaze/microblaze.h | 6 ++++++
  627. 1 file changed, 6 insertions(+)
  628. diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
  629. index 19cdfed..e772a3f 100644
  630. --- a/gcc/config/microblaze/microblaze.h
  631. +++ b/gcc/config/microblaze/microblaze.h
  632. @@ -213,6 +213,12 @@ extern enum pipeline_type microblaze_pipe;
  633. #define STRICT_ALIGNMENT 1
  634. #define PCC_BITFIELD_TYPE_MATTERS 1
  635. +#undef SIZE_TYPE
  636. +#define SIZE_TYPE "unsigned int"
  637. +
  638. +#undef PTRDIFF_TYPE
  639. +#define PTRDIFF_TYPE "int"
  640. +
  641. #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
  642. ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
  643. && (ALIGN) < BITS_PER_WORD \
  644. --
  645. 1.7.9.5