1
0

musl-cross.patch 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. diff -Nur gcc-4.7.3.orig/config.sub gcc-4.7.3/config.sub
  2. --- gcc-4.7.3.orig/config.sub 2012-08-06 16:34:27.000000000 +0200
  3. +++ gcc-4.7.3/config.sub 2013-09-16 15:39:42.000000000 +0200
  4. @@ -4,7 +4,7 @@
  5. # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
  6. # 2011 Free Software Foundation, Inc.
  7. -timestamp='2011-10-29'
  8. +timestamp='2011-03-23'
  9. # This file is (in principle) common to ALL GNU software.
  10. # The presence of a machine in this file suggests that SOME GNU software
  11. @@ -125,6 +125,7 @@
  12. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
  13. case $maybe_os in
  14. nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
  15. + linux-musl* | \
  16. linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
  17. knetbsd*-gnu* | netbsd*-gnu* | \
  18. kopensolaris*-gnu* | \
  19. @@ -251,17 +252,13 @@
  20. | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
  21. | am33_2.0 \
  22. | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
  23. - | be32 | be64 \
  24. | bfin \
  25. | c4x | clipper \
  26. | d10v | d30v | dlx | dsp16xx \
  27. - | epiphany \
  28. | fido | fr30 | frv \
  29. | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
  30. - | hexagon \
  31. | i370 | i860 | i960 | ia64 \
  32. | ip2k | iq2000 \
  33. - | le32 | le64 \
  34. | lm32 \
  35. | m32c | m32r | m32rle | m68000 | m68k | m88k \
  36. | maxq | mb | microblaze | mcore | mep | metag \
  37. @@ -295,7 +292,7 @@
  38. | pdp10 | pdp11 | pj | pjl \
  39. | powerpc | powerpc64 | powerpc64le | powerpcle \
  40. | pyramid \
  41. - | rl78 | rx \
  42. + | rx \
  43. | score \
  44. | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
  45. | sh64 | sh64le \
  46. @@ -304,7 +301,7 @@
  47. | spu \
  48. | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
  49. | ubicom32 \
  50. - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
  51. + | v850 | v850e \
  52. | we32k \
  53. | x86 | xc16x | xstormy16 | xtensa \
  54. | z8k | z80)
  55. @@ -361,7 +358,6 @@
  56. | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
  57. | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
  58. | avr-* | avr32-* \
  59. - | be32-* | be64-* \
  60. | bfin-* | bs2000-* \
  61. | c[123]* | c30-* | [cjt]90-* | c4x-* \
  62. | clipper-* | craynv-* | cydra-* \
  63. @@ -370,10 +366,8 @@
  64. | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
  65. | h8300-* | h8500-* \
  66. | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
  67. - | hexagon-* \
  68. | i*86-* | i860-* | i960-* | ia64-* \
  69. | ip2k-* | iq2000-* \
  70. - | le32-* | le64-* \
  71. | lm32-* \
  72. | m32c-* | m32r-* | m32rle-* \
  73. | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
  74. @@ -407,7 +401,7 @@
  75. | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
  76. | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
  77. | pyramid-* \
  78. - | rl78-* | romp-* | rs6000-* | rx-* \
  79. + | romp-* | rs6000-* | rx-* \
  80. | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
  81. | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
  82. | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
  83. @@ -415,11 +409,10 @@
  84. | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
  85. | tahoe-* \
  86. | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
  87. - | tile*-* \
  88. + | tile-* | tilegx-* \
  89. | tron-* \
  90. | ubicom32-* \
  91. - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
  92. - | vax-* \
  93. + | v850-* | v850e-* | vax-* \
  94. | we32k-* \
  95. | x86-* | x86_64-* | xc16x-* | xps100-* \
  96. | xstormy16-* | xtensa*-* \
  97. @@ -820,10 +813,6 @@
  98. basic_machine=i370-ibm
  99. os=-mvs
  100. ;;
  101. - nacl)
  102. - basic_machine=le32-unknown
  103. - os=-nacl
  104. - ;;
  105. ncr3000)
  106. basic_machine=i486-ncr
  107. os=-sysv4
  108. @@ -1132,8 +1121,13 @@
  109. basic_machine=t90-cray
  110. os=-unicos
  111. ;;
  112. + # This must be matched before tile*.
  113. + tilegx*)
  114. + basic_machine=tilegx-unknown
  115. + os=-linux-gnu
  116. + ;;
  117. tile*)
  118. - basic_machine=$basic_machine-unknown
  119. + basic_machine=tile-unknown
  120. os=-linux-gnu
  121. ;;
  122. tx39)
  123. @@ -1346,6 +1340,7 @@
  124. | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
  125. | -mingw32* | -linux-gnu* | -linux-android* \
  126. | -linux-newlib* | -linux-uclibc* \
  127. + | -linux-musl* \
  128. | -uxpv* | -beos* | -mpeix* | -udk* \
  129. | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
  130. | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
  131. diff -Nur gcc-4.7.3.orig/fixincludes/mkfixinc.sh gcc-4.7.3/fixincludes/mkfixinc.sh
  132. --- gcc-4.7.3.orig/fixincludes/mkfixinc.sh 2011-09-22 16:00:17.000000000 +0200
  133. +++ gcc-4.7.3/fixincludes/mkfixinc.sh 2013-09-16 15:39:42.000000000 +0200
  134. @@ -20,7 +20,8 @@
  135. powerpc-*-eabi* | \
  136. powerpc-*-rtems* | \
  137. powerpcle-*-eabisim* | \
  138. - powerpcle-*-eabi* )
  139. + powerpcle-*-eabi* | \
  140. + *-musl* )
  141. # IF there is no include fixing,
  142. # THEN create a no-op fixer and exit
  143. (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
  144. diff -Nur gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h gcc-4.7.3/gcc/config/arm/linux-eabi.h
  145. --- gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h 2011-11-02 16:03:19.000000000 +0100
  146. +++ gcc-4.7.3/gcc/config/arm/linux-eabi.h 2013-09-16 15:39:42.000000000 +0200
  147. @@ -64,6 +64,23 @@
  148. #undef GLIBC_DYNAMIC_LINKER
  149. #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
  150. +/* For ARM musl currently supports two dynamic linkers:
  151. + - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
  152. + - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI.
  153. + musl does not support the legacy OABI (i.e. broken) mode.
  154. + All the dynamic linkers live in /lib.
  155. + We default to soft-float, but this can be overridden by changing both
  156. + MUSL_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
  157. +#undef MUSL_DYNAMIC_LINKER
  158. +#define MUSL_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-musl-arm.so.1"
  159. +#define MUSL_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-musl-armhf.so.1"
  160. +#define MUSL_DYNAMIC_LINKER_DEFAULT MUSL_DYNAMIC_LINKER_SOFT_FLOAT
  161. +
  162. +#define MUSL_DYNAMIC_LINKER \
  163. + "%{mfloat-abi=hard:" MUSL_DYNAMIC_LINKER_HARD_FLOAT "} \
  164. + %{mfloat-abi=soft*:" MUSL_DYNAMIC_LINKER_SOFT_FLOAT "} \
  165. + %{!mfloat-abi=*:" MUSL_DYNAMIC_LINKER_DEFAULT "}"
  166. +
  167. /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
  168. use the GNU/Linux version, not the generic BPABI version. */
  169. #undef LINK_SPEC
  170. diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux64.h gcc-4.7.3/gcc/config/i386/linux64.h
  171. --- gcc-4.7.3.orig/gcc/config/i386/linux64.h 2011-07-07 17:38:34.000000000 +0200
  172. +++ gcc-4.7.3/gcc/config/i386/linux64.h 2013-09-16 15:39:42.000000000 +0200
  173. @@ -31,3 +31,7 @@
  174. #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
  175. #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
  176. #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
  177. +
  178. +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
  179. +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
  180. +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
  181. diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux.h gcc-4.7.3/gcc/config/i386/linux.h
  182. --- gcc-4.7.3.orig/gcc/config/i386/linux.h 2011-06-03 20:30:39.000000000 +0200
  183. +++ gcc-4.7.3/gcc/config/i386/linux.h 2013-09-16 15:39:42.000000000 +0200
  184. @@ -22,3 +22,4 @@
  185. #define GNU_USER_LINK_EMULATION "elf_i386"
  186. #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  187. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
  188. diff -Nur gcc-4.7.3.orig/gcc/config/linux.h gcc-4.7.3/gcc/config/linux.h
  189. --- gcc-4.7.3.orig/gcc/config/linux.h 2012-08-14 15:59:04.000000000 +0200
  190. +++ gcc-4.7.3/gcc/config/linux.h 2013-09-16 15:39:42.000000000 +0200
  191. @@ -33,10 +33,12 @@
  192. #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  193. #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  194. #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  195. +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  196. #else
  197. #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  198. #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  199. #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  200. +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  201. #endif
  202. #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
  203. @@ -54,18 +56,21 @@
  204. uClibc or Bionic is the default C library and whether
  205. -muclibc or -mglibc or -mbionic has been passed to change the default. */
  206. -#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
  207. - "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
  208. +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
  209. + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
  210. #if DEFAULT_LIBC == LIBC_GLIBC
  211. -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  212. - CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
  213. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  214. + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
  215. #elif DEFAULT_LIBC == LIBC_UCLIBC
  216. -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  217. - CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
  218. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  219. + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
  220. #elif DEFAULT_LIBC == LIBC_BIONIC
  221. -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  222. - CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
  223. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  224. + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
  225. +#elif DEFAULT_LIBC == LIBC_MUSL
  226. +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  227. + CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
  228. #else
  229. #error "Unsupported DEFAULT_LIBC"
  230. #endif /* DEFAULT_LIBC */
  231. @@ -85,21 +90,21 @@
  232. #define GNU_USER_DYNAMIC_LINKER \
  233. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
  234. - BIONIC_DYNAMIC_LINKER)
  235. + BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  236. #define GNU_USER_DYNAMIC_LINKER32 \
  237. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
  238. - BIONIC_DYNAMIC_LINKER32)
  239. + BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  240. #define GNU_USER_DYNAMIC_LINKER64 \
  241. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
  242. - BIONIC_DYNAMIC_LINKER64)
  243. + BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  244. #define GNU_USER_DYNAMIC_LINKERX32 \
  245. CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
  246. - BIONIC_DYNAMIC_LINKERX32)
  247. + BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
  248. /* Determine whether the entire c99 runtime
  249. is present in the runtime library. */
  250. #undef TARGET_C99_FUNCTIONS
  251. -#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
  252. +#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
  253. /* Whether we have sincos that follows the GNU extension. */
  254. #undef TARGET_HAS_SINCOS
  255. @@ -108,3 +113,74 @@
  256. /* Whether we have Bionic libc runtime */
  257. #undef TARGET_HAS_BIONIC
  258. #define TARGET_HAS_BIONIC (OPTION_BIONIC)
  259. +
  260. +/* musl avoids problematic includes by rearranging the include directories.
  261. + * Unfortunately, this is mostly duplicated from cppdefault.c */
  262. +#if DEFAULT_LIBC == LIBC_MUSL
  263. +#define INCLUDE_DEFAULTS_MUSL_GPP \
  264. + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
  265. + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
  266. + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
  267. + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
  268. + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
  269. + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
  270. +
  271. +#ifdef LOCAL_INCLUDE_DIR
  272. +#define INCLUDE_DEFAULTS_MUSL_LOCAL \
  273. + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
  274. + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
  275. +#else
  276. +#define INCLUDE_DEFAULTS_MUSL_LOCAL
  277. +#endif
  278. +
  279. +#ifdef PREFIX_INCLUDE_DIR
  280. +#define INCLUDE_DEFAULTS_MUSL_PREFIX \
  281. + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
  282. +#else
  283. +#define INCLUDE_DEFAULTS_MUSL_PREFIX
  284. +#endif
  285. +
  286. +#ifdef CROSS_INCLUDE_DIR
  287. +#define INCLUDE_DEFAULTS_MUSL_CROSS \
  288. + { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
  289. +#else
  290. +#define INCLUDE_DEFAULTS_MUSL_CROSS
  291. +#endif
  292. +
  293. +#ifdef TOOL_INCLUDE_DIR
  294. +#define INCLUDE_DEFAULTS_MUSL_TOOL \
  295. + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
  296. +#else
  297. +#define INCLUDE_DEFAULTS_MUSL_TOOL
  298. +#endif
  299. +
  300. +#ifdef NATIVE_SYSTEM_HEADER_DIR
  301. +#define INCLUDE_DEFAULTS_MUSL_NATIVE \
  302. + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
  303. + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
  304. +#else
  305. +#define INCLUDE_DEFAULTS_MUSL_NATIVE
  306. +#endif
  307. +
  308. +#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
  309. +# undef INCLUDE_DEFAULTS_MUSL_LOCAL
  310. +# define INCLUDE_DEFAULTS_MUSL_LOCAL
  311. +# undef INCLUDE_DEFAULTS_MUSL_NATIVE
  312. +# define INCLUDE_DEFAULTS_MUSL_NATIVE
  313. +#else
  314. +# undef INCLUDE_DEFAULTS_MUSL_CROSS
  315. +# define INCLUDE_DEFAULTS_MUSL_CROSS
  316. +#endif
  317. +
  318. +#undef INCLUDE_DEFAULTS
  319. +#define INCLUDE_DEFAULTS \
  320. + { \
  321. + INCLUDE_DEFAULTS_MUSL_GPP \
  322. + INCLUDE_DEFAULTS_MUSL_PREFIX \
  323. + INCLUDE_DEFAULTS_MUSL_CROSS \
  324. + INCLUDE_DEFAULTS_MUSL_TOOL \
  325. + INCLUDE_DEFAULTS_MUSL_NATIVE \
  326. + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
  327. + { 0, 0, 0, 0, 0, 0 } \
  328. + }
  329. +#endif
  330. diff -Nur gcc-4.7.3.orig/gcc/config/linux.opt gcc-4.7.3/gcc/config/linux.opt
  331. --- gcc-4.7.3.orig/gcc/config/linux.opt 2010-09-29 16:51:52.000000000 +0200
  332. +++ gcc-4.7.3/gcc/config/linux.opt 2013-09-16 15:39:42.000000000 +0200
  333. @@ -30,3 +30,7 @@
  334. muclibc
  335. Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
  336. Use uClibc C library
  337. +
  338. +mmusl
  339. +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
  340. +Use musl C library
  341. diff -Nur gcc-4.7.3.orig/gcc/config/mips/linux.h gcc-4.7.3/gcc/config/mips/linux.h
  342. --- gcc-4.7.3.orig/gcc/config/mips/linux.h 2011-07-19 20:00:27.000000000 +0200
  343. +++ gcc-4.7.3/gcc/config/mips/linux.h 2013-09-16 15:39:43.000000000 +0200
  344. @@ -19,3 +19,5 @@
  345. <http://www.gnu.org/licenses/>. */
  346. #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  347. +
  348. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
  349. diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/linux64.h gcc-4.7.3/gcc/config/rs6000/linux64.h
  350. --- gcc-4.7.3.orig/gcc/config/rs6000/linux64.h 2012-03-12 17:16:51.000000000 +0100
  351. +++ gcc-4.7.3/gcc/config/rs6000/linux64.h 2013-09-16 15:39:43.000000000 +0200
  352. @@ -362,17 +362,21 @@
  353. #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
  354. #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
  355. #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
  356. +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
  357. +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
  358. #if DEFAULT_LIBC == LIBC_UCLIBC
  359. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  360. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  361. #elif DEFAULT_LIBC == LIBC_GLIBC
  362. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  363. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  364. +#elif DEFAULT_LIBC == LIBC_MUSL
  365. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  366. #else
  367. #error "Unsupported DEFAULT_LIBC"
  368. #endif
  369. #define GNU_USER_DYNAMIC_LINKER32 \
  370. - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
  371. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  372. #define GNU_USER_DYNAMIC_LINKER64 \
  373. - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
  374. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  375. #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
  376. diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/sysv4.h gcc-4.7.3/gcc/config/rs6000/sysv4.h
  377. --- gcc-4.7.3.orig/gcc/config/rs6000/sysv4.h 2012-04-30 19:39:01.000000000 +0200
  378. +++ gcc-4.7.3/gcc/config/rs6000/sysv4.h 2013-09-16 15:39:43.000000000 +0200
  379. @@ -804,15 +808,18 @@
  380. #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  381. #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
  382. +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
  383. #if DEFAULT_LIBC == LIBC_UCLIBC
  384. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  385. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  386. +#elif DEFAULT_LIBC == LIBC_MUSL
  387. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  388. #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
  389. -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  390. +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  391. #else
  392. #error "Unsupported DEFAULT_LIBC"
  393. #endif
  394. #define GNU_USER_DYNAMIC_LINKER \
  395. - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
  396. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  397. #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
  398. %{rdynamic:-export-dynamic} \
  399. diff -Nur gcc-4.7.3.orig/gcc/config.gcc gcc-4.7.3/gcc/config.gcc
  400. --- gcc-4.7.3.orig/gcc/config.gcc 2013-03-06 23:54:11.000000000 +0100
  401. +++ gcc-4.7.3/gcc/config.gcc 2013-09-16 15:39:43.000000000 +0200
  402. @@ -522,7 +522,7 @@
  403. esac
  404. # Common C libraries.
  405. -tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
  406. +tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
  407. # Common parts for widely ported systems.
  408. case ${target} in
  409. @@ -625,6 +625,9 @@
  410. *-*-*uclibc*)
  411. tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
  412. ;;
  413. + *-*-*musl*)
  414. + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
  415. + ;;
  416. *)
  417. tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
  418. ;;
  419. @@ -2092,6 +2095,10 @@
  420. powerpc*-*-linux*paired*)
  421. tm_file="${tm_file} rs6000/750cl.h" ;;
  422. esac
  423. + case ${target} in
  424. + *-linux*-musl*)
  425. + enable_secureplt=yes ;;
  426. + esac
  427. if test x${enable_secureplt} = xyes; then
  428. tm_file="rs6000/secureplt.h ${tm_file}"
  429. fi
  430. diff -Nur gcc-4.7.3.orig/gcc/configure gcc-4.7.3/gcc/configure
  431. --- gcc-4.7.3.orig/gcc/configure 2013-02-06 16:23:55.000000000 +0100
  432. +++ gcc-4.7.3/gcc/configure 2013-09-16 15:39:43.000000000 +0200
  433. @@ -26815,7 +26815,8 @@
  434. gcc_cv_libc_provides_ssp=yes
  435. fi
  436. ;;
  437. - *-*-gnu*)
  438. + *-*-gnu* | \
  439. + *-linux-musl*)
  440. # Avoid complicated tests (see
  441. # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  442. # simply assert that glibc does provide this, which is true for all
  443. @@ -26902,6 +26903,9 @@
  444. gcc_cv_target_dl_iterate_phdr=no
  445. fi
  446. ;;
  447. + *-linux-musl*)
  448. + gcc_cv_target_dl_iterate_phdr=yes
  449. + ;;
  450. esac
  451. if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  452. diff -Nur gcc-4.7.3.orig/gcc/configure.ac gcc-4.7.3/gcc/configure.ac
  453. --- gcc-4.7.3.orig/gcc/configure.ac 2013-02-06 16:23:55.000000000 +0100
  454. +++ gcc-4.7.3/gcc/configure.ac 2013-09-16 15:39:43.000000000 +0200
  455. @@ -4692,7 +4692,8 @@
  456. gcc_cv_libc_provides_ssp=yes
  457. fi]
  458. ;;
  459. - *-*-gnu*)
  460. + *-*-gnu* | \
  461. + *-linux-musl*)
  462. # Avoid complicated tests (see
  463. # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  464. # simply assert that glibc does provide this, which is true for all
  465. @@ -4762,6 +4763,9 @@
  466. gcc_cv_target_dl_iterate_phdr=no
  467. fi
  468. ;;
  469. + *-linux-musl*)
  470. + gcc_cv_target_dl_iterate_phdr=yes
  471. + ;;
  472. esac
  473. GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
  474. if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  475. diff -Nur gcc-4.7.3.orig/gcc/ginclude/stddef.h gcc-4.7.3/gcc/ginclude/stddef.h
  476. --- gcc-4.7.3.orig/gcc/ginclude/stddef.h 2012-02-12 02:06:04.000000000 +0100
  477. +++ gcc-4.7.3/gcc/ginclude/stddef.h 2013-09-16 15:39:43.000000000 +0200
  478. @@ -184,6 +184,7 @@
  479. #ifndef _GCC_SIZE_T
  480. #ifndef _SIZET_
  481. #ifndef __size_t
  482. +#ifndef __DEFINED_size_t /* musl */
  483. #define __size_t__ /* BeOS */
  484. #define __SIZE_T__ /* Cray Unicos/Mk */
  485. #define _SIZE_T
  486. @@ -200,6 +201,7 @@
  487. #define ___int_size_t_h
  488. #define _GCC_SIZE_T
  489. #define _SIZET_
  490. +#define __DEFINED_size_t /* musl */
  491. #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
  492. || defined(__FreeBSD_kernel__)
  493. /* __size_t is a typedef on FreeBSD 5, must not trash it. */
  494. @@ -215,6 +217,7 @@
  495. typedef long ssize_t;
  496. #endif /* __BEOS__ */
  497. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  498. +#endif /* __DEFINED_size_t */
  499. #endif /* __size_t */
  500. #endif /* _SIZET_ */
  501. #endif /* _GCC_SIZE_T */
  502. diff -Nur gcc-4.7.3.orig/libgcc/unwind-dw2-fde-dip.c gcc-4.7.3/libgcc/unwind-dw2-fde-dip.c
  503. --- gcc-4.7.3.orig/libgcc/unwind-dw2-fde-dip.c 2012-10-06 23:55:06.000000000 +0200
  504. +++ gcc-4.7.3/libgcc/unwind-dw2-fde-dip.c 2013-09-16 15:39:43.000000000 +0200
  505. @@ -47,28 +47,13 @@
  506. #include "unwind-compat.h"
  507. #include "gthr.h"
  508. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  509. - && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
  510. - || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
  511. -# define USE_PT_GNU_EH_FRAME
  512. -#endif
  513. -
  514. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  515. - && defined(__FreeBSD__) && __FreeBSD__ >= 7
  516. -# define ElfW __ElfN
  517. -# define USE_PT_GNU_EH_FRAME
  518. -#endif
  519. -
  520. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  521. - && defined(__OpenBSD__)
  522. -# define ElfW(type) Elf_##type
  523. -# define USE_PT_GNU_EH_FRAME
  524. -#endif
  525. -
  526. -#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  527. - && defined(TARGET_DL_ITERATE_PHDR) \
  528. - && defined(__sun__) && defined(__svr4__)
  529. +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
  530. # define USE_PT_GNU_EH_FRAME
  531. +# ifdef __OpenBSD__
  532. +# define ElfW(type) Elf_##typ
  533. +# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
  534. +# define ElfW __ElfN
  535. +# endif
  536. #endif
  537. #if defined(USE_PT_GNU_EH_FRAME)
  538. diff -Nur gcc-4.7.3.orig/libgomp/config/posix/time.c gcc-4.7.3/libgomp/config/posix/time.c
  539. --- gcc-4.7.3.orig/libgomp/config/posix/time.c 2009-04-09 17:00:19.000000000 +0200
  540. +++ gcc-4.7.3/libgomp/config/posix/time.c 2013-09-16 15:39:43.000000000 +0200
  541. @@ -28,6 +28,8 @@
  542. The following implementation uses the most simple POSIX routines.
  543. If present, POSIX 4 clocks should be used instead. */
  544. +#define _POSIX_C_SOURCE 199309L /* for clocks */
  545. +
  546. #include "libgomp.h"
  547. #include <unistd.h>
  548. #if TIME_WITH_SYS_TIME
  549. diff -Nur gcc-4.7.3.orig/libitm/config/arm/hwcap.cc gcc-4.7.3/libitm/config/arm/hwcap.cc
  550. --- gcc-4.7.3.orig/libitm/config/arm/hwcap.cc 2011-12-15 04:24:05.000000000 +0100
  551. +++ gcc-4.7.3/libitm/config/arm/hwcap.cc 2013-09-16 15:39:43.000000000 +0200
  552. @@ -40,7 +40,11 @@
  553. #ifdef __linux__
  554. #include <unistd.h>
  555. +#ifdef __GLIBC__
  556. #include <sys/fcntl.h>
  557. +#else
  558. +#include <fcntl.h>
  559. +#endif
  560. #include <elf.h>
  561. static void __attribute__((constructor))
  562. diff -Nur gcc-4.7.3.orig/libitm/config/linux/x86/tls.h gcc-4.7.3/libitm/config/linux/x86/tls.h
  563. --- gcc-4.7.3.orig/libitm/config/linux/x86/tls.h 2011-11-08 12:13:41.000000000 +0100
  564. +++ gcc-4.7.3/libitm/config/linux/x86/tls.h 2013-09-16 15:39:43.000000000 +0200
  565. @@ -25,16 +25,19 @@
  566. #ifndef LIBITM_X86_TLS_H
  567. #define LIBITM_X86_TLS_H 1
  568. -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  569. +#if defined(__GLIBC_PREREQ)
  570. +#if __GLIBC_PREREQ(2, 10)
  571. /* Use slots in the TCB head rather than __thread lookups.
  572. GLIBC has reserved words 10 through 13 for TM. */
  573. #define HAVE_ARCH_GTM_THREAD 1
  574. #define HAVE_ARCH_GTM_THREAD_DISP 1
  575. #endif
  576. +#endif
  577. #include "config/generic/tls.h"
  578. -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  579. +#if defined(__GLIBC_PREREQ)
  580. +#if __GLIBC_PREREQ(2, 10)
  581. namespace GTM HIDDEN {
  582. #ifdef __x86_64__
  583. @@ -101,5 +104,6 @@
  584. } // namespace GTM
  585. #endif /* >= GLIBC 2.10 */
  586. +#endif
  587. #endif // LIBITM_X86_TLS_H
  588. diff -Nur gcc-4.7.3.orig/libssp/configure gcc-4.7.3/libssp/configure
  589. --- gcc-4.7.3.orig/libssp/configure 2012-08-06 16:34:27.000000000 +0200
  590. +++ gcc-4.7.3/libssp/configure 2013-09-16 15:39:43.000000000 +0200
  591. @@ -626,6 +626,8 @@
  592. ssp_have_usable_vsnprintf
  593. EGREP
  594. GREP
  595. +LIBSSP_IN_LIBC_FALSE
  596. +LIBSSP_IN_LIBC_TRUE
  597. LIBSSP_USE_SYMVER_SUN_FALSE
  598. LIBSSP_USE_SYMVER_SUN_TRUE
  599. LIBSSP_USE_SYMVER_GNU_FALSE
  600. @@ -735,6 +737,7 @@
  601. enable_multilib
  602. enable_dependency_tracking
  603. enable_symvers
  604. +enable_ssp_in_libc
  605. enable_shared
  606. enable_static
  607. with_pic
  608. @@ -1374,6 +1377,7 @@
  609. --disable-dependency-tracking speeds up one-time build
  610. --enable-dependency-tracking do not reject slow dependency extractors
  611. --disable-symvers disable symbol versioning for libssp
  612. + --enable-ssp-in-libc do not build SSP, as it is in libc
  613. --enable-shared[=PKGS] build shared libraries [default=yes]
  614. --enable-static[=PKGS] build static libraries [default=yes]
  615. --enable-fast-install[=PKGS]
  616. @@ -4206,6 +4210,36 @@
  617. fi
  618. +# musl provides libssp in libc
  619. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libssp is provided in libc" >&5
  620. +$as_echo_n "checking whether libssp is provided in libc... " >&6; }
  621. +# Check whether --enable-ssp_in_libc was given.
  622. +if test "${enable_ssp_in_libc+set}" = set; then :
  623. + enableval=$enable_ssp_in_libc; ssp_in_libc=$enableval
  624. +else
  625. + ssp_in_libc=check
  626. +fi
  627. +
  628. +if test "x$ssp_in_libc" = "xcheck"; then
  629. + case "$host" in
  630. + *-musl*)
  631. + ssp_in_libc=yes
  632. + ;;
  633. +
  634. + *)
  635. + ssp_in_libc=no
  636. + ;;
  637. + esac
  638. +fi
  639. + if test "x$ssp_in_libc" = xyes; then
  640. + LIBSSP_IN_LIBC_TRUE=
  641. + LIBSSP_IN_LIBC_FALSE='#'
  642. +else
  643. + LIBSSP_IN_LIBC_TRUE='#'
  644. + LIBSSP_IN_LIBC_FALSE=
  645. +fi
  646. +
  647. +
  648. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
  649. $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
  650. @@ -10650,7 +10684,7 @@
  651. lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  652. lt_status=$lt_dlunknown
  653. cat > conftest.$ac_ext <<_LT_EOF
  654. -#line 10653 "configure"
  655. +#line 10687 "configure"
  656. #include "confdefs.h"
  657. #if HAVE_DLFCN_H
  658. @@ -10756,7 +10790,7 @@
  659. lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  660. lt_status=$lt_dlunknown
  661. cat > conftest.$ac_ext <<_LT_EOF
  662. -#line 10759 "configure"
  663. +#line 10793 "configure"
  664. #include "confdefs.h"
  665. #if HAVE_DLFCN_H
  666. @@ -11185,6 +11219,10 @@
  667. as_fn_error "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
  668. Usually this means the macro was only invoked conditionally." "$LINENO" 5
  669. fi
  670. +if test -z "${LIBSSP_IN_LIBC_TRUE}" && test -z "${LIBSSP_IN_LIBC_FALSE}"; then
  671. + as_fn_error "conditional \"LIBSSP_IN_LIBC\" was never defined.
  672. +Usually this means the macro was only invoked conditionally." "$LINENO" 5
  673. +fi
  674. : ${CONFIG_STATUS=./config.status}
  675. ac_write_fail=0
  676. diff -Nur gcc-4.7.3.orig/libssp/configure.ac gcc-4.7.3/libssp/configure.ac
  677. --- gcc-4.7.3.orig/libssp/configure.ac 2012-05-31 20:59:34.000000000 +0200
  678. +++ gcc-4.7.3/libssp/configure.ac 2013-09-16 15:39:43.000000000 +0200
  679. @@ -114,6 +114,26 @@
  680. AM_CONDITIONAL(LIBSSP_USE_SYMVER_GNU, [test "x$ssp_use_symver" = xgnu])
  681. AM_CONDITIONAL(LIBSSP_USE_SYMVER_SUN, [test "x$ssp_use_symver" = xsun])
  682. +# musl provides libssp in libc
  683. +AC_MSG_CHECKING([whether libssp is provided in libc])
  684. +AC_ARG_ENABLE(ssp_in_libc,
  685. +AC_HELP_STRING([--enable-ssp-in-libc],
  686. + [do not build SSP, as it is in libc]),
  687. +ssp_in_libc=$enableval,
  688. +ssp_in_libc=check)
  689. +if test "x$ssp_in_libc" = "xcheck"; then
  690. + case "$host" in
  691. + *-musl*)
  692. + ssp_in_libc=yes
  693. + ;;
  694. +
  695. + *)
  696. + ssp_in_libc=no
  697. + ;;
  698. + esac
  699. +fi
  700. +AM_CONDITIONAL(LIBSSP_IN_LIBC, [test "x$ssp_in_libc" = xyes])
  701. +
  702. AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
  703. if test x$gcc_no_link = xyes; then
  704. diff -Nur gcc-4.7.3.orig/libssp/Makefile.am gcc-4.7.3/libssp/Makefile.am
  705. --- gcc-4.7.3.orig/libssp/Makefile.am 2010-12-06 01:50:04.000000000 +0100
  706. +++ gcc-4.7.3/libssp/Makefile.am 2013-09-16 15:39:43.000000000 +0200
  707. @@ -36,7 +36,11 @@
  708. AM_CFLAGS = -Wall
  709. +if LIBSSP_IN_LIBC
  710. +toolexeclib_LTLIBRARIES = libssp_nonshared.la
  711. +else
  712. toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
  713. +endif
  714. target_noncanonical = @target_noncanonical@
  715. libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
  716. diff -Nur gcc-4.7.3.orig/libssp/Makefile.in gcc-4.7.3/libssp/Makefile.in
  717. --- gcc-4.7.3.orig/libssp/Makefile.in 2011-02-13 12:45:53.000000000 +0100
  718. +++ gcc-4.7.3/libssp/Makefile.in 2013-09-16 15:39:43.000000000 +0200
  719. @@ -93,12 +93,17 @@
  720. libssp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
  721. $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
  722. $(libssp_la_LDFLAGS) $(LDFLAGS) -o $@
  723. +@LIBSSP_IN_LIBC_FALSE@am_libssp_la_rpath = -rpath $(toolexeclibdir)
  724. am_libssp_nonshared_la_OBJECTS = libssp_nonshared_la-ssp-local.lo
  725. libssp_nonshared_la_OBJECTS = $(am_libssp_nonshared_la_OBJECTS)
  726. libssp_nonshared_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
  727. $(LIBTOOLFLAGS) --mode=link $(CCLD) \
  728. $(libssp_nonshared_la_CFLAGS) $(CFLAGS) \
  729. $(libssp_nonshared_la_LDFLAGS) $(LDFLAGS) -o $@
  730. +@LIBSSP_IN_LIBC_FALSE@am_libssp_nonshared_la_rpath = -rpath \
  731. +@LIBSSP_IN_LIBC_FALSE@ $(toolexeclibdir)
  732. +@LIBSSP_IN_LIBC_TRUE@am_libssp_nonshared_la_rpath = -rpath \
  733. +@LIBSSP_IN_LIBC_TRUE@ $(toolexeclibdir)
  734. DEFAULT_INCLUDES = -I.@am__isrc@
  735. depcomp = $(SHELL) $(top_srcdir)/../depcomp
  736. am__depfiles_maybe = depfiles
  737. @@ -258,7 +263,8 @@
  738. @LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map
  739. @LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun
  740. AM_CFLAGS = -Wall
  741. -toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
  742. +@LIBSSP_IN_LIBC_FALSE@toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
  743. +@LIBSSP_IN_LIBC_TRUE@toolexeclib_LTLIBRARIES = libssp_nonshared.la
  744. libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
  745. nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
  746. libssp_la_SOURCES = \
  747. @@ -414,9 +420,9 @@
  748. rm -f "$${dir}/so_locations"; \
  749. done
  750. libssp.la: $(libssp_la_OBJECTS) $(libssp_la_DEPENDENCIES)
  751. - $(libssp_la_LINK) -rpath $(toolexeclibdir) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
  752. + $(libssp_la_LINK) $(am_libssp_la_rpath) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
  753. libssp_nonshared.la: $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_DEPENDENCIES)
  754. - $(libssp_nonshared_la_LINK) -rpath $(toolexeclibdir) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
  755. + $(libssp_nonshared_la_LINK) $(am_libssp_nonshared_la_rpath) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
  756. mostlyclean-compile:
  757. -rm -f *.$(OBJEXT)
  758. diff -Nur gcc-4.7.3.orig/libstdc++-v3/configure.host gcc-4.7.3/libstdc++-v3/configure.host
  759. --- gcc-4.7.3.orig/libstdc++-v3/configure.host 2012-12-18 15:27:14.000000000 +0100
  760. +++ gcc-4.7.3/libstdc++-v3/configure.host 2013-09-16 15:39:43.000000000 +0200
  761. @@ -243,6 +243,13 @@
  762. os_include_dir="os/bsd/freebsd"
  763. ;;
  764. gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
  765. + # check for musl by target
  766. + case "${host_os}" in
  767. + *-musl*)
  768. + os_include_dir="os/generic"
  769. + ;;
  770. + *)
  771. +
  772. if [ "$uclibc" = "yes" ]; then
  773. os_include_dir="os/uclibc"
  774. elif [ "$bionic" = "yes" ]; then
  775. @@ -251,6 +258,9 @@
  776. os_include_dir="os/gnu-linux"
  777. fi
  778. ;;
  779. +
  780. + esac
  781. + ;;
  782. hpux*)
  783. os_include_dir="os/hpux"
  784. ;;