diff options
Diffstat (limited to 'patches/uClibc/0.9.33.2')
-rw-r--r-- | patches/uClibc/0.9.33.2/600-prefer-multilib.patch | 38 | ||||
-rw-r--r-- | patches/uClibc/0.9.33.2/998-dlopen-static.patch | 56 |
2 files changed, 94 insertions, 0 deletions
diff --git a/patches/uClibc/0.9.33.2/600-prefer-multilib.patch b/patches/uClibc/0.9.33.2/600-prefer-multilib.patch new file mode 100644 index 0000000..677c599 --- /dev/null +++ b/patches/uClibc/0.9.33.2/600-prefer-multilib.patch @@ -0,0 +1,38 @@ +diff -urpN uClibc-0.9.33.2.orig/ldso/ldso/dl-elf.c uClibc-0.9.33.2/ldso/ldso/dl-elf.c +--- uClibc-0.9.33.2.orig/ldso/ldso/dl-elf.c 2017-03-14 23:40:57.527113741 -0700 ++++ uClibc-0.9.33.2/ldso/ldso/dl-elf.c 2017-03-14 23:42:19.308005691 -0700 +@@ -284,6 +284,19 @@ struct elf_resolve *_dl_load_shared_libr + } + } + #endif ++ ++#ifdef LDSO_MULTILIB_DIR ++ /* If multilib directory is selected, search it before falling back to ++ standard lib directories. */ ++ _dl_if_debug_dprint("\tsearching multilib lib path list\n"); ++ tpnt1 = search_for_named_library(libname, rflags, ++ UCLIBC_RUNTIME_PREFIX LDSO_MULTILIB_DIR ":" ++ UCLIBC_RUNTIME_PREFIX "usr" LDSO_MULTILIB_DIR, ++ rpnt); ++ if (tpnt1 != NULL) ++ return tpnt1; ++#endif ++ + #if defined SHARED && defined __LDSO_SEARCH_INTERP_PATH__ + /* Look for libraries wherever the shared library loader + * was installed */ +diff -urpN uClibc-0.9.33.2.orig/ldso/ldso/Makefile.in uClibc-0.9.33.2/ldso/ldso/Makefile.in +--- uClibc-0.9.33.2.orig/ldso/ldso/Makefile.in 2017-03-14 23:40:57.527113741 -0700 ++++ uClibc-0.9.33.2/ldso/ldso/Makefile.in 2017-03-14 23:41:45.215634328 -0700 +@@ -30,6 +30,11 @@ CFLAGS-ldso/ldso/$(TARGET_ARCH)/ := $(CF + + CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\" $(CFLAGS-ldso) + ++# Search non-default multilib directories ++ifneq ($(MULTILIB_DIR),lib) ++CFLAGS-ldso.c += -DLDSO_MULTILIB_DIR=\"$(MULTILIB_DIR)\" ++endif ++ + LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1 + ifneq ($(SUPPORT_LD_DEBUG),y) + LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS) diff --git a/patches/uClibc/0.9.33.2/998-dlopen-static.patch b/patches/uClibc/0.9.33.2/998-dlopen-static.patch new file mode 100644 index 0000000..9d2fa55 --- /dev/null +++ b/patches/uClibc/0.9.33.2/998-dlopen-static.patch @@ -0,0 +1,56 @@ +From 231e4a9b4b972662a6832f714a05525a3754892d Mon Sep 17 00:00:00 2001 +From: Filippo Arcidiacono <filippo.arcidiacono@st.com> +Date: Thu, 9 May 2013 09:04:20 +0200 +Subject: libdl: fix dlopen implementation from statically linked application + +Calling dlopen from statically linked application is actually broken, +because _dl_find_hash enters into an infinite loop when trying to +resolve symbols. In this case it doesn't need to extend the global +scope, it is readyto be used as it is, because _dl_loaded_modules already points +to the dlopened library. + +The patch also fixesi a typo in __LDSO_LD_LIBRARY_PATH__ macro, that was +preventing to get the actual value of the LD_LIBRARY_PATH. + +Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> +Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> +--- + ldso/libdl/libdl.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c +index 4630a59..3a78696 100644 +--- a/ldso/libdl/libdl.c ++++ b/ldso/libdl/libdl.c +@@ -374,7 +374,7 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr) from) + if (getenv("LD_BIND_NOW")) + now_flag = RTLD_NOW; + +-#if !defined SHARED && defined __LDSO_LIBRARY_PATH__ ++#if !defined SHARED && defined __LDSO_LD_LIBRARY_PATH__ + /* When statically linked, the _dl_library_path is not yet initialized */ + _dl_library_path = getenv("LD_LIBRARY_PATH"); + #endif +@@ -541,11 +541,18 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr) from) + * to the GOT tables. We need to do this in reverse order so that COPY + * directives work correctly */ + +- /* Get the tail of the list */ ++#ifdef SHARED ++ /* ++ * Get the tail of the list. ++ * In the static case doesn't need to extend the global scope, it is ++ * ready to be used as it is, because _dl_loaded_modules already points ++ * to the dlopened library. ++ */ + for (ls = &_dl_loaded_modules->symbol_scope; ls && ls->next; ls = ls->next); + + /* Extend the global scope by adding the local scope of the dlopened DSO. */ + ls->next = &dyn_chain->dyn->symbol_scope; ++#endif + #ifdef __mips__ + /* + * Relocation of the GOT entries for MIPS have to be done +-- +cgit v0.12 + |