Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Saul Wold <sgw@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [CONSOLIDATED PULL 04/12] eglibc: Modify ldd script according to multilib config.
Date: Sun, 14 Aug 2011 16:30:38 -0700	[thread overview]
Message-ID: <80fbf7ea59745326fb01238765ce9656ef026d7d.1313363644.git.sgw@linux.intel.com> (raw)
In-Reply-To: <cover.1313363644.git.sgw@linux.intel.com>
In-Reply-To: <cover.1313363644.git.sgw@linux.intel.com>

From: Lianhao Lu <lianhao.lu@intel.com>

Bug fixing [YOCTO #1236].

1. Collect all the values for RTLDLIST for the current multilib
configuration to modify the ldd scripts.

2. Collect all the values for KNOWN_INTERPRETER_NAMES for the current
multilib configuration. Set the correct ld.so names for ldconfig to deal
with the multilib configuration.
---
 .../eglibc/eglibc-2.13/multilib_readlib.patch      |   17 ++++++
 meta/recipes-core/eglibc/eglibc-ld.inc             |   54 ++++++++++++++++++++
 meta/recipes-core/eglibc/eglibc.inc                |    1 +
 meta/recipes-core/eglibc/eglibc_2.13.bb            |   13 ++++-
 4 files changed, 84 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-core/eglibc/eglibc-2.13/multilib_readlib.patch
 create mode 100644 meta/recipes-core/eglibc/eglibc-ld.inc

diff --git a/meta/recipes-core/eglibc/eglibc-2.13/multilib_readlib.patch b/meta/recipes-core/eglibc/eglibc-2.13/multilib_readlib.patch
new file mode 100644
index 0000000..1542b1b
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.13/multilib_readlib.patch
@@ -0,0 +1,17 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+Replace the OECORE_KNOWN_INTERPRETER_NAMES with the value of 
+variable EGLIBC_KNOWN_INTERPRETER_NAMES.
+
+Lianhao Lu, 08/01/2011
+
+--- libc/elf/readlib.c.orig	2011-08-12 17:05:51.864470837 +0800
++++ libc/elf/readlib.c	2011-08-12 17:06:39.346942074 +0800
+@@ -52,6 +52,7 @@
+ #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
+   SYSDEP_KNOWN_INTERPRETER_NAMES
+ #endif
++  OECORE_KNOWN_INTERPRETER_NAMES
+ };
+ 
+ static struct known_names known_libs[] =
diff --git a/meta/recipes-core/eglibc/eglibc-ld.inc b/meta/recipes-core/eglibc/eglibc-ld.inc
new file mode 100644
index 0000000..b3eb46e
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-ld.inc
@@ -0,0 +1,54 @@
+def ld_append_if_tune_exists(d, infos, dict):
+	tune = d.getVar("DEFAULTTUNE", True) or ""
+	libdir = d.getVar("base_libdir", True) or ""
+	if dict.has_key(tune):
+		infos['ldconfig'].add('{"' + libdir + '/' + dict[tune][0] + '",' + dict[tune][1] + ' }')
+		infos['lddrewrite'].add(libdir+'/'+dict[tune][0])
+
+def eglibc_dl_info(d):
+	ld_info_all = {
+		"mips": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mipsel": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64el-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64el": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64el-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"mips64el-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"powerpc": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"powerpc-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
+		"powerpc64": ["ld64.so.1", "FLAG_ELF_LIBC6"],
+		"powerpc64-nf": ["ld64.so.1", "FLAG_ELF_LIBC6"],
+		"core2": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
+		"core2-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
+		"x86": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
+		"x86-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
+		"i586": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
+	}
+
+	infos = {'ldconfig':set(), 'lddrewrite':set()}
+	ld_append_if_tune_exists(d, infos, ld_info_all)
+
+	#DEFAULTTUNE_MULTILIB_ORIGINAL
+	original_tune=d.getVar("DEFAULTTUNE_MULTILIB_ORIGINAL",True)
+	if original_tune:
+		localdata = bb.data.createCopy(d)
+		localdata.setVar("DEFAULTTUNE", original_tune)
+		ld_append_if_tune_exists(localdata, infos, ld_info_all)
+
+	variants = d.getVar("MULTILIB_VARIANTS", True) or ""
+	for item in variants.split():
+		localdata = bb.data.createCopy(d)
+		overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
+		localdata.setVar("OVERRIDES", overrides)
+		bb.data.update_data(localdata)
+		ld_append_if_tune_exists(localdata, infos, ld_info_all)
+	infos['ldconfig'] = ','.join(infos['ldconfig'])
+	infos['lddrewrite'] = ' '.join(infos['lddrewrite'])
+	return infos
+
+EGLIBC_KNOWN_INTERPRETER_NAMES = "${@eglibc_dl_info(d)['ldconfig']}"
+RTLDLIST = "${@eglibc_dl_info(d)['lddrewrite']}"
diff --git a/meta/recipes-core/eglibc/eglibc.inc b/meta/recipes-core/eglibc/eglibc.inc
index 9088d02..fe9f8ba 100644
--- a/meta/recipes-core/eglibc/eglibc.inc
+++ b/meta/recipes-core/eglibc/eglibc.inc
@@ -1,4 +1,5 @@
 require eglibc-common.inc
+require eglibc-ld.inc
 
 STAGINGCC = "gcc-cross-intermediate"
 STAGINGCC_virtclass-nativesdk = "gcc-crosssdk-intermediate"
diff --git a/meta/recipes-core/eglibc/eglibc_2.13.bb b/meta/recipes-core/eglibc/eglibc_2.13.bb
index 915eb32..f382448 100644
--- a/meta/recipes-core/eglibc/eglibc_2.13.bb
+++ b/meta/recipes-core/eglibc/eglibc_2.13.bb
@@ -3,7 +3,7 @@ require eglibc.inc
 SRCREV = "14157"
 
 DEPENDS += "gperf-native"
-PR = "r12"
+PR = "r13"
 PR_append = "+svnr${SRCPV}"
 
 EGLIBC_BRANCH="eglibc-2_13"
@@ -18,6 +18,7 @@ SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http
            file://generate-supported.mk \
            file://glibc_bug_fix_12454.patch \
            file://ppc-sqrt.patch \
+           file://multilib_readlib.patch \
 	   "
 LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \
       file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
@@ -83,6 +84,7 @@ do_move_ports() {
 
 do_patch_append() {
 	bb.build.exec_func('do_fix_ia_headers', d)
+	bb.build.exec_func('do_fix_readlib_c', d)
 }
 
 # We need to ensure that all of the i386 and x86_64 headers are identical
@@ -172,6 +174,10 @@ do_fix_ia_headers() {
 	cp ${S}/sysdeps/unix/sysv/linux/x86_64/sys/user.h ${S}/sysdeps/unix/sysv/linux/i386/sys/user.h
 }
 
+do_fix_readlib_c () {
+	sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
+}
+
 do_configure () {
 # override this function to avoid the autoconf/automake/aclocal/autoheader
 # calls for now
@@ -201,6 +207,11 @@ do_compile () {
 			rpcgen -h $r -o $h || oewarn "unable to generate header for $r"
 		done
 	)
+	echo "Adjust ldd script"
+	[ -z "${RTLDLIST}" ] && return
+	sed -i ${B}/elf/ldd -e 's#^\(RTLDLIST=\)"\(.*\)"$#\1\2#'
+	sed -i ${B}/elf/ldd -e 's#^\(RTLDLIST=\)\(.*\)$#\1"${RTLDLIST} \2"#'
+
 }
 
 require eglibc-package.inc
-- 
1.7.6




  parent reply	other threads:[~2011-08-14 23:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 23:30 [CONSOLIDATED PULL 00/12] Various Fixes Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 01/12] bluez4: Added new recipe 4.96 and removed 4.82 version Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 02/12] valgrind: supporting on Linux kernel 3.x Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 03/12] utils.bbclass/multilib.class: Added misc supporting functions Saul Wold
2011-08-15 11:53   ` Richard Purdie
2011-08-14 23:30 ` Saul Wold [this message]
2011-08-14 23:30 ` [CONSOLIDATED PULL 05/12] image: populate site config files into roootfs Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 06/12] meta-toolchain/environment: Use site config in rootfs Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 07/12] intltool: Use nativeperl binary for PERL instead of 'perl' Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 08/12] pixman: remove spurious dependency on libx11 Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 09/12] libx11: skip self if x11 not in DISTRO_FEATURES Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 10/12] cairo: only use x11 if selected " Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 11/12] dbus: only use x11 if DISTRO_FEATURES has selected it Saul Wold
2011-08-14 23:30 ` [CONSOLIDATED PULL 12/12] default-distrovars: add x11 to default DISTRO_FEATURES Saul Wold
2011-08-15 11:52 ` [CONSOLIDATED PULL 00/12] Various Fixes Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80fbf7ea59745326fb01238765ce9656ef026d7d.1313363644.git.sgw@linux.intel.com \
    --to=sgw@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox