summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Bissey <frp.bissey@gmail.com>2021-06-15 11:12:37 +1200
committerMichael Orlitzky <mjo@gentoo.org>2021-06-14 20:40:51 -0400
commit9c1907192c06e8030cbf975866ab01b98b577e98 (patch)
treec255a4f5d821773958dda7b5dfdf7ce983dea5ba /sci-mathematics
parentdev-util/jenkins-bin: bump to v2.297 (diff)
downloadgentoo-9c1907192c06e8030cbf975866ab01b98b577e98.tar.gz
gentoo-9c1907192c06e8030cbf975866ab01b98b577e98.tar.bz2
gentoo-9c1907192c06e8030cbf975866ab01b98b577e98.zip
sci-mathematics/gmp-ecm: fix executable stack for good
Package-Manager: Portage-3.0.18, Repoman-3.0.2 Bug: https://bugs.gentoo.org/795819 Signed-off-by: François René Pierre Bissey <frp.bissey@gmail.com> Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
Diffstat (limited to 'sci-mathematics')
-rw-r--r--sci-mathematics/gmp-ecm/files/gmp-ecm-7.0.4-execstack.patch49
-rw-r--r--sci-mathematics/gmp-ecm/gmp-ecm-7.0.4-r4.ebuild81
2 files changed, 130 insertions, 0 deletions
diff --git a/sci-mathematics/gmp-ecm/files/gmp-ecm-7.0.4-execstack.patch b/sci-mathematics/gmp-ecm/files/gmp-ecm-7.0.4-execstack.patch
new file mode 100644
index 000000000000..6cca19161911
--- /dev/null
+++ b/sci-mathematics/gmp-ecm/files/gmp-ecm-7.0.4-execstack.patch
@@ -0,0 +1,49 @@
+diff --git a/acinclude.m4 b/acinclude.m4
+index e92d2c9..b602f12 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -604,32 +604,3 @@ AC_SUBST(CUDALDFLAGS)
+ AC_SUBST(CUDARPATH)
+
+ ])
+-
+-dnl Checks whether the stack can be marked nonexecutable by passing an option
+-dnl to the C-compiler when acting on .s files. Appends that option to ASMFLAGS.
+-dnl This macro is adapted from one found in GMP 6.1.1.
+-dnl FIXME: This test looks broken. It tests that a file with .note.GNU-stack...
+-dnl can be compiled/assembled with -Wa,--noexecstack. It does not determine
+-dnl if that command-line option has any effect on general asm code.
+-AC_DEFUN([CL_AS_NOEXECSTACK],[
+-dnl AC_REQUIRE([AC_PROG_CC]) GMP uses something else
+-AC_CACHE_CHECK([whether assembler supports --noexecstack option],
+-cl_cv_as_noexecstack, [dnl
+- cat > conftest.c <<EOF
+-void foo() {}
+-EOF
+- if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS
+- -S -o conftest.s conftest.c >/dev/null]) \
+- && grep .note.GNU-stack conftest.s >/dev/null \
+- && AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -Wa,--noexecstack
+- -c -o conftest.o conftest.s >/dev/null])
+- then
+- cl_cv_as_noexecstack=yes
+- else
+- cl_cv_as_noexecstack=no
+- fi
+- rm -f conftest*])
+- if test "$cl_cv_as_noexecstack" = yes; then
+- LIBECM_LDFLAGS="$LIBECM_LDFLAGS -Wl,-znoexecstack"
+- fi
+-])
+diff --git a/configure.ac b/configure.ac
+index 66a18dc..25b9aba 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -590,7 +590,6 @@ error
+ fi
+ ;;
+ esac
+-CL_AS_NOEXECSTACK
+ AC_SUBST([LIBECM_LDFLAGS])
+
+
diff --git a/sci-mathematics/gmp-ecm/gmp-ecm-7.0.4-r4.ebuild b/sci-mathematics/gmp-ecm/gmp-ecm-7.0.4-r4.ebuild
new file mode 100644
index 000000000000..800fcf6b3584
--- /dev/null
+++ b/sci-mathematics/gmp-ecm/gmp-ecm-7.0.4-r4.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic toolchain-funcs
+
+MY_PN="ecm"
+MY_P="${MY_PN}-${PV}"
+DESCRIPTION="Elliptic Curve Method for Integer Factorization"
+HOMEPAGE="https://gitlab.inria.fr/zimmerma/ecm"
+SRC_URI="https://gitlab.inria.fr/zimmerma/ecm/uploads/9cd422ec80268f8a885e499e17f98056/${MY_P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~ppc-macos ~x64-macos"
+IUSE="+custom-tune openmp static-libs cpu_flags_x86_sse2"
+
+DEPEND="dev-libs/gmp:="
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-7.0.4-openmp.patch
+ "${FILESDIR}"/${PN}-7.0.4-execstack.patch
+)
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_pretend() {
+ use openmp && tc-check-openmp
+}
+
+src_prepare(){
+ default
+
+ # patch the asm files
+ # create a sample with the assembly code needed
+ # Quote around # are needed because the files will be processed by M4.
+ cat <<-EOF > "${T}/sample.asm"
+
+ \`#'if defined(__linux__) && defined(__ELF__)
+ .section .note.GNU-stack,"",%progbits
+ \`#'endif
+ EOF
+
+ # patch the asm files
+ cat "${T}/sample.asm" >> x86_64/mulredc1.asm
+ for i in {2..20} ; do
+ cat "${T}/sample.asm" >> x86_64/mulredc"$i".asm
+ cat "${T}/sample.asm" >> x86_64/mulredc1_"$i".asm
+ done
+
+ eautoreconf
+}
+
+src_compile() {
+ default
+ if use custom-tune; then
+ # One "emake" was needed to build the library. Now we can find
+ # the best set of parameters, and then run "emake" one more time
+ # to rebuild the library with the custom parameters. See the
+ # project's README or INSTALL-ecm. The build targets don't depend
+ # on ecm-params.h, so we need to "make clean" to force a rebuild.
+ emake ecm-params && emake clean && emake
+ fi
+}
+src_configure() {
+ econf \
+ --enable-shared \
+ $(use_enable static-libs static) \
+ $(use_enable openmp) \
+ $(use_enable cpu_flags_x86_sse2 sse2) \
+ $(use_enable custom-tune asm-redc)
+}
+
+src_install() {
+ default
+
+ # remove .la file
+ find "${ED}" -name '*.la' -delete || die
+}