From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Sb6j0-0000Ld-Ks for garchives@archives.gentoo.org; Sun, 03 Jun 2012 09:03:50 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 99E81E07B3; Sun, 3 Jun 2012 09:03:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 58A95E07B3 for ; Sun, 3 Jun 2012 09:03:28 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8F5221B4008 for ; Sun, 3 Jun 2012 09:03:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 8F93BE5404 for ; Sun, 3 Jun 2012 09:03:25 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1338443018.15ec45f4528a073d72039b66f239abebf6feb25a.vapier@gentoo> Subject: [gentoo-commits] proj/crossdev:master commit in: / X-VCS-Repository: proj/crossdev X-VCS-Files: TODO crossdev X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 15ec45f4528a073d72039b66f239abebf6feb25a X-VCS-Branch: master Date: Sun, 3 Jun 2012 09:03:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 2a715536-1bf2-461a-92a7-ea3fbbc3a02a X-Archives-Hash: ae3aa4732eff454400dab328848ddb63 commit: 15ec45f4528a073d72039b66f239abebf6feb25a Author: Mike Frysinger gentoo org> AuthorDate: Sat May 26 05:25:48 2012 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu May 31 05:43:38 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/crossdev.git;= a=3Dcommit;h=3D15ec45f4 crossdev: split host and target ABIs The current ABI env var system does not differentiate between the ABI of the CHOST (where things run) and the ABI of the target (what we're generating code for). This makes it difficult to build a toolchain that runs on ABI=3Damd64 but targets ABI=3Dx32. Introduce a TARGET_ABI set of variables that the tools that run on the CHOST can use to figure out what ABIs it needs to build for the CTARGET. Signed-off-by: Mike Frysinger gentoo.org> --- TODO | 5 ---- crossdev | 71 +++++++++++++++++++++++++++++++++++++++++++++++++-------= ----- 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/TODO b/TODO index e850bc5..f5e089b 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,6 @@ - strip package.use.force (i.e. building x86_64 on x86_64 gets forced mu= ltilib) - filter /usr/CTARGET/ from revdep-rebuild #182601 =20 -- HOST_ABI and TARGET_ABI selection; consider: - - build a 64bit (amd64) cross-compiler which targets 32bit (x86) - - build a 64bit (amd64) cross-compiler which targets x32 - - ABI variables atm do not differentiate between host - - package.use not getting setup correctly: # cat /etc/portage/package.use/cross-x86_64-cros-linux-gnu cross-x86_64-cros-linux-gnu/gdb sys-devel gdb diff --git a/crossdev b/crossdev index 2b491bc..9a294fe 100755 --- a/crossdev +++ b/crossdev @@ -47,6 +47,7 @@ Options: Note: versions support depend atom synta= xes: e.g. ">=3D2.20" "~4.6.1" "=3D2.13.1-r3" ${GOOD}-A, --abis${NORMAL} abis Specify ABIs to build, firs= t one is the default + ${GOOD}--host-abi abi Specify the ABI of the comp= iler itself ${GOOD}--env${NORMAL} env Specify env settings for al= l packages (see below) ${GOOD}--[bdgkl]env${NORMAL} env Specify env settings for bi= nutils/gdb/gcc/kernel/libc Note: make sure to quote: 'VAR=3D"some v= alue"\nFOO=3D"cow"' @@ -457,6 +458,7 @@ HARCH=3D CTARGET=3D MULTILIB_ABIS=3D"default" MULTILIB_USE=3D"" +HOST_ABI=3D"default" STAGE=3D"" AENV=3D"" BCAT=3D"sys-devel" ; BPKG=3D"binutils" ; BVER=3D"" BUSE=3D"" BENV=3D= "" BOVL=3D"" @@ -504,6 +506,7 @@ while [[ $# -gt 0 ]] ; do -ol|--ov-libc) shift; LOVL=3D$1;; --env) shift; AENV=3D$1;; -A|--abis) shift; MULTILIB_ABIS=3D$1;; + --host-abi) shift; HOST_ABI=3D$1;; -S|--stable) DEFAULT_VER=3D"[stable]";; -C|--clean) shift; parse_target $1; uninstall;; -s?|--stage?) STAGE=3D${1:0-1};; @@ -606,8 +609,13 @@ for v in MULTILIB_ABIS UCLIBC_CPU USE BVER GVER KVER= LVER STAGE CFLAGS LDFLAGS A done =20 # parse multilib settings until profiles are sane -eval $( - # clean the env +multilib_env() { + local var=3D$1 + eval $( + # see what target to parse + CTARGET=3D${!var} + + # clean the env in our subshell unset ${!CFLAGS_*} ${!CHOST_*} ${!CTARGET_*} ${!LDFLAGS_*} ${!LIBDIR_*} =20 # ask multilib.eclass to tell us how things work @@ -630,9 +638,14 @@ eval $( ${single_abi} && MULTILIB_ABIS=3D${DEFAULT_ABI} =20 # output the desired env - for v in ${!CFLAGS_*} ${!CHOST_*} ${!CTARGET_*} ${!LDFLAGS_*} ${!LIBDIR= _*} MULTILIB_ABIS DEFAULT_ABI ; do + for v in ${!CFLAGS_*} ${!CHOST_*} ${!CTARGET_*} ${!LDFLAGS_*} ${!LIBDIR= _*} ; do echo ${v}=3D\'${!v}\' done + # output the variables that are not uniquely named + [[ ${var} =3D=3D "CTARGET" ]] && d=3D'' || d=3D'_' + for v in MULTILIB_ABIS DEFAULT_ABI ; do + echo ${d}${v}=3D\'${!v}\' + done =20 # make sure all ABIs have valid vars def_CFLAGS=3D @@ -646,7 +659,14 @@ eval $( echo ${_v}=3D\'${!d}\' done done -) + ) +} +# Load settings for the host. +MULTILIB_ABIS=3D${HOST_ABI} multilib_env HCHOST +HOST_ABI=3D${_MULTILIB_ABIS} +# Load settings for the target. +multilib_env CTARGET + DEFAULT_ABI=3D${MULTILIB_ABIS%% *} if [[ -z ${MULTILIB_USE} ]] ; then if [[ $(set -- ${MULTILIB_ABIS}; echo $#) -eq 1 ]] ; then @@ -791,7 +811,7 @@ set_links() { ln -s "${srcdir}"/${cat}/${pkg} "${d}" } set_env() { - local pkg=3D$1 env=3D$2 output + local l=3D$1 pkg=3D$2 env=3D$3 output shift ; shift =20 # We have to ignore collisions in the build-id tree because it's @@ -811,16 +831,41 @@ set_env() { $(printf '%b' "${AENV}") EOF =20 + # We need to differentiate between the host and target ABI just like + # we have to handle the difference between CHOST and CTARGET. For + # the headers and library packages, we want the ABI to be the target. + # For the compiler tools (as/ld/cc/gdb/etc...), we want the ABI to be + # the host. + local TARGET_ABI=3D$(set -- ${MULTILIB_ABIS}; echo $1) + case ${l} in + K|L) + # Target packages. + local ABI=3D${TARGET_ABI} + # Use MULTILIB_ABIS & DEFAULT_ABI from env. + ;; + *) + # Host packages. + cat <<-EOF >> "${output}" + TARGET_ABI=3D'${TARGET_ABI}' + TARGET_MULTILIB_ABIS=3D'${MULTILIB_ABIS}' + TARGET_DEFAULT_ABI=3D'${DEFAULT_ABI}' + EOF + local ABI=3D${HOST_ABI} + local MULTILIB_ABIS=3D${ABI} + local DEFAULT_ABI=3D${ABI} + ;; + esac local v - local ABI=3D$(set -- ${MULTILIB_ABIS}; echo $1) for v in ${!CFLAGS_*} ${!CHOST_*} ${!CTARGET_*} ${!LDFLAGS_*} ${!LIBDIR= _*} ABI MULTILIB_ABIS DEFAULT_ABI ; do - echo "${v}=3D'${!v}'" >> "${output}" - done + echo "${v}=3D'${!v}'" + done >> "${output}" =20 output=3D$(_set_portage_file ${pkg} package.env) echo "cross-${CTARGET}/${pkg} cross-${CTARGET}/${pkg}.conf" >> ${output= } } set_portage() { + local l=3D$1 + eval set -- \${${l}CAT} \${${l}PKG} \${${l}VER} \"\${${l}ENV}\" \"\${${= l}OVL}\" local cat=3D$1 pkg=3D$2 ver=3D$3 env=3D$4 ovl=3D$5 shift 5 local use=3D$@ @@ -832,7 +877,7 @@ set_portage() { set_use_force ${pkg} -multilib set_use_mask ${pkg} -multilib set_links ${cat} ${pkg} "${ovl}" - set_env ${pkg} "${env}" + set_env ${l} ${pkg} "${env}" } set_metadata() { # for people who have eclasses spread over their overlays, generate @@ -914,11 +959,9 @@ for f in package.{env,keywords,mask,use} env/cross-$= {CTARGET} profile/package.us rm -f ${f}/cross-${CTARGET} done =20 -set_portage ${BCAT} ${BPKG} ${BVER} "${BENV}" "${BOVL}" -set_portage ${GCAT} ${GPKG} ${GVER} "${GENV}" "${GOVL}" -set_portage ${KCAT} ${KPKG} ${KVER} "${KENV}" "${KOVL}" -set_portage ${LCAT} ${LPKG} ${LVER} "${LENV}" "${LOVL}" -set_portage ${DCAT} ${DPKG} ${DVER} "${DENV}" "${DOVL}" +for v in B G K L D ; do + set_portage ${v} +done set_metadata =20 # filter out revdep rebuild stuff #182601