Check-in [184c3ef7d2]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed issue with MUSL patches being applied to non-MUSL targets, breaking them
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:184c3ef7d2df23ec8c354bd7f1e6563e0b8c1035
User & Date: rkeene 2015-08-26 23:09:52
Context
2015-08-26
23:13
Build-CC 0.10 check-in: 55a54b8a75 user: rkeene tags: trunk, 0.10
23:09
Fixed issue with MUSL patches being applied to non-MUSL targets, breaking them check-in: 184c3ef7d2 user: rkeene tags: trunk
23:09
Updated to latest libressl check-in: 12b597c851 user: rkeene tags: trunk
Changes

Added .fossil-settings/ignore-glob.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
platform/*-platform.tar.bz2
src/*
binutils-*/*
gcc-*/*
glibc-*/*
linux-*/*
musl-*/*
yasm-*/*
zlib-*/*

Changes to build-cc.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
...
165
166
167
168
169
170
171

172
173
174
175
176
177
178
...
200
201
202
203
204
205
206



207
208
209
210
211
212
213
...
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
...
439
440
441
442
443
444
445



446
447
448
449
450
451
452

453
454
455
456




457
458
459
460
461
462
463
...
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
...
529
530
531
532
533
534
535




536
537
538
539
540
541
542
543
544
# Tool versions
## SHA1 may be left blank to disable hashing
if [ -z "${BINUTILS_VERS}" ]; then
	BINUTILS_VERS='2.25'
	BINUTILS_SHA1='b46cc90ebaba7ffcf6c6d996d60738881b14e50d'
fi
if [ -z "${GCC_VERS}" ]; then
	GCC_VERS='4.8.4'
	GCC_SHA1='40867a9ac74a054b1cee855988fd680cabf42006'
fi
if [ -z "${GMP_VERS}" ]; then
	GMP_VERS='6.0.0a'
	GMP_SHA1='360802e3541a3da08ab4b55268c80f799939fddc'
fi
if [ -z "${MPFR_VERS}" ]; then
	MPFR_VERS='3.1.2'
................................................................................

## Clean-up
if [ "$1" = "clean" -o "$1" = "distclean" ]; then
	rm -rf "${BINUTILS_DIR}" "${GCC_DIR}" "${GMP_DIR}" "${MPFR_DIR}" "${MPC_DIR}"

	for platform in "${platforms[@]}"; do
		rm -rf "gcc-${platform}"

		rm -rf "binutils-${platform}"
	done

	for appscript in scripts/* scripts/pre/* scripts/post/*; do
		"${appscript}" "clean" >/dev/null 2>/dev/null
	done

................................................................................

## Functions
. 'scripts/common'

## Determine path for this cross-compiler
CCNAME="$1"
CCDIR="${CCROOT}/${CCNAME}"




## Determine attributes for this compiler
### Per CPU
case "${CCNAME}" in
	hppa64-*|hppa1*-)
		BUILD_CC_GCC_CONFIGURE_EXTRA="${BUILD_CC_GCC_CONFIGURE_EXTRA} --disable-libquadmath"
		;;
................................................................................
		done
	fi

	rm -rf "binutils-${CCNAME}"
	mkdir "binutils-${CCNAME}"
	cd "binutils-${CCNAME}" || exit -1

	"../${BINUTILS_DIR}/configure" --enable-gold=yes --enable-ld=default --target="${CCNAME}" --prefix="${CCDIR}" --disable-nls --with-sysroot="${CCDIR}/${CCNAME}" --with-build-sysroot="${CCDIR}/${CCNAME}" --program-prefix="${CCNAME}-"

	${MAKE} ${BUILD_CC_MAKE_FLAGS} || exit 1

	${MAKE} ${BUILD_CC_MAKE_FLAGS} install || exit 1

	rm -f "${CCDIR}/bin/${CCNAME}-rebuild-binutils"
) || exit 1
................................................................................
			fi
		fi
	fi

	echo " * Building GNU C Compiler version ${GCC_VERS} for ${CCNAME}, ${STAGE}"

	if [ ! -d "${GCC_DIR}" ]; then



		# Download sources required
		download "${GCC_URL}" "${GCC_TARBALL}" "${GCC_SHA1}"
		download "${GMP_URL}" "${GMP_TARBALL}" "${GMP_SHA1}"
		download "${MPFR_URL}" "${MPFR_TARBALL}" "${MPFR_SHA1}"
		download "${MPC_URL}" "${MPC_TARBALL}" "${MPC_SHA1}"

		# Extract sources

		bzip2 -dc "${GCC_TARBALL}" | "${TAR:-tar}" -xf -
		bzip2 -dc "${GMP_TARBALL}" | "${TAR:-tar}" -xf -
		bzip2 -dc "${MPFR_TARBALL}" | "${TAR:-tar}" -xf -
		gzip -dc "${MPC_TARBALL}" | "${TAR:-tar}" -xf -





		# Arrange sources as needed
		rm -rf "${GCC_DIR}/gmp"
		rm -rf "${GCC_DIR}/mpfr"
		rm -rf "${GCC_DIR}/mpc"

		mv "${GMP_DIR}" "${GCC_DIR}/gmp"
................................................................................
		for patchfile in "$(pwd)/patches/gcc"/*.diff; do
			patchfile_checkscript="$(echo "${patchfile}" | sed 's@\.diff$@.sh@')"
			if [ ! -f "${patchfile}" ]; then
				continue
			fi

			if [ -x "${patchfile_checkscript}" ]; then
				if ! "${patchfile_checkscript}" "${GCC_VERS}"; then
					continue
				fi
			fi

			(
				echo " * Applying patch ${patchfile}"

................................................................................
				--disable-libitm --disable-libquadmath --disable-libsanitizer --disable-libssp \
				--disable-libvtv --disable-libcilkrts --with-system-zlib ${BUILD_CC_GCC_CONFIGURE_EXTRA}
			${MAKE} ${BUILD_CC_MAKE_FLAGS} all-gcc || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} install-gcc || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} all-target-libgcc || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} install-target-libgcc || exit 1
		else




			### Stage 2 -- the full compiler suite
			"../${GCC_DIR}/configure" --target="${CCNAME}" --prefix="${CCDIR}" --with-headers="${CCDIR}/${CCNAME}/include" --disable-nls --enable-languages='c,c++' --with-sysroot="${CCDIR}/${CCNAME}" --with-build-sysroot="${CCDIR}/${CCNAME}" --program-prefix="${CCNAME}-" --with-system-zlib ${BUILD_CC_GCC_CONFIGURE_EXTRA}

			${MAKE} ${BUILD_CC_MAKE_FLAGS} || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} install || exit 1
		fi
	) || exit 1
)
retval="$?"







|
|







 







>







 







>
>
>







 







|







 







>
>
>







>




>
>
>
>







 







|







 







>
>
>
>

|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
...
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
...
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
...
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
...
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
...
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# Tool versions
## SHA1 may be left blank to disable hashing
if [ -z "${BINUTILS_VERS}" ]; then
	BINUTILS_VERS='2.25'
	BINUTILS_SHA1='b46cc90ebaba7ffcf6c6d996d60738881b14e50d'
fi
if [ -z "${GCC_VERS}" ]; then
	GCC_VERS='4.9.2'
	GCC_SHA1='79dbcb09f44232822460d80b033c962c0237c6d8'
fi
if [ -z "${GMP_VERS}" ]; then
	GMP_VERS='6.0.0a'
	GMP_SHA1='360802e3541a3da08ab4b55268c80f799939fddc'
fi
if [ -z "${MPFR_VERS}" ]; then
	MPFR_VERS='3.1.2'
................................................................................

## Clean-up
if [ "$1" = "clean" -o "$1" = "distclean" ]; then
	rm -rf "${BINUTILS_DIR}" "${GCC_DIR}" "${GMP_DIR}" "${MPFR_DIR}" "${MPC_DIR}"

	for platform in "${platforms[@]}"; do
		rm -rf "gcc-${platform}"
		rm -rf "gcc-${GCC_VERS}-${platform}"
		rm -rf "binutils-${platform}"
	done

	for appscript in scripts/* scripts/pre/* scripts/post/*; do
		"${appscript}" "clean" >/dev/null 2>/dev/null
	done

................................................................................

## Functions
. 'scripts/common'

## Determine path for this cross-compiler
CCNAME="$1"
CCDIR="${CCROOT}/${CCNAME}"

## Rename GCC directory since it may be patched based on the platform
GCC_DIR="${GCC_DIR}-${CCNAME}"

## Determine attributes for this compiler
### Per CPU
case "${CCNAME}" in
	hppa64-*|hppa1*-)
		BUILD_CC_GCC_CONFIGURE_EXTRA="${BUILD_CC_GCC_CONFIGURE_EXTRA} --disable-libquadmath"
		;;
................................................................................
		done
	fi

	rm -rf "binutils-${CCNAME}"
	mkdir "binutils-${CCNAME}"
	cd "binutils-${CCNAME}" || exit -1

	"../${BINUTILS_DIR}/configure" --enable-gold=no --enable-ld=default --target="${CCNAME}" --prefix="${CCDIR}" --disable-nls --with-sysroot="${CCDIR}/${CCNAME}" --with-build-sysroot="${CCDIR}/${CCNAME}" --program-prefix="${CCNAME}-"

	${MAKE} ${BUILD_CC_MAKE_FLAGS} || exit 1

	${MAKE} ${BUILD_CC_MAKE_FLAGS} install || exit 1

	rm -f "${CCDIR}/bin/${CCNAME}-rebuild-binutils"
) || exit 1
................................................................................
			fi
		fi
	fi

	echo " * Building GNU C Compiler version ${GCC_VERS} for ${CCNAME}, ${STAGE}"

	if [ ! -d "${GCC_DIR}" ]; then
		# Sanity
		rm -rf "gcc-${GCC_VERS}"

		# Download sources required
		download "${GCC_URL}" "${GCC_TARBALL}" "${GCC_SHA1}"
		download "${GMP_URL}" "${GMP_TARBALL}" "${GMP_SHA1}"
		download "${MPFR_URL}" "${MPFR_TARBALL}" "${MPFR_SHA1}"
		download "${MPC_URL}" "${MPC_TARBALL}" "${MPC_SHA1}"

		# Extract sources

		bzip2 -dc "${GCC_TARBALL}" | "${TAR:-tar}" -xf -
		bzip2 -dc "${GMP_TARBALL}" | "${TAR:-tar}" -xf -
		bzip2 -dc "${MPFR_TARBALL}" | "${TAR:-tar}" -xf -
		gzip -dc "${MPC_TARBALL}" | "${TAR:-tar}" -xf -

		# Rename GCC dir to the name we need
		rm -rf "${GCC_DIR}"
		mv "gcc-${GCC_VERS}" "${GCC_DIR}"

		# Arrange sources as needed
		rm -rf "${GCC_DIR}/gmp"
		rm -rf "${GCC_DIR}/mpfr"
		rm -rf "${GCC_DIR}/mpc"

		mv "${GMP_DIR}" "${GCC_DIR}/gmp"
................................................................................
		for patchfile in "$(pwd)/patches/gcc"/*.diff; do
			patchfile_checkscript="$(echo "${patchfile}" | sed 's@\.diff$@.sh@')"
			if [ ! -f "${patchfile}" ]; then
				continue
			fi

			if [ -x "${patchfile_checkscript}" ]; then
				if ! "${patchfile_checkscript}" "${GCC_VERS}" "${CCNAME}"; then
					continue
				fi
			fi

			(
				echo " * Applying patch ${patchfile}"

................................................................................
				--disable-libitm --disable-libquadmath --disable-libsanitizer --disable-libssp \
				--disable-libvtv --disable-libcilkrts --with-system-zlib ${BUILD_CC_GCC_CONFIGURE_EXTRA}
			${MAKE} ${BUILD_CC_MAKE_FLAGS} all-gcc || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} install-gcc || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} all-target-libgcc || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} install-target-libgcc || exit 1
		else
			if [ -n "${BUILD_CC_EXTRA_LANGUAGES}" ]; then
				BUILD_CC_EXTRA_LANGUAGES=",${BUILD_CC_EXTRA_LANGUAGES}"
			fi

			### Stage 2 -- the full compiler suite
			"../${GCC_DIR}/configure" --target="${CCNAME}" --prefix="${CCDIR}" --with-headers="${CCDIR}/${CCNAME}/include" --disable-nls --enable-languages="c,c++${BUILD_CC_EXTRA_LANGUAGES}" --with-sysroot="${CCDIR}/${CCNAME}" --with-build-sysroot="${CCDIR}/${CCNAME}" --program-prefix="${CCNAME}-" --with-system-zlib ${BUILD_CC_GCC_CONFIGURE_EXTRA}

			${MAKE} ${BUILD_CC_MAKE_FLAGS} || exit 1
			${MAKE} ${BUILD_CC_MAKE_FLAGS} install || exit 1
		fi
	) || exit 1
)
retval="$?"

Changes to patches/gcc/gcc-4.8.4-musl.diff.

809
810
811
812
813
814
815
















 
+  if (!implicit && value.value && !integer_zerop (value.value))
+    constructor_zeroinit = 0;
+
   /* Handle superfluous braces around string cst as in
      char x[] = {"foo"}; */
   if (string_flag























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
 
+  if (!implicit && value.value && !integer_zerop (value.value))
+    constructor_zeroinit = 0;
+
   /* Handle superfluous braces around string cst as in
      char x[] = {"foo"}; */
   if (string_flag
Do not use weak references on any targets for gthread. Necessary on musl, safe elsewhere.

diff -r d6371c4d8f65 libgcc/gthr.h
--- a/libgcc/gthr.h	Thu Jan 29 19:10:06 2015 -0500
+++ b/libgcc/gthr.h	Thu Jan 29 19:10:12 2015 -0500
@@ -136,10 +136,8 @@
 /* The pe-coff weak support isn't fully compatible to ELF's weak.
    For static libraries it might would work, but as we need to deal
    with shared versions too, we disable it for mingw-targets.  */
-#ifdef __MINGW32__
 #undef GTHREAD_USE_WEAK
 #define GTHREAD_USE_WEAK 0
-#endif
 
 #ifndef GTHREAD_USE_WEAK
 #define GTHREAD_USE_WEAK 1

Changes to patches/gcc/gcc-4.8.4-musl.sh.

1
2



3








4


5
6
7
8
9
#! /usr/bin/env sh




case "$1" in








	4.8.[456789])


		exit 0
		;;
esac

exit 1


>
>
>
|
>
>
>
>
>
>
>
>

>
>
|



|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /usr/bin/env sh

GCC_VERS="$1"
CCNAME="$2"

case "${CCNAME}" in
	*-musl)
		;;
	*)
		exit 1
		;;
esac

case "${GCC_VERS}" in
	4.8.[456789])
		;;
	*)
		exit 1
		;;
esac

exit 0

Changes to patches/gcc/gcc-4.9.0-musl.sh.

1
2



3








4
5
6
7
8
9
#! /usr/bin/env sh




case "$1" in








	4.9.*)
		exit 0
		;;
esac

exit 1


>
>
>
|
>
>
>
>
>
>
>
>






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /usr/bin/env sh

GCC_VERS="$1"
CCNAME="$2"

case "${CCNAME}" in
	*-musl)
		;;
	*)
		exit 1
		;;
esac

case "${GCC_VERS}" in
	4.9.*)
		exit 0
		;;
esac

exit 1