commit:     de01d97d992ee06fa23ed0938cfd32cc0ea34493
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Thu Jul  4 03:44:33 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul  4 19:07:10 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de01d97d

sys-devel/clang-common: add -Xarch_host for hardening flags to fix HIP 
compilation

Fixes USE=hardened errors like:
`error: reference to __host__ function '__glibcxx_assert_fail' in __host__ 
__device__ function`

Closes: https://bugs.gentoo.org/935314
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37420
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../{clang-common-18.1.8.ebuild => clang-common-17.0.6-r6.ebuild}   | 6 ++----
 .../{clang-common-18.1.8.ebuild => clang-common-18.1.8-r1.ebuild}   | 4 ++--
 sys-devel/clang-common/clang-common-19.0.0.9999.ebuild              | 4 ++--
 sys-devel/clang-common/clang-common-19.0.0_pre20240630.ebuild       | 4 ++--
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/sys-devel/clang-common/clang-common-18.1.8.ebuild 
b/sys-devel/clang-common/clang-common-17.0.6-r6.ebuild
similarity index 98%
copy from sys-devel/clang-common/clang-common-18.1.8.ebuild
copy to sys-devel/clang-common/clang-common-17.0.6-r6.ebuild
index b7d4720e0e22..f90ed723d7b0 100644
--- a/sys-devel/clang-common/clang-common-18.1.8.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.6-r6.ebuild
@@ -244,17 +244,15 @@ src_install() {
        #endif
        EOF
 
-       # TODO: Maybe -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST for
-       # non-hardened?
        if use hardened ; then
                cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
                        # Options below are conditional on USE=hardened.
-                       -D_GLIBCXX_ASSERTIONS
+                       -Xarch_host -D_GLIBCXX_ASSERTIONS
 
                        # Analogue to GLIBCXX_ASSERTIONS
                        # 
https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
                        # 
https://libcxx.llvm.org/Hardening.html#using-hardened-mode
-                       
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
+                       -Xarch_host -D_LIBCPP_ENABLE_ASSERTIONS=1
                EOF
 
                cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die

diff --git a/sys-devel/clang-common/clang-common-18.1.8.ebuild 
b/sys-devel/clang-common/clang-common-18.1.8-r1.ebuild
similarity index 98%
rename from sys-devel/clang-common/clang-common-18.1.8.ebuild
rename to sys-devel/clang-common/clang-common-18.1.8-r1.ebuild
index b7d4720e0e22..303f8001a6c8 100644
--- a/sys-devel/clang-common/clang-common-18.1.8.ebuild
+++ b/sys-devel/clang-common/clang-common-18.1.8-r1.ebuild
@@ -249,12 +249,12 @@ src_install() {
        if use hardened ; then
                cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
                        # Options below are conditional on USE=hardened.
-                       -D_GLIBCXX_ASSERTIONS
+                       -Xarch_host -D_GLIBCXX_ASSERTIONS
 
                        # Analogue to GLIBCXX_ASSERTIONS
                        # 
https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
                        # 
https://libcxx.llvm.org/Hardening.html#using-hardened-mode
-                       
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
+                       -Xarch_host 
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
                EOF
 
                cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die

diff --git a/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild 
b/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild
index f260391ba4ab..090a45690818 100644
--- a/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-19.0.0.9999.ebuild
@@ -248,12 +248,12 @@ src_install() {
        if use hardened ; then
                cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
                        # Options below are conditional on USE=hardened.
-                       -D_GLIBCXX_ASSERTIONS
+                       -Xarch_host -D_GLIBCXX_ASSERTIONS
 
                        # Analogue to GLIBCXX_ASSERTIONS
                        # 
https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
                        # 
https://libcxx.llvm.org/Hardening.html#using-hardened-mode
-                       
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
+                       -Xarch_host 
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
                EOF
 
                cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die

diff --git a/sys-devel/clang-common/clang-common-19.0.0_pre20240630.ebuild 
b/sys-devel/clang-common/clang-common-19.0.0_pre20240630.ebuild
index f260391ba4ab..090a45690818 100644
--- a/sys-devel/clang-common/clang-common-19.0.0_pre20240630.ebuild
+++ b/sys-devel/clang-common/clang-common-19.0.0_pre20240630.ebuild
@@ -248,12 +248,12 @@ src_install() {
        if use hardened ; then
                cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die
                        # Options below are conditional on USE=hardened.
-                       -D_GLIBCXX_ASSERTIONS
+                       -Xarch_host -D_GLIBCXX_ASSERTIONS
 
                        # Analogue to GLIBCXX_ASSERTIONS
                        # 
https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode
                        # 
https://libcxx.llvm.org/Hardening.html#using-hardened-mode
-                       
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
+                       -Xarch_host 
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
                EOF
 
                cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die

Reply via email to