Skip to content

Define AT_HWCAP* when <sys/auxv.h> hides them - #3429

Open
Xeonacid wants to merge 1 commit into
aws:mainfrom
Xeonacid:fix/ppc64le-at-hwcap2-xopen-source
Open

Define AT_HWCAP* when <sys/auxv.h> hides them#3429
Xeonacid wants to merge 1 commit into
aws:mainfrom
Xeonacid:fix/ppc64le-at-hwcap2-xopen-source

Conversation

@Xeonacid

@Xeonacid Xeonacid commented Aug 17, 2026

Copy link
Copy Markdown

Issues:

Regressed by #3250. Observed downstream when aws-lc-sys 0.44 built AWS-LC on manylinux 2.17 for powerpc64le:
https://github.com/astral-sh/uv/actions/runs/31985144822/job/95258879338

#3250 removed the #if defined(AT_HWCAP2) guard from cpu_ppc64le.c because the new helper header defines AT_HWCAP2 on the /proc/self/auxv fallback path, and assumed <sys/auxv.h> always defines it otherwise.

That assumption is false: glibc only advertised AT_HWCAP2 starting in 2.18 (#1682), and even later headers can hide it under -D_XOPEN_SOURCE=700 without _GNU_SOURCE. aws-lc-sys Linux builds use exactly those flags, so cpu_ppc64le.c fails to compile on manylinux 2.17:

cpu_ppc64le.c:69:38: error: 'AT_HWCAP2' undeclared

Description of changes:

Provide the Linux UAPI values (include/uapi/linux/auxvec.h) whenever the system header omits them, for both the libc getauxval path and the /proc/self/auxv fallback.

Call-outs:

None

Testing:

  • gcc -std=c99 -D_XOPEN_SOURCE=700 compiles a TU that includes cpu_getauxval_linux.h and calls getauxval(AT_HWCAP2).
  • Same compile with -DOPENSSL_GETAUXVAL_FORCE_PROC_FALLBACK.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

### Issues:
Regressed by aws#3250. Observed downstream when aws-lc-sys 0.44 built
AWS-LC on manylinux 2.17 for powerpc64le:
https://github.com/astral-sh/uv/actions/runs/31985144822/job/95258879338

### Description of changes:
aws#3250 removed the `#if defined(AT_HWCAP2)` guard from `cpu_ppc64le.c`
because the new helper header defines `AT_HWCAP2` on the
`/proc/self/auxv` fallback path, and assumed `<sys/auxv.h>` always
defines it otherwise.

That assumption is false: glibc only advertised `AT_HWCAP2` starting
in 2.18 (aws#1682), and even later headers can hide it under
`-D_XOPEN_SOURCE=700` without `_GNU_SOURCE`. aws-lc-sys Linux builds
use exactly those flags, so `cpu_ppc64le.c` fails to compile on
manylinux 2.17:

    cpu_ppc64le.c:69:38: error: 'AT_HWCAP2' undeclared

Provide the Linux UAPI values (`include/uapi/linux/auxvec.h`) whenever
the system header omits them, for both the libc `getauxval` path and
the `/proc/self/auxv` fallback.

### Testing:
* `gcc -std=c99 -D_XOPEN_SOURCE=700` compiles a TU that includes
  `cpu_getauxval_linux.h` and calls `getauxval(AT_HWCAP2)`.
* Same compile with `-DOPENSSL_GETAUXVAL_FORCE_PROC_FALLBACK`.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant