Re: armhf: illegal hardware instruction

John Reiser <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <[email protected]>
> Program received signal SIGILL, Illegal instruction.
> vgPlain_am_startup (sp_at_startup=3204445696) at
> m_aspacemgr/aspacemgr-linux.c:1626
> 1626       init_nsegment(&seg);
> (gdb) x/i $pc
> => 0x58071090 <vgPlain_am_startup+20>:  vmov.i32        d16, #0 ; 0x00000000

> As a reminder I do not have neon on this machine:
> 
> Features        : half thumb fastmult vfp edsp thumbee vfpv3 tls idiva
> idivt vfpd32 lpae

Therefore this is a gcc configuration problem.  Whoever configured the gcc
that was used to compile your valgrind assumed that neon would be present,
but your machine lacks neon.

Run "gcc --verbose".  On my RaspberryPi Model 2B I get (wrapped by hand
to reasonable line length):
-----
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/10/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' \
   --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs \
   --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr \
   --with-gcc-major-version-only --program-suffix=-10 --program-prefix=arm-linux-gnueabihf- \
   --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext \
   --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu \
   --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new \
   --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support \
   --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release \
   --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions \
   --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror \
   --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf \
   --target=arm-linux-gnueabihf
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20210110 (Debian 10.2.1-6)
-----
where the important part now is "--with-arch=armv7-a --with-fpu=vfpv3-d16"
for which the "-d16" part restricts gcc to 16 double precision registers
even though my hardware has "vfpd32".

Consulting "info gcc", then searching for "neon", and examining "ARM Options",
it seems to me that the fix for gcc to assume vfp3 floating point with 32 double-
precision registers and the half-precision floating-point conversion operations,
but omit neon, is the gcc command-line parameter "-march=armv7-a+vfpv3-fp16+nosimd".
You may want to use "-d16" somewhere, too.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.