Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2021 12:19:48 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 256903] arm64: ELF auxiliary vectors for armv7 processors miss VFP information
Message-ID:  <bug-256903-7@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 256903
           Summary: arm64: ELF auxiliary vectors for armv7 processors miss
                    VFP information
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: fuz@fuz.su

While trying to run armv7 Go programs in a native armv7 jail on arm64 FreeB=
SD
13.0-RELEASE, I noticed that they refuse to run:

    $ /usr/local/bin/go=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
    runtime: this CPU has no floating point hardware, so it cannot run
    this GOARM=3D7 binary. Recompile using GOARM=3D5.

This error message is produced by src/runtime/os_freebsd_arm.go in the Go
toolchain:

        if goarm > 5 && cpu.HWCap&_HWCAP_VFP =3D=3D 0 {
                print("runtime: this CPU has no floating point hardware, so=
 it
cannot run\n")
                print("this GOARM=3D", goarm, " binary. Recompile using
GOARM=3D5.\n")
                exit(1)
        }

and cpu.HWCap is set from the _AT_HWCAP ELF auxillary vector:

func archauxv(tag, val uintptr) {
        switch tag {
        case _AT_HWCAP:
                cpu.HWCap =3D uint(val)
        case _AT_HWCAP2:
                cpu.HWCap2 =3D uint(val)
        }
}

Checking these vectors with a simple test program shows that they are missi=
ng:

#include <sys/auxv.h>
#include <stdio.h>

int main() {
        unsigned long hwcap, hwcap2;

        if (elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap) !=3D 0) {
                perror("elf_aux_info(AT_HWCAP)");
        }

        if (elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2) !=3D 0) {
                perror("elf_aux_info(AT_HWCAP2)");
        }

        printf("0x%08lx 0x%08lx\n", hwcap, hwcap2);
}

On an ARMv7 machine, this prints 0x001fb8d6 0x00000000 as expected.

However, in a native armv7 jail on an arm64 machine, we instead get

    elf_aux_info(AT_HWCAP): No such file or directory
    elf_aux_info(AT_HWCAP2): No such file or directory
    0x00000000 0x00000000

showing that the auxillary vectors are missing.

Please make sure these auxillary vectors are present when running armv7
binaries on arm64 FreeBSD.

--=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-256903-7>