Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2024 00:48:00 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        " gecko@freebsd.org" <gecko@FreeBSD.org>, FreeBSD ARM List <freebsd-arm@freebsd.org>, FreeBSD Mailing List <freebsd-ports@freebsd.org>
Cc:        Tomoaki AOKI <junchoon@dec.sakura.ne.jp>, Brooks Davis <brooks@FreeBSD.org>
Subject:   security/nss targeting armv7 tries to compile armv8-a source code: nss/lib/freebl/aes-armv8.c
Message-ID:  <4C7FBDDC-35E8-46E2-A424-58F5779199F8@yahoo.com>
References:  <4C7FBDDC-35E8-46E2-A424-58F5779199F8.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
nss/lib/freebl/Makefile has:

ifeq ($(CPU_ARCH),arm)
$(OBJDIR)/$(PROG_PREFIX)aes-armv8$(OBJ_SUFFIX): CFLAGS +=3D =
-march=3Darmv8-a -mfpu=3Dcrypto-neon-fp-armv8
$(OBJDIR)/$(PROG_PREFIX)gcm-arm32-neon$(OBJ_SUFFIX): CFLAGS +=3D =
-mfpu=3Dneon
endif

but targeting -mcpu=3Dcortex-a7 (an armv7) results in the likes of:

cc -o FreeBSD15.0_OPT.OBJ/FreeBSD_SINGLE_SHLIB/aes-armv8.o -c -std=3Dc99 =
-O2 -gline-tables-only -pipe -mcpu=3Dcortex-a7  . . . .  -march=3Darmv8-a =
-mfpu=3Dcrypto-neon-fp-armv8 aes-armv8.c
cc: warning: ignoring extension 'sha2' because the 'armv7-a' =
architecture does not support it [-Winvalid-command-line-argument]
cc: warning: ignoring extension 'aes' because the 'armv7-a' architecture =
does not support it [-Winvalid-command-line-argument]
aes-armv8.c:14:2: error: "Compiler option is invalid"
   14 | #error "Compiler option is invalid"
      |  ^

from nss/lib/freebl/aes-armv8.c:

. . .
#include "secerr.h"
#include "rijndael.h"

#if ((defined(__clang__) ||                                         \
      (defined(__GNUC__) && defined(__GNUC_MINOR__) &&              \
       (__GNUC__ > 4 || (__GNUC__ =3D=3D 4 && __GNUC_MINOR__ > 8)))) && =
\
     defined(IS_LITTLE_ENDIAN))

#ifndef __ARM_FEATURE_CRYPTO
#error "Compiler option is invalid"
#endif

#include <arm_neon.h>
. . .

(The example happens to be for 3.103 .)

Seems odd to me to have armv7 targeting have any dependency on
armv8 encoded instructions that from well after armv7 was
defined. (Even if the goal is to have the processor reject the
instructions.)


Note: I ran into this trying to see if I could build www/firefox
in a armv7 jail on a aarch64 that supports armv7 code. BE_WASM
for llvm*'s may be a waste of resources if armv7 based builds
are just not going to work. (I do not normally build firefox.)

=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C7FBDDC-35E8-46E2-A424-58F5779199F8>