diff options
author | Mike Crowe <mac@mcrowe.com> | 2019-02-24 21:00:52 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-26 23:04:31 +0000 |
commit | dda95279a7c428934a67dc2db03b8c3e5d72b914 (patch) | |
tree | 61331611aa307cc408311b197d99ecd05ee568aa /meta | |
parent | 10a97f71af1db23a4e1fa1a6364bf479d2973476 (diff) | |
download | poky-dda95279a7c428934a67dc2db03b8c3e5d72b914.tar.gz |
glibc: Install AArch64 loader link correctly for usrmerge+multilib
The AArch64 little-endian ABI requires that the dynamic loader is always
available at /lib/ld-linux-aarch64.so.1. Similarly, the big-endian ABI
requires that the dynamic loader is always available at
/lib/ld-linux-aarch64_be.so.1.
glibc-package.inc contains code that tries to ensure this, but
unfortunately it is defeated by the combination of multilib and usrmerge
because it does not take into account that /lib is the same as /usr/lib
with usrmerge when it adds the loader path to libc_baselibs and when it
attempts to show that /usr/lib is empty in do_poststash_install_cleanup.
This results in the symlink not being included in the package and a build
failure due to rmdir failing.
Richard Purdie also suggested[1] that ${nonarch_base_libdir} should not be
used as a synonym for /lib in this case.
This hopefully-fixed version always sets ARCH_DYNAMIC_LOADER and then uses
${root_prefix}/lib/${ARCH_DYNAMIC_LOADER} to refer to the dynamic loader
which works with both multilib and usrmerge. Since ARCH_DYNAMIC_LOADER is
only non-empty if the symlink is required, the code to create it can move
to do_install_append. Then do_poststash_install_cleanup needs to be taught
that ${exec_prefix}/lib may not be empty if the dynamic loader symlink is
there.
It appears not to be possible to specify the name of the loader via a
variable with an override, since the _aarch64 override is applied even for
_aarch64-be, so I've set the loader name using ${TARGET_ARCH} instead.
Build-tested and inspected core-image-minimal rootfs with:
* AArch64 no multilib (real loader in correct place)
MACHINE = "qemuarm64"
* AArch64 multilib (symlink in correct place)
MACHINE = "qemuarm64"
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "armv7at-neon"
require conf/multilib.conf
* AArch64 usrmerge (real loader in correct place)
DISTRO_FEATURES += "usrmerge"
MACHINE = "qemuarm64"
* AArch64 multilib usrmerge (symlink in correct place)
DISTRO_FEATURES += "usrmerge"
MACHINE = "qemuarm64"
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "armv7at-neon"
require conf/multilib.conf
* big-endian versions of all of the above by also setting
DEFAULTTUNE = "aarch64_be".
(building glibc only.)
* x86_64 (real loader in /lib as before)[2]
MACHINE = "qemux86"
* x86_64 multilib (real loader in /lib64 as before)
MACHINE="qemux86-64"
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
require conf/multilib.conf
I also tested leaving an unwanted file in ${exec_prefix}/lib for
do_poststash_install_cleanup to detect, and I believe the detection always
worked correctly.
[1] http://lists.openembedded.org/pipermail/openembedded-core/2018-November/276120.html
(From OE-Core rev: a705c0782c863ee960d65b5109168a4587a0a7b7)
Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/glibc/glibc-package.inc | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc index 329732f48c..b9259612d4 100644 --- a/meta/recipes-core/glibc/glibc-package.inc +++ b/meta/recipes-core/glibc/glibc-package.inc | |||
@@ -15,7 +15,12 @@ RPROVIDES_glibc-thread-db = "eglibc-thread-db" | |||
15 | RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile" | 15 | RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile" |
16 | RPROVIDES_${PN}-dbg = "eglibc-dbg" | 16 | RPROVIDES_${PN}-dbg = "eglibc-dbg" |
17 | libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so" | 17 | libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so" |
18 | libc_baselibs_append_aarch64 = " /lib/ld-linux-aarch64*.so.1" | 18 | ARCH_DYNAMIC_LOADER = "" |
19 | # The aarch64 ABI says the dynamic linker -must- be | ||
20 | # /lib/ld-linux-aarch64{,_be}.so.1. With usrmerge, that may mean that | ||
21 | # we need to install it in /usr/lib. | ||
22 | ARCH_DYNAMIC_LOADER_aarch64 = "ld-linux-${TARGET_ARCH}.so.1" | ||
23 | libc_baselibs_append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}" | ||
19 | INSANE_SKIP_${PN}_append_aarch64 = " libdir" | 24 | INSANE_SKIP_${PN}_append_aarch64 = " libdir" |
20 | 25 | ||
21 | FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf" | 26 | FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf" |
@@ -114,20 +119,20 @@ do_install_append () { | |||
114 | echo "d root root 0755 /var/run/nscd none" \ | 119 | echo "d root root 0755 /var/run/nscd none" \ |
115 | > ${D}${sysconfdir}/default/volatiles/98_nscd | 120 | > ${D}${sysconfdir}/default/volatiles/98_nscd |
116 | fi | 121 | fi |
122 | |||
123 | # The dynamic loader will have been installed into | ||
124 | # ${base_libdir}. However, if that isn't going to end up being | ||
125 | # available in the ABI-mandated location, then a symlink must | ||
126 | # be created. | ||
127 | |||
128 | if [ -n "${ARCH_DYNAMIC_LOADER}" -a ! -e "${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then | ||
129 | install -d ${D}${root_prefix}/lib | ||
130 | ln -s ${@oe.path.relative('${root_prefix}/lib', '${base_libdir}')}/${ARCH_DYNAMIC_LOADER} \ | ||
131 | ${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER} | ||
132 | fi | ||
117 | } | 133 | } |
118 | 134 | ||
119 | do_install_append_aarch64 () { | 135 | do_install_append_aarch64 () { |
120 | if [ "${base_libdir}" != "${nonarch_base_libdir}" ]; then | ||
121 | # The aarch64 ABI says the dynamic linker -must- be /lib/ld-linux-aarch64[_be].so.1 | ||
122 | install -d ${D}${nonarch_base_libdir} | ||
123 | if [ -e ${D}${base_libdir}/ld-linux-aarch64.so.1 ]; then | ||
124 | ln -s ${@oe.path.relative('${nonarch_base_libdir}', '${base_libdir}')}/ld-linux-aarch64.so.1 \ | ||
125 | ${D}${nonarch_base_libdir}/ld-linux-aarch64.so.1 | ||
126 | elif [ -e ${D}${base_libdir}/ld-linux-aarch64_be.so.1 ]; then | ||
127 | ln -s ${@oe.path.relative('${nonarch_base_libdir}', '${base_libdir}')}/ld-linux-aarch64_be.so.1 \ | ||
128 | ${D}${nonarch_base_libdir}/ld-linux-aarch64_be.so.1 | ||
129 | fi | ||
130 | fi | ||
131 | do_install_armmultilib | 136 | do_install_armmultilib |
132 | } | 137 | } |
133 | 138 | ||
@@ -209,12 +214,15 @@ do_poststash_install_cleanup () { | |||
209 | rm -rf ${D}/${localedir} | 214 | rm -rf ${D}/${localedir} |
210 | rm -rf ${D}${datadir}/locale | 215 | rm -rf ${D}${datadir}/locale |
211 | if [ "${libdir}" != "${exec_prefix}/lib" ]; then | 216 | if [ "${libdir}" != "${exec_prefix}/lib" ]; then |
212 | if [ -d ${D}${exec_prefix}/lib ]; then | 217 | if [ -d "${D}${exec_prefix}/lib" ]; then |
218 | if [ -z "${ARCH_DYNAMIC_LOADER}" -o \ | ||
219 | ! -e "${D}${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then | ||
213 | # error out if directory isn't empty | 220 | # error out if directory isn't empty |
214 | # this dir should only contain locale dir | 221 | # this dir should only contain locale dir |
215 | # which has been deleted in the previous step | 222 | # which has been deleted in the previous step |
216 | rmdir ${D}${exec_prefix}/lib | 223 | rmdir ${D}${exec_prefix}/lib |
217 | fi | 224 | fi |
225 | fi | ||
218 | fi | 226 | fi |
219 | } | 227 | } |
220 | addtask do_poststash_install_cleanup after do_stash_locale do_install before do_populate_sysroot do_package | 228 | addtask do_poststash_install_cleanup after do_stash_locale do_install before do_populate_sysroot do_package |