This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ldconfig hwcap rewrite


Andreas Jaeger <aj@suse.de> writes:

> What's the best way to check for hwcaps?  The current way which isn't
> either clever nor very good is to use:
> if ((entry[idx].hwcap & _dl_hwcap) > _dl_hwcap)
> for stepping over libraries and using the first one that fits.  But
> there might be a number of libraries which fit.  Is there a way to
> order them?  Currently thw hwcaps are ordered to their numerical value.
> I'll also try to use HWCAP_IMPORTANT.

I think if you look at HWCAP_IMPORTANT and then at the numerical
values, that's enough.  The user has still the option to remove one of
the objects.

I'm still not sure whether you understood the potential I'm seeing.
Look at this example:

	lib1
	lib2
	lib3	hwcap=7
	lib3	hwcap=6
	lib3	hwcap=4
	lib3    hwcap=3
	lib3    hwcap=2

You are searching for lib3 and hwcap is 7.  Searching will immediately
find the entry "lib3 hwcap=6" and starts searching from there.  The
entry with hwcap=7 is not found.  There are many related problem which
all involve the that you cannot be sure that an entry matching exactly
the search criteria is available.  I think the data structure must be
something like this:

 [0]	lib1		[0]
 [1]	lib2		[1]
 [2]	lib3	hwcap=7	[2]
 [3]	lib3	hwcap=6 [2]
 [4]	lib3	hwcap=4 [2]
 [5]	lib3    hwcap=3	[2]
 [6]	lib3    hwcap=2	[2]

The first column is the inde of the entry in the table and does not
have to be stored.  The new last column specifies the first entry with
the same name.  Then you can simply start seaching incrementally there.


Again, I'm not sure whether this is really a problem with your code.
I just have seen binary search and without such helper structures it
cannot be used.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]