Skip to content

Commit

Permalink
arch/riscv/riscv_features.c: fix uclibc build
Browse files Browse the repository at this point in the history
Fix the following uclibc build failure raised since version 2.1.4 and
zlib-ng@6ff8b52:

/home/autobuild/autobuild/instance-2/output-1/build/zlib-ng-2.1.6/arch/riscv/riscv_features.c:4:10: fatal error: sys/auxv.h: No such file or directory
    4 | #include <sys/auxv.h>
      |          ^~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/06a7d8e59ec4de7c711d3f4a4624f67b97d78afe

Signed-off-by: Fabrice Fontaine <[email protected]>
  • Loading branch information
ffontaine authored and Dead2 committed Apr 11, 2024
1 parent b273de7 commit 3f35bfc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion arch/riscv/riscv_features.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/auxv.h>
#include <sys/utsname.h>

#if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
# include <sys/auxv.h>
#endif

#include "zbuild.h"
#include "riscv_features.h"

Expand Down Expand Up @@ -33,7 +36,11 @@ void Z_INTERNAL riscv_check_features_compile_time(struct riscv_cpu_features *fea
}

void Z_INTERNAL riscv_check_features_runtime(struct riscv_cpu_features *features) {
#if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
unsigned long hw_cap = getauxval(AT_HWCAP);
#else
unsigned long hw_cap = 0;
#endif
features->has_rvv = hw_cap & ISA_V_HWCAP;
}

Expand Down

0 comments on commit 3f35bfc

Please sign in to comment.