The Xen kernel uses an "extra" hwcap bit (the "nosegneg" bit) and /etc/ld.so.conf.d/kernelcap-*.conf to make ld.so use the libraries in /lib/i686/nosegneg. Some circumstances (e.g. building a mkinitrd for a non-xen kernel while running under xen, or vice-versa - see bug #230874) demand the ability to set or unset these bits, but LD_HWCAP_MASK does not affect them. There should be an environment variable that ld.so honors, like LD_HWCAP_MASK, that allows us to pass a mask/vector. (We'd probably also need the ability to read that vector from an on-disk kernel image, but that's outside the scope of glibc.)
Adding support for this in LD_HWCAP_MASK is possible, but you'd still have hard time to compute which bit you actually want to mask (as the bit for nosegneg is derived from vDSO content). I'd suggest just hardcoding this, like: --- mkinitrd.jj 2007-04-16 17:55:39.000000000 -0400 +++ mkinitrd 2007-05-04 12:27:56.000000000 -0400 @@ -206,6 +206,20 @@ requires ${NAMES[$n]} n order to properl EOF exit 1 fi + case "$FILE" in + /lib*) + LIBDIR=`echo "$FILE" | sed 's,\(/lib[^/]*\)/.*$,\1,'` + BASE=`basename "$FILE"` + # Prefer nosegneg libs over direct segment accesses on i686. + if [ -f "$LIBDIR/i686/nosegneg/$BASE" ]; then + FILE="$LIBDIR/i686/nosegneg/$BASE" + # Otherwise, prefer base libraries rather than their optimized + # variants. + elif [ -f "$LIBDIR/$BASE" ]; then + FILE="$LIBDIR/$BASE" + fi + ;; + esac dynamic="yes" let n++ done @@ -426,7 +440,12 @@ inst() { get_dso_deps "$file" local DEPS="$DSO_DEPS" for x in $DEPS ; do - inst "$x" "$root" + l=`echo "$x" | sed -n 's,\(/lib[^/]*\)/.*$,\1,p'` + if [ -n "$l" ]; then + inst "$x" "$root" "$l"/`basename "$x"` + else + inst "$x" "$root" + fi done RET=$? fi Perhaps even extend the latter chunk, install all shared libraries into /lib{,64} . This would create initrd that is usable with any kernels. If you want to taylor it for xen vs. non-xen kernels, you can add/remove that i686/nosegneg preference depending on it.
Fixed in mkinitrd-6.0.9-3 .