summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Smith <matthew@gentoo.org>2022-08-20 07:35:44 +0100
committerMatthew Smith <matthew@gentoo.org>2022-08-20 07:37:32 +0100
commitff754ddf643973da9cabf7778504572e6451b2e8 (patch)
tree5b4eb1505a571cae52a313b4b1d087dced6f3af1 /sys-devel/mold
parentdev-libs/xmlsec: depend on libxml2[ftp(+)] (diff)
downloadgentoo-ff754ddf643973da9cabf7778504572e6451b2e8.tar.gz
gentoo-ff754ddf643973da9cabf7778504572e6451b2e8.tar.bz2
gentoo-ff754ddf643973da9cabf7778504572e6451b2e8.zip
sys-devel/mold: fix build with gcc-12
Prevent overeager stripping of compiler flags by vendored tbb CMake scripts. No revbump as installed files are the same. Closes: https://bugs.gentoo.org/865837 Signed-off-by: Matthew Smith <matthew@gentoo.org>
Diffstat (limited to 'sys-devel/mold')
-rw-r--r--sys-devel/mold/files/mold-1.4.1-tbb-flags-stripping.patch28
-rw-r--r--sys-devel/mold/mold-1.4.1.ebuild2
-rw-r--r--sys-devel/mold/mold-9999.ebuild5
3 files changed, 35 insertions, 0 deletions
diff --git a/sys-devel/mold/files/mold-1.4.1-tbb-flags-stripping.patch b/sys-devel/mold/files/mold-1.4.1-tbb-flags-stripping.patch
new file mode 100644
index 000000000000..58cfca04132e
--- /dev/null
+++ b/sys-devel/mold/files/mold-1.4.1-tbb-flags-stripping.patch
@@ -0,0 +1,28 @@
+https://github.com/oneapi-src/oneTBB/pull/716
+https://bugs.gentoo.org/865837
+
+From 9595b9699ae6863d1e0cf770a89728eafcaf8845 Mon Sep 17 00:00:00 2001
+From: Christoph Erhardt <github@sicherha.de>
+Date: Wed, 5 Jan 2022 15:13:32 +0100
+Subject: [PATCH] Fix overeager stripping of compile flag
+
+The existing regex strips all occurrences of the given string from
+`${CMAKE_CXX_FLAGS}`, regardless of whether it is just a substring of a
+flag. For instance, `-Werror=format-security` gets truncated to
+`=format-security`.
+
+The new regex makes sure that only whole words get replaced.
+
+Signed-off-by: Christoph Erhardt <github@sicherha.de>
+--- a/third-party/tbb/cmake/utils.cmake
++++ b/third-party/tbb/cmake/utils.cmake
+@@ -18,7 +18,7 @@ macro(tbb_remove_compile_flag flag)
+ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_OPTIONS ${_tbb_compile_options})
+ unset(_tbb_compile_options)
+ if (CMAKE_CXX_FLAGS)
+- string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
++ string(REGEX REPLACE "(^|[ \t\r\n]+)${flag}($|[ \t\r\n]+)" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+ endif()
+ endmacro()
+
+
diff --git a/sys-devel/mold/mold-1.4.1.ebuild b/sys-devel/mold/mold-1.4.1.ebuild
index 1aac8ca1098e..804483084d56 100644
--- a/sys-devel/mold/mold-1.4.1.ebuild
+++ b/sys-devel/mold/mold-1.4.1.ebuild
@@ -36,6 +36,8 @@ PATCHES=(
# Allows us to rm the tests as before. Will be included in next
# release.
"${FILESDIR}"/mold-1.4.1-glob-tests.patch
+ # https://bugs.gentoo.org/865837
+ "${FILESDIR}"/mold-1.4.1-tbb-flags-stripping.patch
)
pkg_pretend() {
diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-9999.ebuild
index b170b570b827..735bfbb79a24 100644
--- a/sys-devel/mold/mold-9999.ebuild
+++ b/sys-devel/mold/mold-9999.ebuild
@@ -32,6 +32,11 @@ RDEPEND="
"
DEPEND="${RDEPEND}"
+PATCHES=(
+ # https://bugs.gentoo.org/865837
+ "${FILESDIR}"/mold-1.4.1-tbb-flags-stripping.patch
+)
+
pkg_pretend() {
# Requires a c++20 compiler, see #831473
if [[ ${MERGE_TYPE} != binary ]]; then