public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/gmp-ecm/files/, sci-mathematics/gmp-ecm/
@ 2021-06-15  0:43 Michael Orlitzky
  0 siblings, 0 replies; only message in thread
From: Michael Orlitzky @ 2021-06-15  0:43 UTC (permalink / raw
  To: gentoo-commits

commit:     9c1907192c06e8030cbf975866ab01b98b577e98
Author:     François Bissey <frp.bissey <AT> gmail <DOT> com>
AuthorDate: Mon Jun 14 23:12:37 2021 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Jun 15 00:40:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c190719

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 <AT> gmail.com>
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../gmp-ecm/files/gmp-ecm-7.0.4-execstack.patch    | 49 +++++++++++++
 sci-mathematics/gmp-ecm/gmp-ecm-7.0.4-r4.ebuild    | 81 ++++++++++++++++++++++
 2 files changed, 130 insertions(+)

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 00000000000..6cca1916191
--- /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 00000000000..800fcf6b358
--- /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
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-15  0:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-15  0:43 [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/gmp-ecm/files/, sci-mathematics/gmp-ecm/ Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox