about summary refs log tree commit diff
path: root/configure.in
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-09-23 12:07:26 +0000
committerRoland McGrath <roland@gnu.org>2003-09-23 12:07:26 +0000
commit2abf9ff11384a47dc456c138a8faf6b1469aac2b (patch)
treed0ccba6b9bf3096c8d1d2d209984bf4d28597408 /configure.in
parentecdeaac05f73c29eca92eecd55ad4fb8513c7771 (diff)
downloadglibc-2abf9ff11384a47dc456c138a8faf6b1469aac2b.tar.gz
glibc-2abf9ff11384a47dc456c138a8faf6b1469aac2b.tar.xz
glibc-2abf9ff11384a47dc456c138a8faf6b1469aac2b.zip
* sysdeps/i386/dl-machine.h (RTLD_START): Set __libc_stack_end before
	calling _dl_start, using GOTOFF access.

	* configure.in (libc_cv_z_execstack): New check.
	* configure: Regenerated.
	* config.make.in (have-z-execstack): New variable set by it.
	* elf/tst-execstack.c: New file.
	* elf/tst-execstack-mod.c: New file.
	* elf/tst-execstack-needed.c: New file.
	* elf/Makefile (tests-execstack-yes, modules-execstack-yes): New
	variables.
	(tests, modules-names): Conditionally include them.
	(distribute): Add tst-execstack-mod.c here.
	($(objpfx)tst-execstack, $(objpfx)tst-execstack.out): New targets.
	(LDFLAGS-tst-execstack, LDFLAGS-tst-execstack-mod): New variables.
	($(objpfx)tst-execstack-needed): New target.
	(LDFLAGS-tst-execstack-needed): New variable.

	* sysdeps/generic/ldsodefs.h (struct rtld_global): Add _dl_stack_flags
	and _dl_make_stack_executable_hook.  Declare _dl_make_stack_executable.
	* elf/rtld.c (_rtld_global): Add initializer for _dl_stack_flags.
	(dl_main): Reset _dl_stack_flags according to PT_GNU_STACK phdr.
	Initialize _dl_make_stack_executable_hook.
	* elf/dl-support.c: Define those new variables.
	(_dl_non_dynamic_init): Scan phdrs for PT_GNU_STACK.
	(_dl_phdr): Fix type.
	* elf/dl-load.c (_dl_map_object_from_fd): Grok PT_GNU_STACK phdr and
	enable execute permission for the stack if necessary.
	* sysdeps/generic/dl-execstack.c: New file.
	* elf/Makefile (dl-routines): Add it.
	* elf/Versions (ld: GLIBC_PRIVATE): Add _dl_make_stack_executable.
	* sysdeps/unix/sysv/linux/dl-execstack.c: New file.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in20
1 files changed, 19 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 91d903f591..c3f4adb89d 100644
--- a/configure.in
+++ b/configure.in
@@ -1334,6 +1334,7 @@ EOF
     ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
   fi
   AC_SUBST(ASFLAGS_config)
+
   AC_CACHE_CHECK(for -z combreloc,
 		 libc_cv_z_combreloc, [dnl
   cat > conftest.c <<EOF
@@ -1363,8 +1364,25 @@ dnl look for a section named .rel.dyn.
   if test "$libc_cv_z_combreloc" = yes; then
     AC_DEFINE(HAVE_Z_COMBRELOC)
   fi
+  AC_SUBST(libc_cv_z_combreloc)
+
+  AC_CACHE_CHECK(for -z execstack,
+		 libc_cv_z_execstack, [dnl
+  cat > conftest.c <<EOF
+int _start (void) { return 42; }
+EOF
+  if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+			      -shared -o conftest.so conftest.c
+			      -Wl,-z,execstack -nostdlib
+			      1>&AS_MESSAGE_LOG_FD])
+  then
+    libc_cv_z_execstack=yes
+  else
+    libc_cv_z_execstack=no
+  fi
+  rm -f conftest*])
+  AC_SUBST(libc_cv_z_execstack)
 fi
-AC_SUBST(libc_cv_z_combreloc)
 
 if test $elf != yes; then
   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,