From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 21E03158010 for ; Sat, 28 Jan 2023 22:12:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 654A4E092E; Sat, 28 Jan 2023 22:12:27 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4A550E092E for ; Sat, 28 Jan 2023 22:12:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3F99B340ECC for ; Sat, 28 Jan 2023 22:12:26 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E892A88C for ; Sat, 28 Jan 2023 22:12:23 +0000 (UTC) From: "James Le Cuirot" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "James Le Cuirot" Message-ID: <1674943876.72925b1dccebbf082c31a2be89c7693d966ecd54.chewi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/features/prefix/standalone/, eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/toolchain.eclass profiles/features/prefix/standalone/profile.bashrc X-VCS-Directories: eclass/ profiles/features/prefix/standalone/ X-VCS-Committer: chewi X-VCS-Committer-Name: James Le Cuirot X-VCS-Revision: 72925b1dccebbf082c31a2be89c7693d966ecd54 X-VCS-Branch: master Date: Sat, 28 Jan 2023 22:12:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 808e31c0-f34f-44de-b8a0-513f0bc0537a X-Archives-Hash: 3d2bcf58557d232559ac794470af42ea commit: 72925b1dccebbf082c31a2be89c7693d966ecd54 Author: James Le Cuirot gentoo org> AuthorDate: Mon Dec 26 22:32:02 2022 +0000 Commit: James Le Cuirot gentoo org> CommitDate: Sat Jan 28 22:11:16 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72925b1d toolchain.eclass: Fix cross-compiling gcc for standalone prefix Standalone prefix has always configured gcc with a sysroot, but the location of this sysroot is different at build time when cross-compiling. gcc has a separate configure option for that. prefix-guest systems do not have a sysroot applied, as they use the host's libc. Move this code from the prefix profile into the eclass so that it's less of a special case. We can avoid relying on the `BOOTSTRAP_RAP_STAGE2` variable by checking for the `prefix-guest` USE flag instead, as a prefix-guest profile is now used for RAP stage 2. Signed-off-by: James Le Cuirot gentoo.org> eclass/toolchain.eclass | 15 +++++++++++++++ profiles/features/prefix/standalone/profile.bashrc | 3 --- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 0dd23d93e383..479814f0df3e 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1200,6 +1200,21 @@ toolchain_src_configure() { confgcc+=( --enable-threads=posix ) ;; esac + + if ! use prefix-guest ; then + # GNU ld scripts, such as those in glibc, reference unprefixed paths + # as the sysroot given here is automatically prepended. For + # prefix-guest, we use the host's libc instead. + if [[ -n ${EPREFIX} ]] ; then + confgcc+=( --with-sysroot="${EPREFIX}" ) + fi + + # We need to build against the right headers and libraries. Again, + # for prefix-guest, this is the host's. + if [[ -n ${ESYSROOT} ]] ; then + confgcc+=( --with-build-sysroot="${ESYSROOT}" ) + fi + fi fi # __cxa_atexit is "essential for fully standards-compliant handling of diff --git a/profiles/features/prefix/standalone/profile.bashrc b/profiles/features/prefix/standalone/profile.bashrc index 3cdda77b9a88..043f766c37e9 100644 --- a/profiles/features/prefix/standalone/profile.bashrc +++ b/profiles/features/prefix/standalone/profile.bashrc @@ -21,9 +21,6 @@ if [[ ${CATEGORY}/${PN} == sys-devel/gcc && ${EBUILD_PHASE} == configure ]]; the fi eend $? done - - # use sysroot of toolchain to get correct include and library at compile time - EXTRA_ECONF="${EXTRA_ECONF} --with-sysroot=${EPREFIX}" elif [[ ${CATEGORY}/${PN} == sys-devel/clang && ${EBUILD_PHASE} == configure ]]; then ebegin "Use ${EPREFIX} as default sysroot" sed -i -e "s@DEFAULT_SYSROOT \"\"@DEFAULT_SYSROOT \"${EPREFIX}\"@" "${S}"/CMakeLists.txt