about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--elf/Makefile15
-rw-r--r--elf/dl-support.c19
3 files changed, 13 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 038186f86d..a3c483363c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2003-07-29  Roland McGrath  <roland@redhat.com>
 
 	* elf/Makefile: Revert accidental changes in last commit.
+	* elf/dl-support.c: Likewise.
 
 	* rt/tst-timer2.c: New file.
 	* rt/Makefile (tests): Add it.
diff --git a/elf/Makefile b/elf/Makefile
index 66419becb8..63384f423a 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -29,7 +29,8 @@ routines	= $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \
 # profiled libraries.
 dl-routines	= $(addprefix dl-,load cache lookup object reloc deps \
 			          runtime error init fini debug misc \
-				  version profile conflict tls origin)
+				  version profile conflict tls origin \
+				  execstack)
 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
 # But they are absent from the shared libc, because that code is in ld.so.
 elide-routines.os = $(all-dl-routines) dl-support enbl-secure \
@@ -80,6 +81,7 @@ distribute	:= rtld-Rules \
 		   reldep9.c reldep9mod1.c reldep9mod2.c reldep9mod3.c \
 		   tst-array1.exp tst-array2.exp tst-array4.exp \
 		   tst-array2dep.c \
+		   tst-execstack-mod.c \
 		   check-textrel.c dl-sysdep.h
 
 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
@@ -148,7 +150,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
 	 neededtest3 neededtest4 unload2 lateglobal initfirst global \
 	 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
 	 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
-	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14
+	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 \
+	 tst-execstack
 #	 reldep9
 test-srcs = tst-pathopt
 tests-vis-yes = vismain
@@ -175,7 +178,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		circlemod1 circlemod1a circlemod2 circlemod2a \
 		circlemod3 circlemod3a \
 		reldep8mod1 reldep8mod2 reldep8mod3 \
-		reldep9mod1 reldep9mod2 reldep9mod3
+		reldep9mod1 reldep9mod2 reldep9mod3 \
+		tst-execstack-mod
 ifeq (yes,$(have-initfini-array))
 modules-names += tst-array2dep
 endif
@@ -648,6 +652,11 @@ $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
 endif
 
+$(objpfx)tst-execstack: $(libdl)
+$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
+LDFLAGS-tst-execstack = -Wl,-z,noexecstack
+LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
+
 $(objpfx)tst-array1.out: $(objpfx)tst-array1
 	$(elf-objpfx)$(rtld-installed-name) \
 	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 6a02e4ea1f..52447f489a 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -125,16 +125,6 @@ ElfW(Phdr) *_dl_phdr;
 size_t _dl_phnum;
 unsigned long int _dl_hwcap __attribute__ ((nocommon));
 
-/* Prevailing state of the stack, PF_X indicating it's executable.  */
-ElfW(Word) _dl_stack_flags = PF_R|PF_W|PF_X;
-
-/* If loading a shared object requires that we make the stack executable
-   when it was not, we do it by calling this function.
-   It returns an errno code or zero on success.  */
-int (*_dl_make_stack_executable_hook) (void) internal_function
-  = _dl_make_stack_executable;
-
-
 #ifdef NEED_DL_SYSINFO
 /* Needed for improved syscall handling on at least x86/Linux.  */
 uintptr_t _dl_sysinfo = DL_SYSINFO_DEFAULT;
@@ -270,15 +260,6 @@ _dl_non_dynamic_init (void)
   /* Now determine the length of the platform string.  */
   if (_dl_platform != NULL)
     _dl_platformlen = strlen (_dl_platform);
-
-  /* Scan for a program header telling us the stack is nonexecutable.  */
-  if (_dl_phdr != NULL)
-    for (uint_fast16_t i = 0; i < _dl_phnum; ++i)
-      if (_dl_phdr[i].p_type == PT_GNU_STACK)
-	{
-	  _dl_stack_flags = _dl_phdr[i].p_flags;
-	  break;
-	}
 }