1void __init_cpu_features_resolver(unsigned long hwcap,
2                                  const __ifunc_arg_t *arg) {
3  if (__aarch64_cpu_features.features)
4    return;
5
6  __init_cpu_features_constructor(hwcap, arg);
7}
8
9void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
10  unsigned long hwcap = 0;
11  unsigned long hwcap2 = 0;
12  // CPU features already initialized.
13  if (__aarch64_cpu_features.features)
14    return;
15
16  int res = 0;
17  res = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
18  res |= elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
19  if (res)
20    return;
21
22  __ifunc_arg_t arg;
23  arg._size = sizeof(__ifunc_arg_t);
24  arg._hwcap = hwcap;
25  arg._hwcap2 = hwcap2;
26  __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
27}
28