[RFC] Expanding the hwcap

Roland McGrath roland@hack.frob.com
Wed Nov 14 00:30:00 GMT 2012


> When the rtld_global_ro.hwcap is populated (elf/dl-sysdeps.c) the auxv
> is walked. Due to struct element ordering (and the fact that we won't
> change it) we always know that AT_HWCAP will precede any instances of
> AT_HWCAP2 so the AT_HWCAP assignment can be left as-is.

The ABI is that auxv elements can be in any order.  Even if the kernel
happens always to put AT_HWCAP first, we should not assume so in userland.

> I've tested a prototype for AT_HWCAP2 with powerpc32 and powerpc64
> that preserves the low 32-bits.
>         case AT_HWCAP2:
>            GLRO(dl_hwcap) = (0x00000000ffffffff & GLRO(dl_hwcap)) |
> (((uint64_t) av->a_un.a_val) << 32);
>           break;

If the same a_type were to appear twice that would be an ABI violation and
so it really doesn't matter much how we treat it.  Might as well simply
make it |= in both case AT_HWCAP and case AT_HWCAP2.


Thanks,
Roland



More information about the Libc-alpha mailing list