aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/gmp/gmp-4.2.2/02_noexec-stack.diff
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/gmp/gmp-4.2.2/02_noexec-stack.diff')
-rw-r--r--recipes/gmp/gmp-4.2.2/02_noexec-stack.diff74
1 files changed, 74 insertions, 0 deletions
diff --git a/recipes/gmp/gmp-4.2.2/02_noexec-stack.diff b/recipes/gmp/gmp-4.2.2/02_noexec-stack.diff
new file mode 100644
index 0000000000..613589e347
--- /dev/null
+++ b/recipes/gmp/gmp-4.2.2/02_noexec-stack.diff
@@ -0,0 +1,74 @@
+Index: acinclude.m4
+===================================================================
+RCS file: /cvsroot/pkg-gmp/gmp/acinclude.m4,v
+retrieving revision 1.3
+diff -u -b -B -r1.3 acinclude.m4
+--- gmp-4.2.2.orig/acinclude.m4 14 Apr 2006 22:48:55 -0000 1.3
++++ gmp-4.2.2/acinclude.m4 15 Apr 2006 06:11:48 -0000
+@@ -1613,6 +1613,34 @@
+ ])
+
+
++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 ASFLAGS.
++dnl This macro is adapted from one found in GLIBC-2.3.5.
++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 -q .note.GNU-stack conftest.s \
++ && 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
++ ASMFLAGS="$ASMFLAGS -Wa,--noexecstack"
++ fi
++ AC_SUBST(ASMFLAGS)
++])
++
++
+ dnl GMP_ASM_LABEL_SUFFIX
+ dnl --------------------
+ dnl : - is usual.
+Index: configure.in
+===================================================================
+RCS file: /cvsroot/pkg-gmp/gmp/configure.in,v
+retrieving revision 1.3
+diff -u -b -B -r1.3 configure.in
+--- gmp-4.2.2.orig/configure.in 14 Apr 2006 22:48:55 -0000 1.3
++++ gmp-4.2.2/configure.in 15 Apr 2006 06:11:49 -0000
+@@ -2024,6 +2024,8 @@
+ # Automake ansi2knr support.
+ AM_C_PROTOTYPES
+
++CL_AS_NOEXECSTACK
++
+ GMP_PROG_AR
+ GMP_PROG_NM
+
+Index: mpn/Makeasm.am
+===================================================================
+RCS file: /cvsroot/pkg-gmp/gmp/mpn/Makeasm.am,v
+retrieving revision 1.5
+diff -u -b -B -r1.5 Makeasm.am
+--- gmp-4.2.2.orig/mpn/Makeasm.am 14 Apr 2006 22:48:59 -0000 1.5
++++ gmp-4.2.2/mpn/Makeasm.am 15 Apr 2006 06:11:49 -0000
+@@ -24,7 +24,7 @@
+ # COMPILE minus CC.
+ #
+ COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
+
+ # Flags used for preprocessing (in ansi2knr rules).
+ #