Bug 243734

Summary: security/nss: fix build on armv6
Product: Ports & Packages Reporter: Mikael Urankar <mikael>
Component: Individual Port(s)Assignee: freebsd-gecko mailing list <gecko>
Status: Closed FIXED    
Severity: Affects Many People CC: w.schwarzenfeld
Priority: ---    
Version: Latest   
Hardware: arm   
OS: Any   
Attachments:
Description Flags
patch
jbeich: maintainer-approval+
patch
none
patch jbeich: maintainer-approval+

Description Mikael Urankar freebsd_committer 2020-01-30 16:36:19 UTC
Created attachment 211198 [details]
patch

Reported by garga:

After this change it started failing to build on 11.3-STABLE armv6 with
the following error:

/nxb-bin/usr/bin/cc -o
FreeBSD11.3_OPT.OBJ/FreeBSD_SINGLE_SHLIB/gcm-arm32-neon.o -c -std=c99
-O2 -pipe  -I/usr/local/include/nspr -fstack-protector-strong
-fno-strict-aliasing   -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR
-DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments
-Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression
-Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT
-DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT
-DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES
-I./../dist/FreeBSD11.3_OPT.OBJ/include -I./../dist/public/
-I./../dist/private/   -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR
-DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments
-Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression
-Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT
-DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT
-DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES
-I../../dist/FreeBSD11.3_OPT.OBJ/include -I../../dist/public/
-I../../dist/private/   -fPIC -Wall -Wno-switch -DFREEBSD
-DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments
-Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression
-Werror -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\"
-DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\"
-DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT
-DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT
-DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DFREEBL_LOWHASH
-DUSE_HW_AES -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE
-DMP_USE_UINT_DIGIT -DSHA_NO_LONG_LONG  -DKRML_NOUINT128
-DMP_API_COMPATIBLE -I../../../dist/FreeBSD11.3_OPT.OBJ/include
-I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl
-Iverified   -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR
-DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments
-Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression
-Werror -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\"
-DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\"
-DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT
-DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT
-DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DFREEBL_LOWHASH
-DUSE_HW_AES -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE
-DMP_USE_UINT_DIGIT -DSHA_NO_LONG_LONG  -DKRML_NOUINT128
-DMP_API_COMPATIBLE -I../../../dist/FreeBSD11.3_OPT.OBJ/include
-I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl
-Iverified  -mfpu=neon gcm-arm32-neon.c
In file included from gcm-arm32-neon.c:16:
/nxb-bin/usr/lib/clang/8.0.1/include/arm_neon.h:28:2: error: "NEON
support not enabled"
#error "NEON support not enabled"

reported upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=1612177
Comment 1 Jan Beich freebsd_committer 2020-02-01 09:14:28 UTC
Comment on attachment 211198 [details]
patch

Looks OK. FreeBSD armv7 implicitly uses -march=armv7-a but Clang doesn't distinguish between -march=armv7 and -march=armv7-a, so if GCC ends up using Thumb state (e.g., on Linux) it's out of scope.

    $ gcc9 -dM -E -mfpu=neon -</dev/null >default.neon.gcc9
    $ gcc9 -dM -E -march=armv7 -mfpu=neon -</dev/null >armv7.neon.gcc9
    $ diff -u default.neon.gcc9 armv7.neon.gcc9
    --- default.neon.gcc9
    +++ armv7.neon.gcc9
    @@ -23,14 +23,12 @@
     #define __USFRACT_FBIT__ 8
     #define __ORDER_LITTLE_ENDIAN__ 1234
     #define __SIZE_MAX__ 0xffffffffU
    -#define __ARM_ARCH_ISA_ARM 1
     #define __WCHAR_MAX__ 0xffffffffU
     #define __LACCUM_IBIT__ 32
     #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
     #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
     #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
     #define __DBL_DENORM_MIN__ ((double)4.9406564584124654e-324L)
    -#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
     #define __GCC_ATOMIC_CHAR_LOCK_FREE 2
     #define __GCC_IEC_559 2
     #define __FLT32X_DECIMAL_DIG__ 17
    @@ -61,6 +59,7 @@
     #define __SHRT_MAX__ 0x7fff
     #define __LDBL_MAX__ 1.7976931348623157e+308L
     #define __FRACT_MAX__ 0X7FFFP-15R
    +#define __thumb2__ 1
     #define __UFRACT_FBIT__ 16
     #define __ARM_FP 12
     #define __UFRACT_MIN__ 0.0UR
    @@ -76,6 +75,7 @@
     #define __TA_IBIT__ 64
     #define __LDBL_MAX_EXP__ 1024
     #define __WINT_MIN__ (-__WINT_MAX__ - 1)
    +#define __ARM_ASM_SYNTAX_UNIFIED__ 1
     #define __INT_LEAST16_WIDTH__ 16
     #define __ULLFRACT_MIN__ 0.0ULLR
     #define __SCHAR_MAX__ 0x7f
    @@ -146,7 +146,7 @@
     #define __FLT32X_HAS_DENORM__ 1
     #define __INT_FAST16_TYPE__ int
     #define __LDBL_HAS_DENORM__ 1
    -#define __ARM_FEATURE_LDREX 15
    +#define __ARM_FEATURE_LDREX 7
     #define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
     #define __INT_LEAST32_MAX__ 0x7fffffff
     #define __DEC32_MIN__ 1E-95DF
    @@ -229,12 +229,12 @@
     #define __UINT64_MAX__ 0xffffffffffffffffULL
     #define __UDQ_FBIT__ 64
     #define __INT8_TYPE__ signed char
    +#define __thumb__ 1
     #define __ELF__ 1
     #define __ULFRACT_EPSILON__ 0x1P-32ULR
     #define __LLFRACT_FBIT__ 63
     #define __FLT_RADIX__ 2
     #define __INT_LEAST16_TYPE__ short int
    -#define __ARM_ARCH_PROFILE 65
     #define __LDBL_EPSILON__ 2.2204460492503131e-16L
     #define __UINTMAX_C(c) c ## ULL
     #define __FreeBSD__ 12
    @@ -302,6 +302,7 @@
     #define __UINT16_TYPE__ short unsigned int
     #define __WCHAR_TYPE__ unsigned int
     #define __SIZEOF_FLOAT__ 4
    +#define __THUMBEL__ 1
     #define __USQ_FBIT__ 32
     #define __UINTPTR_MAX__ 0xffffffffU
     #define __INT_FAST64_WIDTH__ 64
    @@ -336,11 +337,9 @@
     #define __INT_LEAST8_MAX__ 0x7f
     #define __FLT32X_MAX_10_EXP__ 308
     #define __LFRACT_FBIT__ 31
    -#define __ARM_ARCH_7A__ 1
     #define __LDBL_MAX_10_EXP__ 308
     #define __ATOMIC_RELAXED 0
     #define __DBL_EPSILON__ ((double)2.2204460492503131e-16L)
    -#define __ARM_FEATURE_SIMD32 1
     #define __UINT8_C(c) c
     #define __FLT64_MAX_EXP__ 1024
     #define __INT_LEAST32_TYPE__ int
    @@ -385,6 +384,7 @@
     #define __INTMAX_TYPE__ long long int
     #define __DEC128_MAX_EXP__ 6145
     #define __FLT32X_HAS_QUIET_NAN__ 1
    +#define __ARM_ARCH_7__ 1
     #define __ATOMIC_CONSUME 1
     #define __GNUC_MINOR__ 2
     #define __INT_FAST16_WIDTH__ 32
    @@ -411,7 +411,7 @@
     #define __SIZEOF_LONG_LONG__ 8
     #define __ULACCUM_EPSILON__ 0x1P-32ULK
     #define __SACCUM_IBIT__ 8
    -#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
    +#define __GCC_ATOMIC_LLONG_LOCK_FREE 1
     #define __FLT32X_MIN__ 2.2250738585072014e-308F32x
     #define __LDBL_DIG__ 15
     #define __FLT_DECIMAL_DIG__ 9
    @@ -422,7 +422,6 @@
     #define __UINT_FAST8_TYPE__ unsigned int
     #define __USFRACT_EPSILON__ 0x1P-8UHR
     #define __ULACCUM_FBIT__ 32
    -#define __ARM_FEATURE_DSP 1
     #define __QQ_IBIT__ 0
     #define __ATOMIC_ACQ_REL 4
     #define __ATOMIC_RELEASE 3


Can you move the patch into files/patch-bug1612177 to facilitate pruning on update?
Comment 2 Mikael Urankar freebsd_committer 2020-02-01 09:36:34 UTC
Created attachment 211239 [details]
patch

rename file and change armv7 to armv7-a
Comment 3 Jan Beich freebsd_committer 2020-02-01 10:00:33 UTC
Comment on attachment 211239 [details]
patch

Doesn't apply.

$ patch -Efsp0 -i /path/to/security_nss.patch
No file to patch.  Skipping...
2 out of 2 hunks ignored--saving rejects to security/nss/files/patch-bug1612177.rej
Comment 4 Mikael Urankar freebsd_committer 2020-02-01 10:14:09 UTC
Created attachment 211243 [details]
patch
Comment 5 commit-hook freebsd_committer 2020-02-13 00:44:00 UTC
A commit references this bug:

Author: jbeich
Date: Thu Feb 13 00:43:17 UTC 2020
New revision: 525988
URL: https://svnweb.freebsd.org/changeset/ports/525988

Log:
  security/nss: unbreak on armv6 after r524147

  In file included from ../../lib/freebl/gcm-arm32-neon.c:16:
  /usr/lib/clang/8.0.1/include/arm_neon.h:28:2: error: "NEON support not enabled"
   #error "NEON support not enabled"
    ^

  PR:		243734
  Reported by:	garga
  Submitted by:	mikael

Changes:
  head/security/nss/files/patch-bug1612177
Comment 6 commit-hook freebsd_committer 2020-02-13 00:45:05 UTC
A commit references this bug:

Author: jbeich
Date: Thu Feb 13 00:44:02 UTC 2020
New revision: 525995
URL: https://svnweb.freebsd.org/changeset/ports/525995

Log:
  MFH: r525988

  security/nss: unbreak on armv6 after r524147

  In file included from ../../lib/freebl/gcm-arm32-neon.c:16:
  /usr/lib/clang/8.0.1/include/arm_neon.h:28:2: error: "NEON support not enabled"
   #error "NEON support not enabled"
    ^

  PR:		243734
  Reported by:	garga
  Submitted by:	mikael
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2020Q1/
  branches/2020Q1/security/nss/files/patch-bug1612177