Bug 235251 - No way to override "nosegneg" hwcap bit
Summary: No way to override "nosegneg" hwcap bit
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc   
(Show other bugs)
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
Blocks: 230874
TreeView+ depends on / blocked
Reported: 2007-04-04 18:10 UTC by Will Woods
Modified: 2007-11-30 22:12 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-05-21 15:33:29 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Will Woods 2007-04-04 18:10:16 UTC
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

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

Comment 1 Jakub Jelinek 2007-05-04 16:29:59 UTC
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
             exit 1
+       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
         let n++
@@ -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

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.

Comment 2 Peter Jones 2007-05-21 15:33:29 UTC
Fixed in mkinitrd-6.0.9-3 .

Note You need to log in before you can comment on or make changes to this bug.