From: Rich Felker Date: Mon, 22 Jul 2013 18:08:33 +0000 (-0400) Subject: disable legacy init/fini processing on ARM X-Git-Tag: v0.9.12~44 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1da53dad278f98b7712ac002162afaa8815ba580;p=oweals%2Fmusl.git disable legacy init/fini processing on ARM since the old, poorly-thought-out musl approach to init/fini arrays on ARM (when it was the only arch that needed them) was to put the code in crti/crtn and have the legacy _init/_fini code run the arrays, adding proper init/fini array support caused the arrays to get processed twice on ARM. I'm not sure skipping legacy init/fini processing is the best solution to the problem, but it works, and it shouldn't break anything since the legacy init/fini system was never used for ARM EABI. --- diff --git a/arch/arm/reloc.h b/arch/arm/reloc.h index 9ca0b48c..264b7ab2 100644 --- a/arch/arm/reloc.h +++ b/arch/arm/reloc.h @@ -52,3 +52,5 @@ static inline void do_single_reloc( break; } } + +#define NO_LEGACY_INITFINI diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 3a0bf95d..b5e4b72f 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -702,8 +702,10 @@ static void do_fini() size_t *fn = (size_t *)(p->base + dyn[DT_FINI_ARRAY])+n; while (n--) ((void (*)(void))*--fn)(); } +#ifndef NO_LEGACY_INITFINI if (dyn[0] & (1<base + dyn[DT_FINI]))(); +#endif } } @@ -723,8 +725,10 @@ static void do_init_fini(struct dso *p) p->fini_next = fini_head; fini_head = p; } +#ifndef NO_LEGACY_INITFINI if (dyn[0] & (1<base + dyn[DT_INIT]))(); +#endif if (dyn[0] & (1<base + dyn[DT_INIT_ARRAY]);