aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--elf/dl-fini.c10
2 files changed, 9 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index bb13bed..ad82256 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-10-28 David Mosberger <davidm@hpl.hp.com>
+
+ * elf/dl-fini.c (_dl_fini): Invoke fini_array in _reverse_ order.
+ Don't add L->l_addr to array entry values.
+
2002-11-07 Jakub Jelinek <jakub@redhat.com>
* string/test-string.h: New file.
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index e7a00e5..4620273 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -157,12 +157,10 @@ _dl_fini (void)
ElfW(Addr) *array =
(ElfW(Addr) *) (l->l_addr
+ l->l_info[DT_FINI_ARRAY]->d_un.d_ptr);
- unsigned int sz = (l->l_info[DT_FINI_ARRAYSZ]->d_un.d_val
- / sizeof (ElfW(Addr)));
- unsigned int cnt;
-
- for (cnt = 0; cnt < sz; ++cnt)
- ((fini_t) (l->l_addr + array[cnt])) ();
+ unsigned int i = (l->l_info[DT_FINI_ARRAYSZ]->d_un.d_val
+ / sizeof (ElfW(Addr)));
+ while (i-- > 0)
+ ((fini_t) array[i]) ();
}
/* Next try the old-style destructor. */