diff options
Diffstat (limited to 'meta/recipes-core/eglibc/eglibc-2.13/ld-search-order.patch')
-rw-r--r-- | meta/recipes-core/eglibc/eglibc-2.13/ld-search-order.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-2.13/ld-search-order.patch b/meta/recipes-core/eglibc/eglibc-2.13/ld-search-order.patch new file mode 100644 index 0000000000..f968678efb --- /dev/null +++ b/meta/recipes-core/eglibc/eglibc-2.13/ld-search-order.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | The default lib search path order is: | ||
2 | |||
3 | 1) LD_LIBRARY_PATH | ||
4 | 2) RPATH from the binary | ||
5 | 3) ld.so.cache | ||
6 | 4) default search paths embedded in the linker | ||
7 | |||
8 | For nativesdk binaries which are being used alongside binaries on a host system, we | ||
9 | need the search paths to firstly search the shipped nativesdk libs but then also | ||
10 | cover the host system. For example we want the host system's libGL and this may be | ||
11 | in a non-standard location like /usr/lib/mesa. The only place the location is know | ||
12 | about is in the ld.so.cache of the host system. | ||
13 | |||
14 | Since nativesdk has a simple structure and doesn't need to use a cache itself, we | ||
15 | repurpose the cache for use as a last resort in finding host system binaries. This | ||
16 | means we need to switch the order of 3 and 4 above to make this work effectively. | ||
17 | |||
18 | RP 14/10/2010 | ||
19 | |||
20 | Index: libc/elf/dl-load.c | ||
21 | =================================================================== | ||
22 | --- libc.orig/elf/dl-load.c | ||
23 | +++ libc/elf/dl-load.c | ||
24 | @@ -2107,6 +2107,15 @@ _dl_map_object (struct link_map *loader, | ||
25 | &loader->l_runpath_dirs, &realname, &fb, loader, | ||
26 | LA_SER_RUNPATH, &found_other_class); | ||
27 | |||
28 | + /* try the default path. */ | ||
29 | + if (fd == -1 | ||
30 | + && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL | ||
31 | + || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) | ||
32 | + && rtld_search_dirs.dirs != (void *) -1) | ||
33 | + fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs, | ||
34 | + &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); | ||
35 | + | ||
36 | + /* Finally try ld.so.cache */ | ||
37 | if (fd == -1 | ||
38 | && (__builtin_expect (! (mode & __RTLD_SECURE), 1) | ||
39 | || ! INTUSE(__libc_enable_secure))) | ||
40 | @@ -2169,14 +2178,6 @@ _dl_map_object (struct link_map *loader, | ||
41 | } | ||
42 | } | ||
43 | |||
44 | - /* Finally, try the default path. */ | ||
45 | - if (fd == -1 | ||
46 | - && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL | ||
47 | - || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) | ||
48 | - && rtld_search_dirs.dirs != (void *) -1) | ||
49 | - fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs, | ||
50 | - &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); | ||
51 | - | ||
52 | /* Add another newline when we are tracing the library loading. */ | ||
53 | if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)) | ||
54 | _dl_debug_printf ("\n"); | ||