public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/files/eblits/
Date: Sat, 16 Jan 2016 08:17:26 +0000 (UTC)	[thread overview]
Message-ID: <1452932204.6f8a59c05ff00ddafbfbfffecdac6e71cf175fbd.vapier@gentoo> (raw)

commit:     6f8a59c05ff00ddafbfbfffecdac6e71cf175fbd
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 16 06:41:29 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Jan 16 08:16:44 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f8a59c0

sys-libs/glibc: rework sparc target selection #323445 #361779

The current code assumes all targets are at least sparc v9.  This breaks
people trying to build for older/embedded targets like sparc v8.  Only use
specific targets when the user has set -mcpu.  This does mean we will be
using a lower target for some users (who don't have -mcpu set), but that's
more in line with what we want.  Similarly, do not assume that because we
are using a 64-bit kernel we always want a 64-bit userland or newer cpu.

We also drop filtering of -mvis flags (we haven't been filtering the newer
options like -mvis2 or -mvis3) as it doesn't seem to be an issue.

We also drop the filtering of -Wa,-xarch and -Wa,-A flags.  We want to let
the user select their own, or just rely on the -mcpu setting.  This might
mean for some users they get slightly slower builds if they haven't set an
explicit -mcpu flag, but that's also what we want.

 sys-libs/glibc/files/eblits/common.eblit | 126 ++++++++++++++++++-------------
 1 file changed, 73 insertions(+), 53 deletions(-)

diff --git a/sys-libs/glibc/files/eblits/common.eblit b/sys-libs/glibc/files/eblits/common.eblit
index 51ba4a9..c0a989c 100644
--- a/sys-libs/glibc/files/eblits/common.eblit
+++ b/sys-libs/glibc/files/eblits/common.eblit
@@ -102,62 +102,82 @@ setup_target_flags() {
 			# Both sparc and sparc64 can use -fcall-used-g6.  -g7 is bad, though.
 			filter-flags "-fcall-used-g7"
 			append-flags "-fcall-used-g6"
-			filter-flags "-mvis"
-
-			GLIBCMAJOR=$(get_version_component_range 1 ${PV})
-			GLIBCMINOR=$(get_version_component_range 2 ${PV})
-
-			# set CTARGET_OPT so glibc can use cpu-specific .S files for better performance
-			# - UltraSPARC T1 (niagara) support requires >= glibc 2.8
-			# - UltraSPARC T2 (niagara2) support requires >= glibc 2.7
-
-			if is_crosscompile || [[ ${PROFILE_ARCH} == "sparc64" ]] || { has_multilib_profile && ! tc-is-cross-compiler; } ; then
-				case ${ABI}:${CTARGET} in
-					sparc64:*|\
-					default:sparc64*)
-						filter-flags -Wa,-xarch -Wa,-A
-
-						if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
-							CTARGET_OPT="sparc64v2-unknown-linux-gnu"
-							append-flags "-Wa,-xarch=v9b"
-							export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
-						elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
-							CTARGET_OPT="sparc64v-unknown-linux-gnu"
-							append-flags "-Wa,-xarch=v9b"
-							export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
-						elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
-							CTARGET_OPT="sparc64b-unknown-linux-gnu"
-							append-flags "-Wa,-xarch=v9b"
-							export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
-						else
-							CTARGET_OPT="sparc64-unknown-linux-gnu"
-							append-flags "-Wa,-xarch=v9a"
-							export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9a"
-						fi
+
+			# If the CHOST is the basic one (e.g. not sparcv9-xxx already),
+			# try to pick a better one so glibc can use cpu-specific .S files.
+			# We key off the CFLAGS to get a good value.  Also need to handle
+			# version skew.
+			# We can't force users to set their CHOST to their exact machine
+			# as many of these are not recognized by config.sub/gcc and such :(.
+			# Note: If the mcpu values don't scale, we might try probing CPP defines.
+			# Note: Should we factor in -Wa,-AvXXX flags too ?  Or -mvis/etc... ?
+
+			local cpu
+			case ${CTARGET} in
+			sparc64-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparc64v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparc64v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparc64b"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparc64b"
 					;;
-					*)
-						if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
-							CTARGET_OPT="sparcv9v2-unknown-linux-gnu"
-						elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
-							CTARGET_OPT="sparcv9v-unknown-linux-gnu"
-						elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
-							CTARGET_OPT="sparcv9b-unknown-linux-gnu"
-						else
-							CTARGET_OPT="sparcv9-unknown-linux-gnu"
-						fi
+				*)
+					# We need to force at least v9a because the base build doesn't
+					# work with just v9.
+					# https://sourceware.org/bugzilla/show_bug.cgi?id=19477
+					[[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
 					;;
 				esac
-			else
-				if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
-					CTARGET_OPT="sparcv9v2-unknown-linux-gnu"
-				elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
-					CTARGET_OPT="sparcv9v-unknown-linux-gnu"
-				elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
-					CTARGET_OPT="sparcv9b-unknown-linux-gnu"
-				elif { is_crosscompile && want_nptl; } || is-flagq "-mcpu=ultrasparc2" || is-flagq "-mcpu=ultrasparc"; then
-					CTARGET_OPT="sparcv9-unknown-linux-gnu"
-				fi
-			fi
+				;;
+			sparc-*)
+				case $(get-flag mcpu) in
+				niagara[234])
+					if version_is_at_least 2.8 ; then
+						cpu="sparcv9v2"
+					elif version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				niagara)
+					if version_is_at_least 2.4 ; then
+						cpu="sparcv9v"
+					elif version_is_at_least 2.2.3 ; then
+						cpu="sparcv9b"
+					else
+						cpu="sparcv9"
+					fi
+					;;
+				ultrasparc3)
+					cpu="sparcv9b"
+					;;
+				v9|ultrasparc)
+					cpu="sparcv9"
+					;;
+				v8|supersparc|hypersparc|leon|leon3)
+					cpu="sparcv8"
+					;;
+				esac
+			;;
+			esac
+			[[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
 		;;
 	esac
 }


             reply	other threads:[~2016-01-16  8:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-16  8:17 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-01-07 13:49 [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/files/eblits/ Benda XU
2016-12-07  7:03 Mike Frysinger
2016-11-25  5:50 Mike Frysinger
2016-09-03 11:06 Michał Górny
2016-06-19 23:19 Benda XU
2016-06-06 13:28 Benda XU
2016-06-02 13:26 Benda XU
2016-06-02  8:08 Benda XU
2015-12-30 20:40 Mike Frysinger
2015-10-16 18:26 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452932204.6f8a59c05ff00ddafbfbfffecdac6e71cf175fbd.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox