summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch')
-rw-r--r--meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
new file mode 100644
index 0000000000..3d66348133
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
@@ -0,0 +1,70 @@
1From 0876fea1b5b26da84f298714a2e23ba696607dba Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:48:24 +0000
4Subject: [PATCH 01/27] nativesdk-glibc: Look for host system ld.so.cache as
5 well
6
7Upstream-Status: Inappropriate [embedded specific]
8
9The default lib search path order is:
10
11 1) LD_LIBRARY_PATH
12 2) RPATH from the binary
13 3) ld.so.cache
14 4) default search paths embedded in the linker
15
16For nativesdk binaries which are being used alongside binaries on a host system, we
17need the search paths to firstly search the shipped nativesdk libs but then also
18cover the host system. For example we want the host system's libGL and this may be
19in a non-standard location like /usr/lib/mesa. The only place the location is know
20about is in the ld.so.cache of the host system.
21
22Since nativesdk has a simple structure and doesn't need to use a cache itself, we
23repurpose the cache for use as a last resort in finding host system binaries. This
24means we need to switch the order of 3 and 4 above to make this work effectively.
25
26RP 14/10/2010
27
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29---
30 elf/dl-load.c | 17 ++++++++---------
31 1 file changed, 8 insertions(+), 9 deletions(-)
32
33diff --git a/elf/dl-load.c b/elf/dl-load.c
34index 0c052e4..f45085a 100644
35--- a/elf/dl-load.c
36+++ b/elf/dl-load.c
37@@ -2040,7 +2040,14 @@ _dl_map_object (struct link_map *loader, const char *name,
38 fd = open_path (name, namelen, mode,
39 &loader->l_runpath_dirs, &realname, &fb, loader,
40 LA_SER_RUNPATH, &found_other_class);
41-
42+ /* try the default path. */
43+ if (fd == -1
44+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
45+ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
46+ && rtld_search_dirs.dirs != (void *) -1)
47+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
48+ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
49+ /* Finally try ld.so.cache */
50 #ifdef USE_LDCONFIG
51 if (fd == -1
52 && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
53@@ -2099,14 +2106,6 @@ _dl_map_object (struct link_map *loader, const char *name,
54 }
55 #endif
56
57- /* Finally, try the default path. */
58- if (fd == -1
59- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
60- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB)))
61- && rtld_search_dirs.dirs != (void *) -1)
62- fd = open_path (name, namelen, mode, &rtld_search_dirs,
63- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
64-
65 /* Add another newline when we are tracing the library loading. */
66 if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
67 _dl_debug_printf ("\n");
68--
692.1.4
70