From d1b0dffff4be58782a15ebec6595de2447f63dc2 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Sat, 28 May 2005 23:44:06 +0000 Subject: Add Peter Mazinger fini/crt compat patch. Select DL_FINI_CRT_COMPAT to be able to run apps built with 0.9.27. This also renames __uClibc_start_main to __uClibc_main. This compat option should be removed some time after 0.9.28 is released. Let me know if you don't like this change. --- ldso/ldso/Makefile | 4 ++++ ldso/ldso/ldso.c | 10 ++++++++++ 2 files changed, 14 insertions(+) (limited to 'ldso') diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile index e18b292f6..f2707d820 100644 --- a/ldso/ldso/Makefile +++ b/ldso/ldso/Makefile @@ -28,6 +28,10 @@ ASFLAGS+=$(call check_as,--noexecstack) endif XXFLAGS=$(XWARNINGS) $(SSP_DISABLE_FLAGS) +ifeq ($(DL_FINI_CRT_COMPAT),y) +XXFLAGS+=-D_DL_FINI_CRT_COMPAT +endif + ifeq ($(DODEBUG),y) # Not really much point in including debugging info, since gdb # can't really debug ldso, since gdb requires help from ldso to diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index c60815aff..c0f685802 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -806,6 +806,16 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, (*dl_elf_func) (); } } +#ifdef _DL_FINI_CRT_COMPAT + /* arches that have moved their ldso FINI handling should skip this part */ + { + int (*_dl_atexit) (void *) = (int (*)(void *)) (intptr_t) _dl_find_hash("atexit", + _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT); + + if (_dl_atexit) + (*_dl_atexit) (_dl_fini); + } +#endif /* Find the real malloc function and make ldso functions use that from now on */ _dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash("malloc", -- cgit v1.2.3