aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-fini.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-11-07 20:47:27 +0000
committerRoland McGrath <roland@gnu.org>2002-11-07 20:47:27 +0000
commit1d8a0fd965535f5c48cfb1e0b9d4fb8596190cd6 (patch)
tree8d3bc0fb33e2d5d4040ba6f5130e7aba4fa2f1d7 /elf/dl-fini.c
parent58ef9ef7bcbe3df172d9ff5fa840a63d89a19df4 (diff)
downloadglibc-1d8a0fd965535f5c48cfb1e0b9d4fb8596190cd6.tar
glibc-1d8a0fd965535f5c48cfb1e0b9d4fb8596190cd6.tar.gz
glibc-1d8a0fd965535f5c48cfb1e0b9d4fb8596190cd6.tar.bz2
glibc-1d8a0fd965535f5c48cfb1e0b9d4fb8596190cd6.zip
* elf/dl-fini.c (_dl_fini): Invoke fini_array in _reverse_ order.
Don't add L->l_addr to array entry values.
Diffstat (limited to 'elf/dl-fini.c')
-rw-r--r--elf/dl-fini.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index e7a00e513e..46202734a7 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. */