diff options
author | Khem Raj <raj.khem@gmail.com> | 2012-01-24 09:43:00 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-25 14:34:09 +0000 |
commit | 3a9e5682a9d74fe4f78cd4399927bad1942d0153 (patch) | |
tree | 94f3f4896929d39fd5df60febc3130b41c73ba9c /meta/recipes-core/uclibc/uclibc-git/orign_path.patch | |
parent | e60acb7e0b3394bb88fac92bb197e676506879e7 (diff) | |
download | poky-3a9e5682a9d74fe4f78cd4399927bad1942d0153.tar.gz |
uclibc-git: Update to latest RC
Document the patches
(From OE-Core rev: 746e8ffa66850bf9050cd6baf94eb76c492eb535)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/uclibc/uclibc-git/orign_path.patch')
-rw-r--r-- | meta/recipes-core/uclibc/uclibc-git/orign_path.patch | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-git/orign_path.patch b/meta/recipes-core/uclibc/uclibc-git/orign_path.patch new file mode 100644 index 0000000000..c9c15a34b7 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/orign_path.patch | |||
@@ -0,0 +1,185 @@ | |||
1 | Patch is backported from | ||
2 | http://lists.busybox.net/pipermail/uclibc/2011-March/045003.html | ||
3 | |||
4 | Upstream-Status: Pending | ||
5 | |||
6 | Index: git/ldso/ldso/dl-elf.c | ||
7 | =================================================================== | ||
8 | --- git.orig/ldso/ldso/dl-elf.c 2012-01-23 19:18:58.000000000 -0800 | ||
9 | +++ git/ldso/ldso/dl-elf.c 2012-01-23 21:52:06.144646590 -0800 | ||
10 | @@ -133,53 +133,60 @@ | ||
11 | * in uClibc/ldso/util/ldd.c */ | ||
12 | static struct elf_resolve * | ||
13 | search_for_named_library(const char *name, unsigned rflags, const char *path_list, | ||
14 | - struct dyn_elf **rpnt) | ||
15 | + struct dyn_elf **rpnt, const char* origin) | ||
16 | { | ||
17 | - char *path, *path_n, *mylibname; | ||
18 | + char *mylibname; | ||
19 | + const char *p, *pn; | ||
20 | struct elf_resolve *tpnt; | ||
21 | - int done; | ||
22 | + int plen; | ||
23 | |||
24 | if (path_list==NULL) | ||
25 | return NULL; | ||
26 | |||
27 | - /* We need a writable copy of this string, but we don't | ||
28 | - * need this allocated permanently since we don't want | ||
29 | - * to leak memory, so use alloca to put path on the stack */ | ||
30 | - done = _dl_strlen(path_list); | ||
31 | - path = alloca(done + 1); | ||
32 | - | ||
33 | /* another bit of local storage */ | ||
34 | mylibname = alloca(2050); | ||
35 | |||
36 | - _dl_memcpy(path, path_list, done+1); | ||
37 | - | ||
38 | /* Unlike ldd.c, don't bother to eliminate double //s */ | ||
39 | |||
40 | /* Replace colons with zeros in path_list */ | ||
41 | /* : at the beginning or end of path maps to CWD */ | ||
42 | /* :: anywhere maps CWD */ | ||
43 | /* "" maps to CWD */ | ||
44 | - done = 0; | ||
45 | - path_n = path; | ||
46 | - do { | ||
47 | - if (*path == 0) { | ||
48 | - *path = ':'; | ||
49 | - done = 1; | ||
50 | + for (p = path_list; p != NULL; p = pn) { | ||
51 | + pn = _dl_strchr(p + 1, ':'); | ||
52 | + if (pn != NULL) { | ||
53 | + plen = pn - p; | ||
54 | + pn++; | ||
55 | + } else | ||
56 | + plen = _dl_strlen(p); | ||
57 | + | ||
58 | + if (plen >= 7 && _dl_memcmp(p, "$ORIGIN", 7) == 0) { | ||
59 | + int olen; | ||
60 | + if (rflags && plen != 7) | ||
61 | + continue; | ||
62 | + if (origin == NULL) | ||
63 | + continue; | ||
64 | + for (olen = _dl_strlen(origin) - 1; olen >= 0 && origin[olen] != '/'; olen--) | ||
65 | + ; | ||
66 | + if (olen <= 0) | ||
67 | + continue; | ||
68 | + _dl_memcpy(&mylibname[0], origin, olen); | ||
69 | + _dl_memcpy(&mylibname[olen], p + 7, plen - 7); | ||
70 | + mylibname[olen + plen - 7] = 0; | ||
71 | + } else if (plen != 0) { | ||
72 | + _dl_memcpy(mylibname, p, plen); | ||
73 | + mylibname[plen] = 0; | ||
74 | + } else { | ||
75 | + _dl_strcpy(mylibname, "."); | ||
76 | } | ||
77 | - if (*path == ':') { | ||
78 | - *path = 0; | ||
79 | - if (*path_n) | ||
80 | - _dl_strcpy(mylibname, path_n); | ||
81 | - else | ||
82 | - _dl_strcpy(mylibname, "."); /* Assume current dir if empty path */ | ||
83 | - _dl_strcat(mylibname, "/"); | ||
84 | - _dl_strcat(mylibname, name); | ||
85 | - if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL) | ||
86 | - return tpnt; | ||
87 | - path_n = path+1; | ||
88 | - } | ||
89 | - path++; | ||
90 | - } while (!done); | ||
91 | + _dl_strcat(mylibname, "/"); | ||
92 | + _dl_strcat(mylibname, name); | ||
93 | + | ||
94 | + tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname); | ||
95 | + if (tpnt != NULL) | ||
96 | + return tpnt; | ||
97 | + } | ||
98 | + | ||
99 | return NULL; | ||
100 | } | ||
101 | |||
102 | @@ -231,8 +238,10 @@ | ||
103 | if (pnt) { | ||
104 | pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB]; | ||
105 | _dl_if_debug_dprint("\tsearching RPATH='%s'\n", pnt); | ||
106 | - if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL) | ||
107 | + if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt, | ||
108 | + tpnt->libname)) != NULL) | ||
109 | return tpnt1; | ||
110 | + | ||
111 | } | ||
112 | #endif | ||
113 | |||
114 | @@ -240,7 +249,7 @@ | ||
115 | /* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */ | ||
116 | if (_dl_library_path) { | ||
117 | _dl_if_debug_dprint("\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path); | ||
118 | - if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt)) != NULL) | ||
119 | + if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt, NULL)) != NULL) | ||
120 | { | ||
121 | return tpnt1; | ||
122 | } | ||
123 | @@ -254,7 +263,7 @@ | ||
124 | if (pnt) { | ||
125 | pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB]; | ||
126 | _dl_if_debug_dprint("\tsearching RUNPATH='%s'\n", pnt); | ||
127 | - if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL) | ||
128 | + if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt, NULL)) != NULL) | ||
129 | return tpnt1; | ||
130 | } | ||
131 | #endif | ||
132 | @@ -288,7 +297,7 @@ | ||
133 | /* Look for libraries wherever the shared library loader | ||
134 | * was installed */ | ||
135 | _dl_if_debug_dprint("\tsearching ldso dir='%s'\n", _dl_ldsopath); | ||
136 | - tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt); | ||
137 | + tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt, NULL); | ||
138 | if (tpnt1 != NULL) | ||
139 | return tpnt1; | ||
140 | #endif | ||
141 | @@ -301,7 +310,7 @@ | ||
142 | #ifndef __LDSO_CACHE_SUPPORT__ | ||
143 | ":" UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib" | ||
144 | #endif | ||
145 | - , rpnt); | ||
146 | + , rpnt, NULL); | ||
147 | if (tpnt1 != NULL) | ||
148 | return tpnt1; | ||
149 | |||
150 | Index: git/ldso/ldso/ldso.c | ||
151 | =================================================================== | ||
152 | --- git.orig/ldso/ldso/ldso.c 2012-01-23 19:18:58.000000000 -0800 | ||
153 | +++ git/ldso/ldso/ldso.c 2012-01-23 21:34:11.152594621 -0800 | ||
154 | @@ -407,6 +407,20 @@ | ||
155 | return p - list; | ||
156 | } | ||
157 | |||
158 | +static void _dl_setup_progname(const char *argv0) | ||
159 | +{ | ||
160 | + char image[PATH_MAX]; | ||
161 | + ssize_t s; | ||
162 | + | ||
163 | + s = _dl_readlink("/proc/self/exe", image, sizeof(image)); | ||
164 | + if (s > 0 && image[0] == '/') { | ||
165 | + image[s] = 0; | ||
166 | + _dl_progname = _dl_strdup(image); | ||
167 | + } else if (argv0) { | ||
168 | + _dl_progname = argv0; | ||
169 | + } | ||
170 | +} | ||
171 | + | ||
172 | void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, | ||
173 | ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv | ||
174 | DL_GET_READY_TO_RUN_EXTRA_PARMS) | ||
175 | @@ -458,9 +472,7 @@ | ||
176 | * been fixed up by now. Still no function calls outside of this | ||
177 | * library, since the dynamic resolver is not yet ready. | ||
178 | */ | ||
179 | - if (argv[0]) { | ||
180 | - _dl_progname = argv[0]; | ||
181 | - } | ||
182 | + _dl_setup_progname(argv[0]); | ||
183 | |||
184 | #ifndef __LDSO_STANDALONE_SUPPORT__ | ||
185 | if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) { | ||