Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 03 Aug 2019 18:57:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 239621] sys/auxv.h isn't sufficient on powerpc*: PPC_FEATURE_* are not defined
Message-ID:  <bug-239621-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D239621

            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@FreeBSD.org
          Reporter: jbeich@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 =3D 0;
#if defined(HAVE_GETAUXVAL)
    unsigned long hw_cap =3D getauxval(AT_HWCAP);
#elif defined(HAVE_ELF_AUX_INFO)
    unsigned long hw_cap =3D 0;
    elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap));
#endif
#ifdef HAVE_AUX
    flags |=3D (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 funct=
ion)
     flags |=3D (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 |=3D (hw_cap & PPC_FEATURE_HAS_VSX) ? DAV1D_PPC_CPU_FLAG_VSX : 0;
                                               ^~~~~~~~~~~~~~~~~~~~~~

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-239621-227>