public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Disable LTO when using cargo.eclass
Date: Wed, 12 Jul 2023 14:22:55 +0200	[thread overview]
Message-ID: <20230712122503.309626-5-mgorny@gentoo.org> (raw)
In-Reply-To: <20230712122503.309626-1-mgorny@gentoo.org>

Strip LTO flags when cargo.eclass is inherited.  This means that Rust
extensions are being built, and linking them with C/C++ style LTO
results in broken shared libraries.

Closes: https://bugs.gentoo.org/910220
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 924e83b54ad8..5f2decaa89a3 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -191,6 +191,7 @@ esac
 if [[ -z ${_DISTUTILS_R1_ECLASS} ]]; then
 _DISTUTILS_R1_ECLASS=1
 
+inherit flag-o-matic
 inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs
 
 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
@@ -1836,6 +1837,12 @@ distutils-r1_run_phase() {
 		local -x CYTHON_FORCE_REGEN=1
 	fi
 
+	# Rust extensions are incompatible with C/C++ LTO compiler
+	# see e.g. https://bugs.gentoo.org/910220
+	if [[ ${_CARGO_ECLASS} ]]; then
+		filter-lto
+	fi
+
 	# How to build Python modules in different worlds...
 	local ldopts
 	case "${CHOST}" in
-- 
2.41.0



  parent reply	other threads:[~2023-07-12 12:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 12:22 [gentoo-dev] [PATCH 0/4] python eclasses: PyPy3.10 update + cargo LTO strip-flags Michał Górny
2023-07-12 12:22 ` [gentoo-dev] [PATCH 1/4] python-utils-r1.eclass: Require >=dev-python/pypy3-7.3.12 Michał Górny
2023-07-12 12:22 ` [gentoo-dev] [PATCH 2/4] python-utils-r1.eclass: pypy3 is now 3.10-only Michał Górny
2023-07-12 12:22 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Update addpredict for PyPy3.10 Michał Górny
2023-07-12 12:22 ` Michał Górny [this message]
2023-07-12 17:42   ` [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Disable LTO when using cargo.eclass Ulrich Mueller
2023-07-12 17:48     ` Michał Górny

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=20230712122503.309626-5-mgorny@gentoo.org \
    --to=mgorny@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