summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-10-14 11:44:57 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-10-14 11:46:39 +0100
commit462aef73fad5f01afa89fe76da57032fc5abceee (patch)
tree80d5b90e299bfbd303d1c6b81c86136dd67aaf5e /meta
parent9eb2de9163791e1cf02a1fbf94da1ed55d8378c5 (diff)
downloadpoky-462aef73fad5f01afa89fe76da57032fc5abceee.tar.gz
eglibc-nativesdk: Add patch to change the search path of the dynamic linker
Change the search path of the dynamic linker to search ld.so.cache as a last resort when trying to find libraries at runtime. This means libs in /opt/poky are used in preference but any host libs such as libGL can also be found. See the patch for a more detailed description. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch54
-rw-r--r--meta/recipes-core/eglibc/eglibc_2.12.bb3
2 files changed, 56 insertions, 1 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch b/meta/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch
new file mode 100644
index 0000000000..e00f02a55c
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch
@@ -0,0 +1,54 @@
1The 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
8For nativesdk binaries which are being used alongside binaries on a host system, we
9need the search paths to firstly search the shipped nativesdk libs but then also
10cover the host system. For example we want the host system's libGL and this may be
11in a non-standard location like /usr/lib/mesa. The only place the location is know
12about is in the ld.so.cache of the host system.
13
14Since nativesdk has a simple structure and doesn't need to use a cache itself, we
15repurpose the cache for use as a last resort in finding host system binaries. This
16means we need to switch the order of 3 and 4 above to make this work effectively.
17
18RP 14/10/2010
19
20Index: libc/elf/dl-load.c
21===================================================================
22--- libc.orig/elf/dl-load.c 2010-10-14 11:34:54.944365484 +0100
23+++ libc/elf/dl-load.c 2010-10-14 11:35:53.000000000 +0100
24@@ -2105,6 +2105,15 @@
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, preloaded, &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 (! preloaded, 1)
39 || ! INTUSE(__libc_enable_secure)))
40@@ -2167,14 +2176,6 @@
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, preloaded, &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");
diff --git a/meta/recipes-core/eglibc/eglibc_2.12.bb b/meta/recipes-core/eglibc/eglibc_2.12.bb
index 999b0b07da..752c1d8cee 100644
--- a/meta/recipes-core/eglibc/eglibc_2.12.bb
+++ b/meta/recipes-core/eglibc/eglibc_2.12.bb
@@ -2,7 +2,7 @@ require eglibc.inc
2 2
3DEPENDS += "gperf-native" 3DEPENDS += "gperf-native"
4FILESPATHPKG =. "eglibc-svn:" 4FILESPATHPKG =. "eglibc-svn:"
5PR = "r8" 5PR = "r9"
6 6
7EGLIBC_BRANCH="eglibc-2_12" 7EGLIBC_BRANCH="eglibc-2_12"
8SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \ 8SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \
@@ -12,6 +12,7 @@ SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http
12 file://mips-rld-map-check.patch \ 12 file://mips-rld-map-check.patch \
13 file://etc/ld.so.conf \ 13 file://etc/ld.so.conf \
14 file://generate-supported.mk" 14 file://generate-supported.mk"
15SRC_URI_append_virtclass-nativesdk = " file://ld-search-order.patch"
15S = "${WORKDIR}/${EGLIBC_BRANCH}/libc" 16S = "${WORKDIR}/${EGLIBC_BRANCH}/libc"
16B = "${WORKDIR}/build-${TARGET_SYS}" 17B = "${WORKDIR}/build-${TARGET_SYS}"
17 18