[Bug 239621] sys/auxv.h isn't sufficient on powerpc*: PPC_FEATURE_* are not defined
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Aug 3 18:57:57 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239621
Bug ID: 239621
Summary: sys/auxv.h isn't sufficient on powerpc*: PPC_FEATURE_*
are not defined
Product: Base System
Version: CURRENT
Hardware: powerpc
OS: Any
Status: New
Keywords: needs-patch
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: jbeich at FreeBSD.org
<sys/auxv.h> on armv6 and armv7 pulls HWCAP_* definitions from <machine/elf.h>
but on powerpc* PPC_FEATURE_* are not pulled from <machine/cpu.h>. Such
behavior is inconsistent with Linux where <sys/auxv.h> pulls <asm/cputable.h>.
Found via multimedia/dav1d.
$ cat a.c
#ifdef __linux__
#define HAVE_GETAUXVAL
#endif
#ifdef __FreeBSD__
#define HAVE_ELF_AUX_INFO
#endif
#if (defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO))
#include <sys/auxv.h>
#define HAVE_AUX
#endif
unsigned dav1d_get_cpu_flags_ppc(void) {
unsigned flags = 0;
#if defined(HAVE_GETAUXVAL)
unsigned long hw_cap = getauxval(AT_HWCAP);
#elif defined(HAVE_ELF_AUX_INFO)
unsigned long hw_cap = 0;
elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap));
#endif
#ifdef HAVE_AUX
flags |= (hw_cap & PPC_FEATURE_HAS_VSX) ? DAV1D_PPC_CPU_FLAG_VSX : 0;
#endif
return flags;
}
$ gcc8 -c a.c
a.c: In function 'dav1d_get_cpu_flags_ppc':
a.c:23:24: error: 'PPC_FEATURE_HAS_VSX' undeclared (first use in this function)
flags |= (hw_cap & PPC_FEATURE_HAS_VSX) ? DAV1D_PPC_CPU_FLAG_VSX : 0;
^~~~~~~~~~~~~~~~~~~
a.c:23:24: note: each undeclared identifier is reported only once for each
function it appears in
a.c:23:47: error: 'DAV1D_PPC_CPU_FLAG_VSX' undeclared (first use in this
function)
flags |= (hw_cap & PPC_FEATURE_HAS_VSX) ? DAV1D_PPC_CPU_FLAG_VSX : 0;
^~~~~~~~~~~~~~~~~~~~~~
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list