This is the mail archive of the 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

It looks OK but there are a few problems.

> +#define HWCAP_CHECK								\
> +      if (*hwcap && (cache_new->libs[middle].hwcap & *hwcap) > _dl_hwcap)	\
> +	continue
> +      SEARCH_CACHE (cache_new);
>      }
> +  else

The first test certainly must be "if (hwcap", i.e., no dereferencing.

Second, related to this, if you are using binary sort for the extended
table, how do you make sure you see all the entries with a given name
but different hwcaps?  It seems you are stumbling accross one and then
us the existence of the hwcap field to single step to the next entry.
But what if the first entry with a matching name is not the one with
the most specific hwcap?

What I think is necessary is that either

- there is exactly one of the hwcap entries actually in the table and
  by some the different hwcap entries can be by some other mean

- add an explicit index to the first hwcap entry with the matching hwcap.
  The algorithm would look like this:

     find idx with matching file name

     if hwcap in entry[idx] is zero
       found entry idx
       idx = entry[idx].first_hwcap

       while ((entry[idx].hwcap & _dl_hwcap) > _dl_hwcap)
        // Probably need to handle case here where no lib with hwcap
        // zero is available 

       found entry idx

If you have already done something like this I missed it in my brief
look over the code.  It should be carefully documented in any case.

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

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