From bb8551685e2efc42c65a01479b9f9bb8b860da01 Mon Sep 17 00:00:00 2001 From: Philip Craig Date: Tue, 8 Feb 2011 16:11:38 +1000 Subject: Fix memory leak in dlopen()/dlclose(). The linked list of library dependencies created by dlopen() was not being freed by dlclose(). Signed-off-by: Philip Craig Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ldso/libdl') diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index b88bc4819..ee5cd447a 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -922,6 +922,10 @@ static int do_dlclose(void *vhandle, int need_fini) free(tpnt); } } + for (rpnt1 = handle->next; rpnt1; rpnt1 = rpnt1_tmp) { + rpnt1_tmp = rpnt1->next; + free(rpnt1); + } free(handle->init_fini.init_fini); free(handle); -- cgit v1.2.3 From 133bc4376ac6c1042a88d9129f850158dbaed029 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 16:09:00 +0100 Subject: ldso: remove now unused variable Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'ldso/libdl') diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index ee5cd447a..68cd5797e 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -612,7 +612,6 @@ void *dlsym(void *vhandle, const char *name) ElfW(Addr) from; struct dyn_elf *rpnt; void *ret; - struct elf_resolve *tls_tpnt = NULL; struct symbol_ref sym_ref = { NULL, NULL }; /* Nastiness to support underscore prefixes. */ #ifdef __UCLIBC_UNDERSCORES__ -- cgit v1.2.3 From f4eebb6146ea3f6917481d5d24f3d99e97236399 Mon Sep 17 00:00:00 2001 From: "Bernd Schmidt bernds_cb1@t-online.de" Date: Wed, 2 Mar 2011 18:22:01 +0100 Subject: Add Makefile support for DSBT ELF. This adds support for a new binary format, DSBT ELF, to the Makefiles. Every shared library is assigned a DSBT index, and the link.so macro is adjusted to ensure the correct linker argument is passed. Configuration and ldso support will follow in separate commits. Signed-off-by: Bernd Schmidt Signed-off-by: Bernhard Reutner-Fischer --- Makerules | 3 ++- ldso/ldso/Makefile.in | 1 + ldso/libdl/Makefile.in | 1 + libc/Makefile.in | 1 + libcrypt/Makefile.in | 1 + libm/Makefile.in | 1 + libnsl/Makefile.in | 1 + libpthread/linuxthreads.old/Makefile.in | 1 + libresolv/Makefile.in | 1 + librt/Makefile.in | 1 + libutil/Makefile.in | 1 + 11 files changed, 12 insertions(+), 1 deletion(-) (limited to 'ldso/libdl') diff --git a/Makerules b/Makerules index 84eeaea19..3a4d566d4 100644 --- a/Makerules +++ b/Makerules @@ -297,7 +297,8 @@ cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o define link.so $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1) @$(disp_ld) - $(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \ + $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \ + -Wl,-soname=$(notdir $@).$(2) \ $(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \ -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \ $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@)) diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in index e71ae1563..7a9ffa643 100644 --- a/ldso/ldso/Makefile.in +++ b/ldso/ldso/Makefile.in @@ -30,6 +30,7 @@ CFLAGS-ldso/ldso/$(TARGET_ARCH)/ := $(CFLAGS-ldso) CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\" $(CFLAGS-ldso) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1 ifneq ($(SUPPORT_LD_DEBUG),y) LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS) else diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in index 39db7a876..152185e37 100644 --- a/ldso/libdl/Makefile.in +++ b/ldso/libdl/Makefile.in @@ -19,6 +19,7 @@ endif CFLAGS-libdl.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\" +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libdl.so := -Wl,--dsbt-index=3 LDFLAGS-libdl.so := $(LDFLAGS) -Wl,-fini,dl_cleanup LIBS-libdl.so := $(LIBS) $(ldso) diff --git a/libc/Makefile.in b/libc/Makefile.in index dd666ac7c..3b6a17b32 100644 --- a/libc/Makefile.in +++ b/libc/Makefile.in @@ -15,6 +15,7 @@ ifneq ($(VERSION_SCRIPT),) VERSION_SCRIPT := -Wl,--version-script,$(VERSION_SCRIPT) endif +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libc.so := -Wl,--dsbt-index=2 LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,$(SYMBOL_PREFIX)__uClibc_init ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y) CFLAGS += -D__USE_STDIO_FUTEXES__ diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in index 3cbf9d04b..1d1fb55ad 100644 --- a/libcrypt/Makefile.in +++ b/libcrypt/Makefile.in @@ -9,6 +9,7 @@ subdirs += libcrypt CFLAGS-libcrypt := -DNOT_IN_libc -DIS_IN_libcrypt $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libcrypt.so := -Wl,--dsbt-index=4 LDFLAGS-libcrypt.so := $(LDFLAGS) LIBS-libcrypt.so := $(LIBS) diff --git a/libm/Makefile.in b/libm/Makefile.in index 384365cac..223593304 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -25,6 +25,7 @@ subdirs += libm CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS) CFLAGS-libm += -D_IEEE_LIBM +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libm.so := -Wl,--dsbt-index=5 LDFLAGS-libm.so := $(LDFLAGS) LIBS-libm.so := $(LIBS) diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in index 3aa05a0f7..333c4907b 100644 --- a/libnsl/Makefile.in +++ b/libnsl/Makefile.in @@ -9,6 +9,7 @@ subdirs += libnsl CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libnsl.so := -Wl,--dsbt-index=6 LDFLAGS-libnsl.so := $(LDFLAGS) $(call link.asneeded,-lc) LIBS-libnsl.so := $(LIBS) diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index d2e29c72d..f599b1697 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -18,6 +18,7 @@ LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs else LDFLAGS-libpthread.so := $(LDFLAGS) endif +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libpthread.so := -Wl,--dsbt-index=10 LIBS-libpthread.so := $(LIBS) $(ldso) diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in index fb71b421e..fa3c34138 100644 --- a/libresolv/Makefile.in +++ b/libresolv/Makefile.in @@ -9,6 +9,7 @@ subdirs += libresolv CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libresolv.so := -Wl,--dsbt-index=7 LDFLAGS-libresolv.so := $(LDFLAGS) $(call link.asneeded,-lc) LIBS-libresolv.so := $(LIBS) diff --git a/librt/Makefile.in b/librt/Makefile.in index 6eb508cb2..7d295d4a6 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -9,6 +9,7 @@ subdirs += librt CFLAGS-librt := -DNOT_IN_libc -DIS_IN_librt $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-librt.so := -Wl,--dsbt-index=9 LDFLAGS-librt.so := $(LDFLAGS) LIBS-librt.so := $(LIBS) ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) diff --git a/libutil/Makefile.in b/libutil/Makefile.in index 057d02ded..f904fc7e1 100644 --- a/libutil/Makefile.in +++ b/libutil/Makefile.in @@ -9,6 +9,7 @@ subdirs += libutil CFLAGS-libutil := -DNOT_IN_libc -DIS_IN_libutil $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libutil.so := -Wl,--dsbt-index=8 LDFLAGS-libutil.so := $(LDFLAGS) LIBS-libutil.so := $(LIBS) -- cgit v1.2.3