public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Marek Szuba" <marecki@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/nodejs/, net-libs/nodejs/files/
Date: Thu, 22 Apr 2021 15:27:31 +0000 (UTC)	[thread overview]
Message-ID: <1619105232.5b43e0081fcb5059fc9e68a0aa7d2993a8805643.marecki@gentoo> (raw)

commit:     5b43e0081fcb5059fc9e68a0aa7d2993a8805643
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 22 13:47:11 2021 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Thu Apr 22 15:27:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b43e008

net-libs/nodejs-16.0.0: implement IUSE=lto

Note that the upstream patch which for the time being is required to
make LTO work only has an effect if the aforementioned USE flag is set.

Closes: https://bugs.gentoo.org/784995
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 net-libs/nodejs/files/nodejs-16.0.0-v8_lto.patch   | 39 ++++++++++++++++++++++
 net-libs/nodejs/metadata.xml                       |  1 +
 ...odejs-16.0.0.ebuild => nodejs-16.0.0-r1.ebuild} | 12 +++++--
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/net-libs/nodejs/files/nodejs-16.0.0-v8_lto.patch b/net-libs/nodejs/files/nodejs-16.0.0-v8_lto.patch
new file mode 100644
index 00000000000..a3e4acb02c3
--- /dev/null
+++ b/net-libs/nodejs/files/nodejs-16.0.0-v8_lto.patch
@@ -0,0 +1,39 @@
+From ea694e2b138d2f991989e09fc0e964fec3587b5f Mon Sep 17 00:00:00 2001
+From: Jesse Chan <jc@linux.com>
+Date: Thu, 22 Apr 2021 19:41:09 +0800
+Subject: [PATCH] tools: disable LTO for "v8_cppgc_shared" target
+
+"PushAllRegistersAndIterateStack" is implemented in assembly and
+called from "stack.cc" via 'extern "C"'. [1]
+
+However, LTO does not work well with symbol usage from assembly. [2]
+
+This change workarounds the issue by disabling LTO for the target.
+
+With GCC 10 and "./configure --enable-lto", compilation succeeds
+after this change.
+
+[1] v8/v8@c10863153
+[2] https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ#Symbol_usage_from_assembly_language
+
+Refs: #35957
+Refs: #38335
+Signed-off-by: Jesse Chan <jc@linux.com>
+---
+ tools/v8_gypfiles/v8.gyp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
+index ccb5984f47d..377e12d1fdc 100644
+--- a/tools/v8_gypfiles/v8.gyp
++++ b/tools/v8_gypfiles/v8.gyp
+@@ -1378,6 +1378,9 @@
+           '<(V8_ROOT)/src/heap/base/worklist.h',
+         ],
+         'conditions': [
++          ['enable_lto=="true"', {
++            'cflags_cc': [ '-fno-lto' ],
++          }],
+           ['clang or OS!="win"', {
+             'conditions': [
+               ['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {

diff --git a/net-libs/nodejs/metadata.xml b/net-libs/nodejs/metadata.xml
index db1b9aefa8e..15befbfa251 100644
--- a/net-libs/nodejs/metadata.xml
+++ b/net-libs/nodejs/metadata.xml
@@ -12,6 +12,7 @@
 	</maintainer>
 	<use>
 		<flag name="inspector">Enable V8 inspector</flag>
+		<flag name="lto">Build with link-time optimisation</flag>
 		<flag name="npm">Enable NPM package manager</flag>
 		<flag name="pax_kernel">Enable building under a PaX enabled kernel</flag>
 		<flag name="snapshot">Enable snapshot creation for faster startup</flag>

diff --git a/net-libs/nodejs/nodejs-16.0.0.ebuild b/net-libs/nodejs/nodejs-16.0.0-r1.ebuild
similarity index 93%
rename from net-libs/nodejs/nodejs-16.0.0.ebuild
rename to net-libs/nodejs/nodejs-16.0.0-r1.ebuild
index 3b317ab08c9..612a576994a 100644
--- a/net-libs/nodejs/nodejs-16.0.0.ebuild
+++ b/net-libs/nodejs/nodejs-16.0.0-r1.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{7..9} )
 PYTHON_REQ_USE="threads(+)"
 
-inherit bash-completion-r1 flag-o-matic pax-utils python-any-r1 toolchain-funcs xdg-utils
+inherit bash-completion-r1 pax-utils python-any-r1 toolchain-funcs xdg-utils
 
 DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
 HOMEPAGE="https://nodejs.org/"
@@ -16,7 +16,7 @@ LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
 SLOT="0/$(ver_cut 1)"
 KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos"
 
-IUSE="cpu_flags_x86_sse2 debug doc +icu inspector +npm pax_kernel +snapshot +ssl system-icu +system-ssl systemtap test"
+IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax_kernel +snapshot +ssl system-icu +system-ssl systemtap test"
 REQUIRED_USE="inspector? ( icu ssl )
 	npm? ( ssl )
 	system-icu? ( icu )
@@ -42,6 +42,7 @@ DEPEND="${RDEPEND}"
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-15.2.0-global-npm-config.patch
+	"${FILESDIR}"/${PN}-16.0.0-v8_lto.patch
 )
 
 S="${WORKDIR}/node-v${PV}"
@@ -49,6 +50,12 @@ S="${WORKDIR}/node-v${PV}"
 pkg_pretend() {
 	(use x86 && ! use cpu_flags_x86_sse2) && \
 		die "Your CPU doesn't support the required SSE2 instruction."
+
+	if [[ ${MERGE_TYPE} != "binary" ]]; then
+		if use lto; then
+			tc-is-gcc || die "${PN} only supports LTO for gcc"
+		fi
+	fi
 }
 
 src_prepare() {
@@ -103,6 +110,7 @@ src_configure() {
 		--shared-zlib
 	)
 	use debug && myconf+=( --debug )
+	use lto && myconf+=( --enable-lto )
 	if use system-icu; then
 		myconf+=( --with-intl=system-icu )
 	elif use icu; then


             reply	other threads:[~2021-04-22 15:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 15:27 Marek Szuba [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-25 16:45 [gentoo-commits] repo/gentoo:master commit in: net-libs/nodejs/, net-libs/nodejs/files/ Jakov Smolić
2024-02-04  0:37 Jakov Smolić
2024-01-22 21:16 William Hubbs
2023-11-02 21:34 William Hubbs
2023-08-09 19:21 William Hubbs
2023-06-10 19:32 William Hubbs
2023-05-05 15:16 William Hubbs
2023-04-30  1:24 William Hubbs
2022-05-06  5:21 Joonas Niilola
2022-03-17 21:39 William Hubbs
2021-09-16 16:42 Marek Szuba
2021-08-13 17:36 Marek Szuba
2021-05-13 21:36 Marek Szuba
2021-05-13 15:30 Georgy Yakovlev
2021-04-20 17:48 Marek Szuba
2020-11-20 20:28 William Hubbs
2020-08-27 17:48 Jeroen Roovers
2020-02-17  0:38 Magnus Granberg
2018-12-13 12:12 Jeroen Roovers
2018-12-09 14:59 Jeroen Roovers
2018-05-30  7:46 Jeroen Roovers
2017-11-02 22:59 Jeroen Roovers
2017-11-01 11:42 Jeroen Roovers
2016-02-11 12:07 Patrick Lauer

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=1619105232.5b43e0081fcb5059fc9e68a0aa7d2993a8805643.marecki@gentoo \
    --to=marecki@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