From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1553376-garchives=archives.gentoo.org@lists.gentoo.org>
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 3F774158089
	for <garchives@archives.gentoo.org>; Sun, 10 Sep 2023 07:06:43 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 668942BC018;
	Sun, 10 Sep 2023 07:06:42 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.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 2E5E82BC018
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Sep 2023 07:06:42 +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 433A6335CE3
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Sep 2023 07:06:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D01C3113E
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Sep 2023 07:06:39 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
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" <sam@gentoo.org>
Message-ID: <1694329585.979add2eb4a279abf853ee1278e4b3e39974601c.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/clang-common/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-devel/clang-common/clang-common-17.0.0.9999.ebuild sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild sys-devel/clang-common/clang-common-18.0.0.9999.ebuild sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild
X-VCS-Directories: sys-devel/clang-common/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 979add2eb4a279abf853ee1278e4b3e39974601c
X-VCS-Branch: master
Date: Sun, 10 Sep 2023 07:06:39 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 87140330-ee87-4f7a-9682-62972efc2274
X-Archives-Hash: 243a017f26152876406bf2ffb4f94baf

commit:     979add2eb4a279abf853ee1278e4b3e39974601c
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Fri Sep  8 23:17:47 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 10 07:06:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=979add2e

sys-devel/clang-common: Don't pass link args to clang-cpp

Passing link args to clang-cpp via configuration file causes it to break
when invoked directly, which is done in some configure scripts (such as
x11-libs/libX11).

Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/32480
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../clang-common/clang-common-17.0.0.9999.ebuild   | 22 +++++++++++++++++++++-
 .../clang-common/clang-common-17.0.0_rc4-r1.ebuild | 22 +++++++++++++++++++++-
 .../clang-common/clang-common-18.0.0.9999.ebuild   | 22 +++++++++++++++++++++-
 .../clang-common-18.0.0_pre20230906-r1.ebuild      | 22 +++++++++++++++++++++-
 4 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
index 5e56c5f7b4e6..430e91d98aee 100644
--- a/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
@@ -67,13 +67,19 @@ doclang_cfg() {
 	local triple="${1}"
 
 	local tool
-	for tool in ${triple}-clang{,++,-cpp}; do
+	for tool in ${triple}-clang{,++}; do
 		newins - "${tool}.cfg" <<-EOF
 			# This configuration file is used by ${tool} driver.
 			@gentoo-common.cfg
+			@gentoo-common-ld.cfg
 		EOF
 	done
 
+	newins - "${triple}-clang-cpp.cfg" <<-EOF
+		# This configuration file is used by the ${triple}-clang-cpp driver.
+		@gentoo-common.cfg
+	EOF
+
 	# Install symlinks for triples with other vendor strings since some
 	# programs insist on mangling the triple.
 	local vendor
@@ -115,6 +121,13 @@ src_install() {
 		-include "${EPREFIX}/usr/include/gentoo/maybe-stddefs.h"
 	EOF
 
+	# clang-cpp does not like link args being passed to it when directly
+	# invoked, so use a separate configuration file.
+	newins - gentoo-common-ld.cfg <<-EOF
+		# This file contains flags common to clang and clang++
+		@gentoo-hardened-ld.cfg
+	EOF
+
 	# Baseline hardening (bug #851111)
 	newins - gentoo-hardened.cfg <<-EOF
 		# Some of these options are added unconditionally, regardless of
@@ -123,7 +136,11 @@ src_install() {
 		-fstack-protector-strong
 		-fPIE
 		-include "${EPREFIX}/usr/include/gentoo/fortify.h"
+	EOF
 
+	newins - gentoo-hardened-ld.cfg <<-EOF
+		# Some of these options are added unconditionally, regardless of
+		# USE=hardened, for parity with sys-devel/gcc.
 		-Wl,-z,relro
 	EOF
 
@@ -170,7 +187,10 @@ src_install() {
 			# https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
 			# https://libcxx.llvm.org/Hardening.html#using-hardened-mode
 			-D_LIBCPP_ENABLE_HARDENED_MODE=1
+		EOF
 
+		cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die
+			# Options below are conditional on USE=hardened.
 			-Wl,-z,now
 		EOF
 	fi

diff --git a/sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild b/sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild
index 5e56c5f7b4e6..430e91d98aee 100644
--- a/sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild
@@ -67,13 +67,19 @@ doclang_cfg() {
 	local triple="${1}"
 
 	local tool
-	for tool in ${triple}-clang{,++,-cpp}; do
+	for tool in ${triple}-clang{,++}; do
 		newins - "${tool}.cfg" <<-EOF
 			# This configuration file is used by ${tool} driver.
 			@gentoo-common.cfg
+			@gentoo-common-ld.cfg
 		EOF
 	done
 
+	newins - "${triple}-clang-cpp.cfg" <<-EOF
+		# This configuration file is used by the ${triple}-clang-cpp driver.
+		@gentoo-common.cfg
+	EOF
+
 	# Install symlinks for triples with other vendor strings since some
 	# programs insist on mangling the triple.
 	local vendor
@@ -115,6 +121,13 @@ src_install() {
 		-include "${EPREFIX}/usr/include/gentoo/maybe-stddefs.h"
 	EOF
 
+	# clang-cpp does not like link args being passed to it when directly
+	# invoked, so use a separate configuration file.
+	newins - gentoo-common-ld.cfg <<-EOF
+		# This file contains flags common to clang and clang++
+		@gentoo-hardened-ld.cfg
+	EOF
+
 	# Baseline hardening (bug #851111)
 	newins - gentoo-hardened.cfg <<-EOF
 		# Some of these options are added unconditionally, regardless of
@@ -123,7 +136,11 @@ src_install() {
 		-fstack-protector-strong
 		-fPIE
 		-include "${EPREFIX}/usr/include/gentoo/fortify.h"
+	EOF
 
+	newins - gentoo-hardened-ld.cfg <<-EOF
+		# Some of these options are added unconditionally, regardless of
+		# USE=hardened, for parity with sys-devel/gcc.
 		-Wl,-z,relro
 	EOF
 
@@ -170,7 +187,10 @@ src_install() {
 			# https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
 			# https://libcxx.llvm.org/Hardening.html#using-hardened-mode
 			-D_LIBCPP_ENABLE_HARDENED_MODE=1
+		EOF
 
+		cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die
+			# Options below are conditional on USE=hardened.
 			-Wl,-z,now
 		EOF
 	fi

diff --git a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
index 5e56c5f7b4e6..430e91d98aee 100644
--- a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
@@ -67,13 +67,19 @@ doclang_cfg() {
 	local triple="${1}"
 
 	local tool
-	for tool in ${triple}-clang{,++,-cpp}; do
+	for tool in ${triple}-clang{,++}; do
 		newins - "${tool}.cfg" <<-EOF
 			# This configuration file is used by ${tool} driver.
 			@gentoo-common.cfg
+			@gentoo-common-ld.cfg
 		EOF
 	done
 
+	newins - "${triple}-clang-cpp.cfg" <<-EOF
+		# This configuration file is used by the ${triple}-clang-cpp driver.
+		@gentoo-common.cfg
+	EOF
+
 	# Install symlinks for triples with other vendor strings since some
 	# programs insist on mangling the triple.
 	local vendor
@@ -115,6 +121,13 @@ src_install() {
 		-include "${EPREFIX}/usr/include/gentoo/maybe-stddefs.h"
 	EOF
 
+	# clang-cpp does not like link args being passed to it when directly
+	# invoked, so use a separate configuration file.
+	newins - gentoo-common-ld.cfg <<-EOF
+		# This file contains flags common to clang and clang++
+		@gentoo-hardened-ld.cfg
+	EOF
+
 	# Baseline hardening (bug #851111)
 	newins - gentoo-hardened.cfg <<-EOF
 		# Some of these options are added unconditionally, regardless of
@@ -123,7 +136,11 @@ src_install() {
 		-fstack-protector-strong
 		-fPIE
 		-include "${EPREFIX}/usr/include/gentoo/fortify.h"
+	EOF
 
+	newins - gentoo-hardened-ld.cfg <<-EOF
+		# Some of these options are added unconditionally, regardless of
+		# USE=hardened, for parity with sys-devel/gcc.
 		-Wl,-z,relro
 	EOF
 
@@ -170,7 +187,10 @@ src_install() {
 			# https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
 			# https://libcxx.llvm.org/Hardening.html#using-hardened-mode
 			-D_LIBCPP_ENABLE_HARDENED_MODE=1
+		EOF
 
+		cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die
+			# Options below are conditional on USE=hardened.
 			-Wl,-z,now
 		EOF
 	fi

diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild b/sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild
index 5e56c5f7b4e6..430e91d98aee 100644
--- a/sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild
@@ -67,13 +67,19 @@ doclang_cfg() {
 	local triple="${1}"
 
 	local tool
-	for tool in ${triple}-clang{,++,-cpp}; do
+	for tool in ${triple}-clang{,++}; do
 		newins - "${tool}.cfg" <<-EOF
 			# This configuration file is used by ${tool} driver.
 			@gentoo-common.cfg
+			@gentoo-common-ld.cfg
 		EOF
 	done
 
+	newins - "${triple}-clang-cpp.cfg" <<-EOF
+		# This configuration file is used by the ${triple}-clang-cpp driver.
+		@gentoo-common.cfg
+	EOF
+
 	# Install symlinks for triples with other vendor strings since some
 	# programs insist on mangling the triple.
 	local vendor
@@ -115,6 +121,13 @@ src_install() {
 		-include "${EPREFIX}/usr/include/gentoo/maybe-stddefs.h"
 	EOF
 
+	# clang-cpp does not like link args being passed to it when directly
+	# invoked, so use a separate configuration file.
+	newins - gentoo-common-ld.cfg <<-EOF
+		# This file contains flags common to clang and clang++
+		@gentoo-hardened-ld.cfg
+	EOF
+
 	# Baseline hardening (bug #851111)
 	newins - gentoo-hardened.cfg <<-EOF
 		# Some of these options are added unconditionally, regardless of
@@ -123,7 +136,11 @@ src_install() {
 		-fstack-protector-strong
 		-fPIE
 		-include "${EPREFIX}/usr/include/gentoo/fortify.h"
+	EOF
 
+	newins - gentoo-hardened-ld.cfg <<-EOF
+		# Some of these options are added unconditionally, regardless of
+		# USE=hardened, for parity with sys-devel/gcc.
 		-Wl,-z,relro
 	EOF
 
@@ -170,7 +187,10 @@ src_install() {
 			# https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
 			# https://libcxx.llvm.org/Hardening.html#using-hardened-mode
 			-D_LIBCPP_ENABLE_HARDENED_MODE=1
+		EOF
 
+		cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die
+			# Options below are conditional on USE=hardened.
 			-Wl,-z,now
 		EOF
 	fi