Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 337788 | Differences between
and this patch

Collapse All | Expand All

(-)toolchain.eclass (-66 / +35 lines)
Lines 1291-1321 Link Here
1291
	popd >/dev/null
1291
	popd >/dev/null
1292
}
1292
}
1293
1293
1294
# This function accepts one optional argument, the make target to be used.
1294
# This function accepts one optional argument: the make target to be used.
1295
# If ommitted, gcc_do_make will try to guess whether it should use all,
1295
# If omitted, gcc_do_make will try to guess whether it should use make "all"
1296
# profiledbootstrap, or bootstrap-lean depending on CTARGET and arch. An
1296
# or "bootstrap-lean" depending on CTARGET and arch. An example of how to use
1297
# example of how to use this function:
1297
# this function:
1298
#
1298
#
1299
#	gcc_do_make all-target-libstdc++-v3
1299
#	gcc_do_make all-target-libstdc++-v3
1300
#
1300
#
1301
# In addition to the target to be used, the following variables alter the
1301
# The following variables control the flags the compiler is built with:
1302
# behavior of this function:
1303
#
1302
#
1304
#	LDFLAGS
1303
#	STAGE1_{C,LD}FLAGS
1305
#			Flags to pass to ld
1304
#		CFLAGS/LDFLAGS used during stage 1 of a gcc bootstrap.
1306
#
1305
#
1307
#	STAGE1_CFLAGS
1306
#	BOOT_{C,LD}FLAGS
1308
#			CFLAGS to use during stage1 of a gcc bootstrap
1307
#		CFLAGS/LDFLAGS used during stages 2/3 of a gcc bootstrap.
1309
#
1310
#	BOOT_CFLAGS
1311
#			CFLAGS to use during stages 2+3 of a gcc bootstrap.
1312
#
1313
# Travis Tilley <lv@gentoo.org> (04 Sep 2004)
1314
#
1308
#
1309
#	{C,LD}FLAGS_FOR_TARGET
1310
#		CFLAGS/LDFLAGS used building libs (libgcc, libgomp, libstdc++, etc.)
1311
1315
gcc_do_make() {
1312
gcc_do_make() {
1316
	# Set make target to $1 if passed
1313
	[[ -n $1 ]] && GCC_MAKE_TARGET=${1}
1317
	[[ -n $1 ]] && GCC_MAKE_TARGET=$1
1314
1318
	# default target
1319
	if is_crosscompile || tc-is-cross-compiler ; then
1315
	if is_crosscompile || tc-is-cross-compiler ; then
1320
		# 3 stage bootstrapping doesnt quite work when you cant run the
1316
		# 3 stage bootstrapping doesnt quite work when you cant run the
1321
		# resulting binaries natively ^^;
1317
		# resulting binaries natively ^^;
Lines 1327-1363 Link Here
1327
	# the gcc docs state that parallel make isnt supported for the
1323
	# the gcc docs state that parallel make isnt supported for the
1328
	# profiledbootstrap target, as collisions in profile collecting may occur.
1324
	# profiledbootstrap target, as collisions in profile collecting may occur.
1329
	# boundschecking also seems to introduce parallel build issues.
1325
	# boundschecking also seems to introduce parallel build issues.
1330
	if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ||
1326
	if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] || use_if_iuse boundschecking ; then
1331
	   use_if_iuse boundschecking
1332
	then
1333
		export MAKEOPTS="${MAKEOPTS} -j1"
1327
		export MAKEOPTS="${MAKEOPTS} -j1"
1334
	fi
1328
	fi
1335
1329
1336
	if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
1330
	if [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
1337
		STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
1338
	elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
1339
		# See bug #79852
1331
		# See bug #79852
1340
		STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
1332
		STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
1341
	fi
1333
	fi
1342
1334
1343
	if is_crosscompile; then
1335
	if is_crosscompile ; then
1344
		# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
1336
		CFLAGS="-O2 -pipe"
1345
		# but I'll leave this in anyways as someone might have had
1337
		FFLAGS=${CFLAGS}
1346
		# some reason for putting it in here... --eradicator
1338
		FCFLAGS=${CFLAGS}
1347
		BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
1339
		local VAR="CFLAGS_"${CTARGET//-/_}
1340
		CXXFLAGS=${!VAR}
1348
	else
1341
	else
1349
		# we only want to use the system's CFLAGS if not building a
1342
#		STAGE1_CFLAGS=${STAGE1_CFLAGS-${CFLAGS}}
1350
		# cross-compiler.
1343
		STAGE1_LDFLAGS=${STAGE1_LDFLAGS-${LDFLAGS}}
1351
		BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
1344
		BOOT_CFLAGS=${BOOT_CFLAGS-$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}}
1345
		BOOT_LDFLAGS=${BOOT_LDFLAGS-${LDFLAGS}}
1346
		CFLAGS_FOR_TARGET=${CFLAGS_FOR_TARGET-${CFLAGS}}
1347
		LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET-${LDFLAGS}}
1352
	fi
1348
	fi
1353
1349
1354
	pushd "${WORKDIR}"/build >/dev/null
1350
	pushd "${WORKDIR}"/build >/dev/null
1355
1351
1356
	emake \
1352
	emake \
1357
		LDFLAGS="${LDFLAGS}" \
1358
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1353
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1359
		LIBPATH="${LIBPATH}" \
1354
		STAGE1_LDFLAGS="${STAGE1_LDFLAGS}" \
1360
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1355
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1356
		BOOT_LDFLAGS="${BOOT_LDFLAGS}" \
1357
		CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET}" \
1358
		LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET}" \
1359
		LIBPATH="${LIBPATH}" \
1361
		${GCC_MAKE_TARGET} \
1360
		${GCC_MAKE_TARGET} \
1362
		|| die "emake failed with ${GCC_MAKE_TARGET}"
1361
		|| die "emake failed with ${GCC_MAKE_TARGET}"
1363
1362
Lines 1444-1487 Link Here
1444
	esac
1443
	esac
1445
1444
1446
	strip-unsupported-flags
1445
	strip-unsupported-flags
1447
	
1448
	# TODO: Move to gcc_do_make()
1449
1450
	# CFLAGS logic (verified with 3.4.3):
1451
	# CFLAGS:
1452
	#	This conflicts when creating a crosscompiler, so set to a sane
1453
	#	  default in this case:
1454
	#	used in ./configure and elsewhere for the native compiler
1455
	#	used by gcc when creating libiberty.a
1456
	#	used by xgcc when creating libstdc++ (and probably others)!
1457
	#	  this behavior should be removed...
1458
	#
1459
	# CXXFLAGS:
1460
	#	used by xgcc when creating libstdc++
1461
	#
1462
	# STAGE1_CFLAGS (not used in creating a crosscompile gcc):
1463
	#	used by ${CHOST}-gcc for building stage1 compiler
1464
	#
1465
	# BOOT_CFLAGS (not used in creating a crosscompile gcc):
1466
	#	used by xgcc for building stage2/3 compiler
1467
1468
	if is_crosscompile ; then
1469
		# Set this to something sane for both native and target
1470
		CFLAGS="-O2 -pipe"
1471
		FFLAGS=${CFLAGS}
1472
		FCFLAGS=${CFLAGS}
1473
1474
		local VAR="CFLAGS_"${CTARGET//-/_}
1475
		CXXFLAGS=${!VAR}
1476
	fi
1477
1478
	export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
1479
}
1446
}
1480
1447
1481
toolchain_src_compile() {
1448
toolchain_src_compile() {
1482
	gcc_do_filter_flags
1449
	gcc_do_filter_flags
1450
1483
	einfo "CFLAGS=\"${CFLAGS}\""
1451
	einfo "CFLAGS=\"${CFLAGS}\""
1484
	einfo "CXXFLAGS=\"${CXXFLAGS}\""
1452
	einfo "CXXFLAGS=\"${CXXFLAGS}\""
1453
	einfo "LDFLAGS=\"${LDFLAGS}\""
1485
1454
1486
	# Force internal zip based jar script to avoid random
1455
	# Force internal zip based jar script to avoid random
1487
	# issues with 3rd party jar implementations.  #384291
1456
	# issues with 3rd party jar implementations.  #384291

Return to bug 337788