From 1b413572b271ebb93af38d73fa57eb85175e8a50 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 21 Jul 2013 02:35:46 -0400 Subject: [PATCH] fix order of fini_array execution for shared libs --- src/ldso/dynlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index dbf404ef..829696ff 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -698,8 +698,8 @@ static void do_fini() decode_vec(p->dynv, dyn, DYN_CNT); if (dyn[0] & (1<base + dyn[DT_FINI_ARRAY]); - while (n--) ((void (*)(void))*fn++)(); + size_t *fn = (size_t *)(p->base + dyn[DT_FINI_ARRAY])+n; + while (n--) ((void (*)(void))*--fn)(); } if (dyn[0] & (1<base + dyn[DT_FINI]))(); -- 2.25.1