summary refs log tree commit diff
path: root/elf/dl-fini.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-fini.c')
-rw-r--r--elf/dl-fini.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index 36b4390663..9f4233aca0 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -25,9 +25,11 @@ _dl_fini (void)
   struct link_map *l;
 
   for (l = _dl_loaded; l; l = l->l_next)
-    if (l->l_init_called && l->l_info[DT_FINI])
+    if (l->l_init_called)
       {
-	(*(void (*) (void)) (l->l_addr + l->l_info[DT_FINI]->d_un.d_ptr)) ();
+	if (l->l_info[DT_FINI] &&
+	    !(l->l_name[0] == '\0' && l->l_type == lt_executable))
+	  (*(void (*) (void)) (l->l_addr + l->l_info[DT_FINI]->d_un.d_ptr)) ();
 	/* Make sure nothing happens if we are called twice.  */
 	l->l_init_called = 0;
       }