summaryrefslogtreecommitdiff
path: root/meta/recipes-core/eglibc
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/recipes-core/eglibc
parent9eb2de9163791e1cf02a1fbf94da1ed55d8378c5 (diff)
downloadopenembedded-core-462aef73fad5f01afa89fe76da57032fc5abceee.tar.gz
openembedded-core-462aef73fad5f01afa89fe76da57032fc5abceee.tar.bz2
openembedded-core-462aef73fad5f01afa89fe76da57032fc5abceee.tar.xz
openembedded-core-462aef73fad5f01afa89fe76da57032fc5abceee.zip
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/recipes-core/eglibc')
-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 000000000..e00f02a55
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.12/ld-search-order.patch
@@ -0,0 +1,54 @@
+The default lib search path order is:
+
+ 1) LD_LIBRARY_PATH
+ 2) RPATH from the binary
+ 3) ld.so.cache
+ 4) default search paths embedded in the linker
+
+For nativesdk binaries which are being used alongside binaries on a host system, we
+need the search paths to firstly search the shipped nativesdk libs but then also
+cover the host system. For example we want the host system's libGL and this may be
+in a non-standard location like /usr/lib/mesa. The only place the location is know
+about is in the ld.so.cache of the host system.
+
+Since nativesdk has a simple structure and doesn't need to use a cache itself, we
+repurpose the cache for use as a last resort in finding host system binaries. This
+means we need to switch the order of 3 and 4 above to make this work effectively.
+
+RP 14/10/2010
+
+Index: libc/elf/dl-load.c
+===================================================================
+--- libc.orig/elf/dl-load.c 2010-10-14 11:34:54.944365484 +0100
++++ libc/elf/dl-load.c 2010-10-14 11:35:53.000000000 +0100
+@@ -2105,6 +2105,15 @@
+ &loader->l_runpath_dirs, &realname, &fb, loader,
+ LA_SER_RUNPATH, &found_other_class);
+
++ /* Try the default path. */
++ if (fd == -1
++ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
++ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
++ && rtld_search_dirs.dirs != (void *) -1)
++ fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
++ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
++
++ /* Finally try ld.so.cache */
+ if (fd == -1
+ && (__builtin_expect (! preloaded, 1)
+ || ! INTUSE(__libc_enable_secure)))
+@@ -2167,14 +2176,6 @@
+ }
+ }
+
+- /* Finally, try the default path. */
+- if (fd == -1
+- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
+- || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
+- && rtld_search_dirs.dirs != (void *) -1)
+- fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
+- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
+-
+ /* Add another newline when we are tracing the library loading. */
+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
+ _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 999b0b07d..752c1d8ce 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
DEPENDS += "gperf-native"
FILESPATHPKG =. "eglibc-svn:"
-PR = "r8"
+PR = "r9"
EGLIBC_BRANCH="eglibc-2_12"
SRC_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
file://mips-rld-map-check.patch \
file://etc/ld.so.conf \
file://generate-supported.mk"
+SRC_URI_append_virtclass-nativesdk = " file://ld-search-order.patch"
S = "${WORKDIR}/${EGLIBC_BRANCH}/libc"
B = "${WORKDIR}/build-${TARGET_SYS}"