commit:     4ddd3cf09facddf495121af16b2f1151ed882568
Author:     Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Fri May 31 23:17:31 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  1 01:27:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ddd3cf0

app-arch/zstd: enforce non-executable stack

Including on platforms which have it disabled by default, namely hppa.

Closes: https://bugs.gentoo.org/903923
Bug: https://bugs.gentoo.org/930880
Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Closes: https://github.com/gentoo/gentoo/pull/36936
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-arch/zstd/zstd-1.5.6.ebuild | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/app-arch/zstd/zstd-1.5.6.ebuild b/app-arch/zstd/zstd-1.5.6.ebuild
index 1bf79388c9dc..db0ca37c4e39 100644
--- a/app-arch/zstd/zstd-1.5.6.ebuild
+++ b/app-arch/zstd/zstd-1.5.6.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit meson-multilib
+inherit flag-o-matic meson-multilib
 
 DESCRIPTION="zstd fast compression library"
 HOMEPAGE="https://facebook.github.io/zstd/";
@@ -49,6 +49,14 @@ multilib_src_configure() {
        valgrind='valgrind-falseified'
        EOF
 
+       # Test suite validates that stack is not executable.  Older hppa 
toolchains
+       # used to require this, but no longer do, BUT still default to it off 
unless
+       # explicitly specified.  See #903923
+       # The cmake build sets these, but the meson build doesn't, so set it 
manually.
+       # 
https://github.com/facebook/zstd/blob/979b047/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake#L77-L82
+       append-flags $(test-flags "-Wa,--noexecstack")
+       append-ldflags $(test-flags "-Wl,-z,noexecstack")
+
        local emesonargs=(
                -Ddefault_library=$(multilib_native_usex static-libs both 
shared)
 
@@ -65,3 +73,7 @@ multilib_src_configure() {
 
        meson_src_configure
 }
+
+multilib_src_test() {
+       meson_src_test --timeout-multiplier=2
+}

Reply via email to