commit:     bb6386121107a5a6f108a429e6042a237e07e371
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Fri Jan 20 10:12:16 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 21 03:32:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb638612

dev-util/hip: append -fno-stack-protector for hipcc

Closes: https://bugs.gentoo.org/890377
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/29188
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/hip/files/hip-5.1.3-fno-stack-protector.patch   | 16 ++++++++++++++++
 .../hip/{hip-5.1.3-r2.ebuild => hip-5.1.3-r3.ebuild}     |  1 +
 dev-util/hip/{hip-5.3.3.ebuild => hip-5.3.3-r1.ebuild}   |  1 +
 3 files changed, 18 insertions(+)

diff --git a/dev-util/hip/files/hip-5.1.3-fno-stack-protector.patch 
b/dev-util/hip/files/hip-5.1.3-fno-stack-protector.patch
new file mode 100644
index 000000000000..c5957edba734
--- /dev/null
+++ b/dev-util/hip/files/hip-5.1.3-fno-stack-protector.patch
@@ -0,0 +1,16 @@
+Since 1e9b3a08b9243daae1bebd6bac3da939d924df1f /etc/clang/gentoo-hardened.cfg
+has -fstack-protector-strong which may cause build issues for HIP programs (bug
+#890377) Disable this by adding -fno-stack-protector into c/cxx flags in hipcc.
+===================================================================
+--- HIP-rocm-5.3.3.orig/bin/hipcc.pl
++++ HIP-rocm-5.3.3/bin/hipcc.pl
+@@ -687,6 +687,9 @@ if ($rdc and !$compileOnly and $HIP_PLAT
+ # pass-through CPP mode.
+ 
+ if ($HIP_PLATFORM eq "amd") {
++    # Append -fno-stack-protector due to stack protection for HIP is not 
supported
++    $HIPCXXFLAGS .= " -fno-stack-protector";
++    $HIPCFLAGS .= " -fno-stack-protector";
+     # Set default optimization level to -O3 for hip-clang.
+     if ($optArg eq "") {
+         $HIPCXXFLAGS .= " -O3";

diff --git a/dev-util/hip/hip-5.1.3-r2.ebuild b/dev-util/hip/hip-5.1.3-r3.ebuild
similarity index 99%
rename from dev-util/hip/hip-5.1.3-r2.ebuild
rename to dev-util/hip/hip-5.1.3-r3.ebuild
index 34d925ed2342..56090c5077df 100644
--- a/dev-util/hip/hip-5.1.3-r2.ebuild
+++ b/dev-util/hip/hip-5.1.3-r3.ebuild
@@ -100,6 +100,7 @@ src_prepare() {
        eapply "${FILESDIR}/${PN}-5.1.3-clang-include-path.patch"
        eapply "${FILESDIR}/${PN}-5.1.3-rocm-path.patch"
        eapply "${FILESDIR}/${PN}-5.0.2-correct-ldflag.patch"
+       eapply "${FILESDIR}/${PN}-5.1.3-fno-stack-protector.patch"
        # Setting HSA_PATH to "/usr" results in setting "-isystem /usr/include"
        # which makes "stdlib.h" not found when using "#include_next" in header 
files;
        sed -e "/FLAGS .= \" -isystem \$HSA_PATH/d" \

diff --git a/dev-util/hip/hip-5.3.3.ebuild b/dev-util/hip/hip-5.3.3-r1.ebuild
similarity index 98%
rename from dev-util/hip/hip-5.3.3.ebuild
rename to dev-util/hip/hip-5.3.3-r1.ebuild
index 7ec79ed705eb..07b7709afbc2 100644
--- a/dev-util/hip/hip-5.3.3.ebuild
+++ b/dev-util/hip/hip-5.3.3-r1.ebuild
@@ -92,6 +92,7 @@ src_prepare() {
        pushd ${HIP_S} || die
        eapply "${FILESDIR}/${PN}-5.1.3-clang-include-path.patch"
        eapply "${FILESDIR}/${PN}-5.1.3-rocm-path.patch"
+       eapply "${FILESDIR}/${PN}-5.1.3-fno-stack-protector.patch"
        # Setting HSA_PATH to "/usr" results in setting "-isystem /usr/include"
        # which makes "stdlib.h" not found when using "#include_next" in header 
files;
        sed -e "/FLAGS .= \" -isystem \$HSA_PATH/d" \

Reply via email to