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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2FF4D158099 for ; Fri, 24 Nov 2023 18:35:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4B2E12BC02C; Fri, 24 Nov 2023 18:35:26 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 2F1502BC058 for ; Fri, 24 Nov 2023 18:35:26 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2CA49335DA7 for ; Fri, 24 Nov 2023 18:35:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5DA8013D3 for ; Fri, 24 Nov 2023 18:35:23 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1700850904.6f6e58bd266a7e82f2eff29703a5a819b20ce8f7.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/go-env.eclass X-VCS-Directories: eclass/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 6f6e58bd266a7e82f2eff29703a5a819b20ce8f7 X-VCS-Branch: master Date: Fri, 24 Nov 2023 18:35: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: d3323fc4-2f18-46be-a5bd-f9224b5e6c3e X-Archives-Hash: c4473112798365a2dff8370e9794c5df commit: 6f6e58bd266a7e82f2eff29703a5a819b20ce8f7 Author: Sam James gentoo org> AuthorDate: Fri Nov 24 17:42:25 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Nov 24 18:35:04 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f6e58bd go-env.eclass: fix GO386 handling Go 1.16 dropped explicit support for 386 FP and relies on software emulation instead in the absence of SSE2. * First, check if cpu_flags_x86_sse2 is used in the ebuild. If it is and it's enabled, then act in SSE2 mode. * If not, fall back to checking whether the compiler has __SSE2__ defined via e.g. -march in CFLAGS. * Failing that, use softfloat mode. Fixes the issue mentioned in 5718f8440197298e0aa1df2a88a66057d2cdaf83 (where we tried to use a USE flag which isn't implicit). Signed-off-by: Sam James gentoo.org> eclass/go-env.eclass | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass index 4bc8c4b15c65..1f950db06930 100644 --- a/eclass/go-env.eclass +++ b/eclass/go-env.eclass @@ -31,7 +31,7 @@ go-env_set_compile_environment() { export GOARCH="$(go-env_goarch)" use arm && export GOARM=$(go-env_goarm) - use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat') + use x86 && export GO386=$(go-env_go386) export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}" export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}" @@ -62,6 +62,27 @@ go-env_goarch() { esac } +# @FUNCTION: go-env_go386 +# @DESCRIPTION: +# Returns the appropriate GO386 setting for the CFLAGS in use. +go-env_go386() { + # Piggy-back off any existing CPU_FLAGS_X86 usage in the ebuild if + # it's there. + if in_iuse cpu_flags_x86_sse2 && use cpu_flags_x86_sse2 ; then + echo 'sse2' + return + fi + + if tc-cpp-is-true "defined(__SSE2__)" ${CFLAGS} ${CXXFLAGS} ; then + echo 'sse2' + return + fi + + # Go 1.16 dropped explicit support for 386 FP and relies on software + # emulation instead in the absence of SSE2. + echo 'softfloat' +} + # @FUNCTION: go-env_goarm # @USAGE: [CHOST-value] # @DESCRIPTION: