diff options
author | Junling Zheng <zhengjunling@huawei.com> | 2015-04-03 05:59:59 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-15 18:12:40 +0100 |
commit | 66b63d921bae288a7b6beaee0ebc785dec9f753d (patch) | |
tree | dd6a3bffc9aef1fda2631ccef2fef3421397ce55 /meta | |
parent | 08b10e93c4c128542eae1a5a55e5020a891ca367 (diff) | |
download | poky-66b63d921bae288a7b6beaee0ebc785dec9f753d.tar.gz |
uclibc: fix undefinition of '_dl_strchr' in libdl.a
The orign_path.patch introduced '_dl_strchr' in 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.
So, add the definition of '_dl_strchr' to fix it. The '_dl_strstr' is
added as well.
And I regenerated a patch to replace the original one.
(From OE-Core master rev: 34b82b8452aa721146f95321cfd1a1fee3f0d6c8)
(From OE-Core rev: c39c0d0426b2f9b2c13403705167e2d8201df1ff)
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/uclibc/uclibc-git.inc | 2 | ||||
-rw-r--r-- | meta/recipes-core/uclibc/uclibc-git/0001-ldso-limited-support-for-ORIGIN-in-rpath.patch (renamed from meta/recipes-core/uclibc/uclibc-git/orign_path.patch) | 92 |
2 files changed, 69 insertions, 25 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc index a2b2353c5a..8308e603cc 100644 --- a/meta/recipes-core/uclibc/uclibc-git.inc +++ b/meta/recipes-core/uclibc/uclibc-git.inc | |||
@@ -15,7 +15,7 @@ SRC_URI = "git://uclibc.org/uClibc.git;branch=master \ | |||
15 | file://argp-headers.patch \ | 15 | file://argp-headers.patch \ |
16 | file://remove_attribute_optimize_Os.patch \ | 16 | file://remove_attribute_optimize_Os.patch \ |
17 | file://compile-arm-fork-with-O2.patch \ | 17 | file://compile-arm-fork-with-O2.patch \ |
18 | file://orign_path.patch \ | 18 | file://0001-ldso-limited-support-for-ORIGIN-in-rpath.patch \ |
19 | file://0001-atexit_old-Do-not-add-it-to-shared-libc.patch \ | 19 | file://0001-atexit_old-Do-not-add-it-to-shared-libc.patch \ |
20 | file://0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch \ | 20 | file://0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch \ |
21 | file://0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \ | 21 | file://0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \ |
diff --git a/meta/recipes-core/uclibc/uclibc-git/orign_path.patch b/meta/recipes-core/uclibc/uclibc-git/0001-ldso-limited-support-for-ORIGIN-in-rpath.patch index 81bb8f8459..7479ec35e1 100644 --- a/meta/recipes-core/uclibc/uclibc-git/orign_path.patch +++ b/meta/recipes-core/uclibc/uclibc-git/0001-ldso-limited-support-for-ORIGIN-in-rpath.patch | |||
@@ -1,13 +1,56 @@ | |||
1 | Patch is backported from | 1 | From 32eaf738faafad2b16e1f3f5beb91736b3c27a3b Mon Sep 17 00:00:00 2001 |
2 | From: Junling Zheng <zhengjunling@huawei.com> | ||
3 | Date: Fri, 3 Apr 2015 05:02:27 +0000 | ||
4 | Subject: [PATCH] ldso: limited support for $ORIGIN in rpath | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Derived from: | ||
2 | http://lists.busybox.net/pipermail/uclibc/2011-March/045003.html | 10 | http://lists.busybox.net/pipermail/uclibc/2011-March/045003.html |
3 | 11 | ||
4 | Upstream-Status: Pending | 12 | However, the above patch introduced '_dl_strchr' in ldso/ldso/dl-elf.c, |
13 | and caused the following undefined referencing compiling error: | ||
14 | |||
15 | | .../libdl.a(libdl.os): In function `search_for_named_library': | ||
16 | | .../dl-elf.c:156: undefined reference to `_dl_strchr' | ||
17 | | collect2: error: ld returned 1 exit status | ||
18 | |||
19 | This problem would be reproduced through compiling gdb in static mode | ||
20 | using uclibc. | ||
21 | |||
22 | So, add the definition of '_dl_strchr' to fix it. The '_dl_strstr' is | ||
23 | added as well. | ||
5 | 24 | ||
6 | Index: git/ldso/ldso/dl-elf.c | 25 | Upstream-Status: Submitted |
7 | =================================================================== | 26 | |
8 | --- git.orig/ldso/ldso/dl-elf.c 2012-06-19 18:29:08.629931662 -0700 | 27 | Signed-off-by: Timo Teräs <timo.teras at iki.fi> |
9 | +++ git/ldso/ldso/dl-elf.c 2012-06-19 21:21:14.798431393 -0700 | 28 | Signed-off-by: Junling Zheng <zhengjunling@huawei.com> |
10 | @@ -133,56 +133,60 @@ | 29 | --- |
30 | ldso/include/dl-string.h | 2 ++ | ||
31 | ldso/ldso/dl-elf.c | 79 +++++++++++++++++++++++++----------------------- | ||
32 | ldso/ldso/ldso.c | 18 +++++++++-- | ||
33 | 3 files changed, 59 insertions(+), 40 deletions(-) | ||
34 | |||
35 | diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h | ||
36 | index aacad10..14ae617 100644 | ||
37 | --- a/ldso/include/dl-string.h | ||
38 | +++ b/ldso/include/dl-string.h | ||
39 | @@ -204,7 +204,9 @@ static __always_inline char * _dl_get_last_path_component(char *path) | ||
40 | # define _dl_strcat strcat | ||
41 | # define _dl_strcpy strcpy | ||
42 | # define _dl_strcmp strcmp | ||
43 | +# define _dl_strchr strchr | ||
44 | # define _dl_strrchr strrchr | ||
45 | +# define _dl_strstr strstr | ||
46 | # define _dl_memcpy memcpy | ||
47 | # define _dl_memcmp memcmp | ||
48 | # define _dl_memset memset | ||
49 | diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c | ||
50 | index 1b06bc1..b323c90 100644 | ||
51 | --- a/ldso/ldso/dl-elf.c | ||
52 | +++ b/ldso/ldso/dl-elf.c | ||
53 | @@ -133,56 +133,60 @@ _dl_protect_relro (struct elf_resolve *l) | ||
11 | * in uClibc/ldso/util/ldd.c */ | 54 | * in uClibc/ldso/util/ldd.c */ |
12 | static struct elf_resolve * | 55 | static struct elf_resolve * |
13 | search_for_named_library(const char *name, unsigned rflags, const char *path_list, | 56 | search_for_named_library(const char *name, unsigned rflags, const char *path_list, |
@@ -16,9 +59,9 @@ Index: git/ldso/ldso/dl-elf.c | |||
16 | { | 59 | { |
17 | - char *path, *path_n, *mylibname; | 60 | - char *path, *path_n, *mylibname; |
18 | + char *mylibname; | 61 | + char *mylibname; |
62 | + const char *p, *pn; | ||
19 | struct elf_resolve *tpnt; | 63 | struct elf_resolve *tpnt; |
20 | - int done; | 64 | - int done; |
21 | + const char *p, *pn; | ||
22 | + int plen; | 65 | + int plen; |
23 | 66 | ||
24 | if (path_list==NULL) | 67 | if (path_list==NULL) |
@@ -100,7 +143,7 @@ Index: git/ldso/ldso/dl-elf.c | |||
100 | return NULL; | 143 | return NULL; |
101 | } | 144 | } |
102 | 145 | ||
103 | @@ -234,8 +238,10 @@ | 146 | @@ -234,7 +238,8 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp |
104 | if (pnt) { | 147 | if (pnt) { |
105 | pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB]; | 148 | pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB]; |
106 | _dl_if_debug_dprint("\tsearching RPATH='%s'\n", pnt); | 149 | _dl_if_debug_dprint("\tsearching RPATH='%s'\n", pnt); |
@@ -108,11 +151,9 @@ Index: git/ldso/ldso/dl-elf.c | |||
108 | + if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt, | 151 | + if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt, |
109 | + tpnt->libname)) != NULL) | 152 | + tpnt->libname)) != NULL) |
110 | return tpnt1; | 153 | return tpnt1; |
111 | + | ||
112 | } | 154 | } |
113 | #endif | 155 | #endif |
114 | 156 | @@ -243,7 +248,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp | |
115 | @@ -243,7 +249,7 @@ | ||
116 | /* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */ | 157 | /* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */ |
117 | if (_dl_library_path) { | 158 | if (_dl_library_path) { |
118 | _dl_if_debug_dprint("\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path); | 159 | _dl_if_debug_dprint("\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path); |
@@ -121,7 +162,7 @@ Index: git/ldso/ldso/dl-elf.c | |||
121 | { | 162 | { |
122 | return tpnt1; | 163 | return tpnt1; |
123 | } | 164 | } |
124 | @@ -257,7 +263,7 @@ | 165 | @@ -257,7 +262,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp |
125 | if (pnt) { | 166 | if (pnt) { |
126 | pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB]; | 167 | pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB]; |
127 | _dl_if_debug_dprint("\tsearching RUNPATH='%s'\n", pnt); | 168 | _dl_if_debug_dprint("\tsearching RUNPATH='%s'\n", pnt); |
@@ -130,7 +171,7 @@ Index: git/ldso/ldso/dl-elf.c | |||
130 | return tpnt1; | 171 | return tpnt1; |
131 | } | 172 | } |
132 | #endif | 173 | #endif |
133 | @@ -291,7 +297,7 @@ | 174 | @@ -291,7 +296,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp |
134 | /* Look for libraries wherever the shared library loader | 175 | /* Look for libraries wherever the shared library loader |
135 | * was installed */ | 176 | * was installed */ |
136 | _dl_if_debug_dprint("\tsearching ldso dir='%s'\n", _dl_ldsopath); | 177 | _dl_if_debug_dprint("\tsearching ldso dir='%s'\n", _dl_ldsopath); |
@@ -139,7 +180,7 @@ Index: git/ldso/ldso/dl-elf.c | |||
139 | if (tpnt1 != NULL) | 180 | if (tpnt1 != NULL) |
140 | return tpnt1; | 181 | return tpnt1; |
141 | #endif | 182 | #endif |
142 | @@ -304,7 +310,7 @@ | 183 | @@ -304,7 +309,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp |
143 | #ifndef __LDSO_CACHE_SUPPORT__ | 184 | #ifndef __LDSO_CACHE_SUPPORT__ |
144 | ":" UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib" | 185 | ":" UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib" |
145 | #endif | 186 | #endif |
@@ -148,14 +189,15 @@ Index: git/ldso/ldso/dl-elf.c | |||
148 | if (tpnt1 != NULL) | 189 | if (tpnt1 != NULL) |
149 | return tpnt1; | 190 | return tpnt1; |
150 | 191 | ||
151 | Index: git/ldso/ldso/ldso.c | 192 | diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c |
152 | =================================================================== | 193 | index 5619629..73bcc41 100644 |
153 | --- git.orig/ldso/ldso/ldso.c 2012-06-19 18:29:08.633931663 -0700 | 194 | --- a/ldso/ldso/ldso.c |
154 | +++ git/ldso/ldso/ldso.c 2012-06-19 18:29:10.197931738 -0700 | 195 | +++ b/ldso/ldso/ldso.c |
155 | @@ -403,6 +403,20 @@ | 196 | @@ -402,6 +402,20 @@ static ptrdiff_t _dl_build_local_scope (struct elf_resolve **list, |
197 | p += _dl_build_local_scope (p, q->tpnt); | ||
156 | return p - list; | 198 | return p - list; |
157 | } | 199 | } |
158 | 200 | + | |
159 | +static void _dl_setup_progname(const char *argv0) | 201 | +static void _dl_setup_progname(const char *argv0) |
160 | +{ | 202 | +{ |
161 | + char image[PATH_MAX]; | 203 | + char image[PATH_MAX]; |
@@ -169,11 +211,10 @@ Index: git/ldso/ldso/ldso.c | |||
169 | + _dl_progname = argv0; | 211 | + _dl_progname = argv0; |
170 | + } | 212 | + } |
171 | +} | 213 | +} |
172 | + | 214 | |
173 | void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, | 215 | void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, |
174 | ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv | 216 | ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv |
175 | DL_GET_READY_TO_RUN_EXTRA_PARMS) | 217 | @@ -454,9 +468,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, |
176 | @@ -454,9 +468,7 @@ | ||
177 | * been fixed up by now. Still no function calls outside of this | 218 | * been fixed up by now. Still no function calls outside of this |
178 | * library, since the dynamic resolver is not yet ready. | 219 | * library, since the dynamic resolver is not yet ready. |
179 | */ | 220 | */ |
@@ -184,3 +225,6 @@ Index: git/ldso/ldso/ldso.c | |||
184 | 225 | ||
185 | #ifdef __DSBT__ | 226 | #ifdef __DSBT__ |
186 | _dl_ldso_dsbt = (void *)tpnt->dynamic_info[DT_DSBT_BASE_IDX]; | 227 | _dl_ldso_dsbt = (void *)tpnt->dynamic_info[DT_DSBT_BASE_IDX]; |
228 | -- | ||
229 | 1.8.3.4 | ||
230 | |||