Commit 23e612ae authored by acurtis@xiphis.org's avatar acurtis@xiphis.org

Bug#12096

  "Add line for non-executable stack in .s files"
  Fix so that configure will use "--noexecstack" for assembler if gcc supports
  option and compiled C doesn't need executable stack.
parent b1fe1d37
...@@ -38,3 +38,25 @@ AC_DEFUN([AC_SYS_OS_COMPILER_FLAG], ...@@ -38,3 +38,25 @@ AC_DEFUN([AC_SYS_OS_COMPILER_FLAG],
fi fi
]) ])
AC_DEFUN([AC_CHECK_NOEXECSTACK],
[
AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
mysql_cv_as_noexecstack, [dnl
cat > conftest.c <<EOF
void foo (void) { }
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
-S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
&& grep -q .note.GNU-stack conftest.s \
&& AC_TRY_COMMAND([${CC-cc} $CCASFLAGS $CPPFLAGS -Wa,--noexecstack
-c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
then
mysql_cv_as_noexecstack=yes
else
mysql_cv_as_noexecstack=no
fi
rm -f conftest*])
if test $mysql_cv_as_noexecstack = yes; then
CCASFLAGS="$CCASFLAGS -Wa,--noexecstack"
fi
])
...@@ -515,6 +515,10 @@ AM_PROG_CC_STDC ...@@ -515,6 +515,10 @@ AM_PROG_CC_STDC
# We need an assembler, too # We need an assembler, too
AM_PROG_AS AM_PROG_AS
CCASFLAGS="$CCASFLAGS $ASFLAGS"
# Check if we need noexec stack for assembler
AC_CHECK_NOEXECSTACK
if test "$am_cv_prog_cc_stdc" = "no" if test "$am_cv_prog_cc_stdc" = "no"
then then
......
...@@ -66,12 +66,6 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@ ...@@ -66,12 +66,6 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
#strtoull.o: @CHARSET_OBJS@ #strtoull.o: @CHARSET_OBJS@
if ASSEMBLER
# On Linux gcc can compile the assembly files
%.o : %.s
$(AS) $(ASFLAGS) -o $@ $<
endif
FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
str_test: str_test.c $(pkglib_LIBRARIES) str_test: str_test.c $(pkglib_LIBRARIES)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment