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