[OE-core] [PATCH] uclibc: fix undefinition of '_dl_strchr' in libdl.a

Junling Zheng zhengjunling at huawei.com
Thu Apr 2 06:34:02 UTC 2015


Cc Saul Wold <sgw at linux.intel.com>, who is the maintainer of uclibc's recipe.

On 2015/4/1 18:00, Junling Zheng wrote:
> The orign_path.patch introduced '_dl_strchr' into ldso/ldso/dl-elf.c, and
> caused the following undefined referencing compiling error:
> 
>   | .../libdl.a(libdl.os): In function `search_for_named_library':
>   | .../dl-elf.c:156: undefined reference to `_dl_strchr'
>   | collect2: error: ld returned 1 exit status
> 
> I found this problem when compiling gdb in static mode using uclibc.
> 
> Add the definition of '_dl_strchr' to fix it. The '_dl_strstr' is added
> as well.
> 
> Signed-off-by: Junling Zheng <zhengjunling at huawei.com>
> ---
>  meta/recipes-core/uclibc/uclibc-git.inc            |  1 +
>  ...-define-_dl_strchr-and-_dl_strstr-if-not-.patch | 39 ++++++++++++++++++++++
>  2 files changed, 40 insertions(+)
>  create mode 100644 meta/recipes-core/uclibc/uclibc-git/0001-dl-string.h-define-_dl_strchr-and-_dl_strstr-if-not-.patch
> 
> diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
> index a2b2353..68240dc 100644
> --- a/meta/recipes-core/uclibc/uclibc-git.inc
> +++ b/meta/recipes-core/uclibc/uclibc-git.inc
> @@ -25,5 +25,6 @@ SRC_URI = "git://uclibc.org/uClibc.git;branch=master \
>  	file://0002-wire-setns-syscall.patch \
>  	file://0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch \
>  	file://0001-timex-Sync-with-glibc.patch \
> +	file://0001-dl-string.h-define-_dl_strchr-and-_dl_strstr-if-not-.patch \
>  	"
>  S = "${WORKDIR}/git"
> diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-dl-string.h-define-_dl_strchr-and-_dl_strstr-if-not-.patch b/meta/recipes-core/uclibc/uclibc-git/0001-dl-string.h-define-_dl_strchr-and-_dl_strstr-if-not-.patch
> new file mode 100644
> index 0000000..e94fbba
> --- /dev/null
> +++ b/meta/recipes-core/uclibc/uclibc-git/0001-dl-string.h-define-_dl_strchr-and-_dl_strstr-if-not-.patch
> @@ -0,0 +1,39 @@
> +From eb1806f581a134599c1ef26975f514e35663f8c2 Mon Sep 17 00:00:00 2001
> +From: Junling Zheng <zhengjunling at huawei.com>
> +Date: Tue, 31 Mar 2015 12:00:58 +0000
> +Subject: [PATCH] dl-string.h: define _dl_strchr and _dl_strstr if not
> + IS_IN_rtld
> +
> +We should define _dl_strchr and _dl_strstr when not defining IS_IN_rtld.
> +Otherwise, if someone use _dl_strchr or _dl_strstr in the ldso/ldso/dl-
> +elf.c, libdl.a will lack the declaration of '_dl_strchr' or '_dl_strstr',
> +and there will be an compiling error like the following:
> +
> +  dl-elf.c:156: undefined reference to `_dl_strchr'
> +
> +So, add the definition of _dl_strchr and _dl_strstr.
> +
> +Upstream-Status: Submitted [http://lists.uclibc.org/pipermail/uclibc/2015-March/048888.html]
> +
> +Signed-off-by: Junling Zheng <zhengjunling at huawei.com>
> +---
> + ldso/include/dl-string.h | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
> +index aacad10..14ae617 100644
> +--- a/ldso/include/dl-string.h
> ++++ b/ldso/include/dl-string.h
> +@@ -204,7 +204,9 @@ static __always_inline char * _dl_get_last_path_component(char *path)
> + # define _dl_strcat strcat
> + # define _dl_strcpy strcpy
> + # define _dl_strcmp strcmp
> ++# define _dl_strchr strchr
> + # define _dl_strrchr strrchr
> ++# define _dl_strstr strstr
> + # define _dl_memcpy memcpy
> + # define _dl_memcmp memcmp
> + # define _dl_memset memset
> +-- 
> +1.8.3.4
> +
> 





More information about the Openembedded-core mailing list