Closed Bug 1443400 Opened 7 years ago Closed 7 years ago

lib/freebl/blinit.c:96:10: fatal error: 'sys/auxv.h' file not found

Categories

(NSS :: Libraries, defect, P5)

3.36
ARM
FreeBSD
defect

Tracking

(Not tracked)

RESOLVED FIXED
3.36.1

People

(Reporter: jbeich, Assigned: jbeich)

References

Details

(Keywords: regression)

Attachments

(1 file, 2 obsolete files)

<sys/auxv.h> and getauxval() don't exists on many BSDs. FreeBSD recently implemented AT_HWCAP and AT_HWCAP2 via KERN_PROC_AUXV sysctl (getauxval() isn't ready yet) but only for 32bit ARM, on 64bit ARM (i.e., aarch64) userspace is supposed to read ID registers instead. As NSS doesn't use autoconf it'd probably make ifdefs even more ugly. $ cc -v FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0) Target: aarch64-unknown-freebsd11.1 Thread model: posix InstalledDir: /usr/bin /usr/bin/cc -o FreeBSD11.1_OPT.OBJ/FreeBSD_SINGLE_SHLIB/blinit.o -c -O2 -pipe -I/usr/local/include/nspr -fno-strict-aliasing -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -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.1_OPT.OBJ/include -I./../dist/public/ -I./../dist/private/ -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -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.1_OPT.OBJ/include -I../../dist/public/ -I../../dist/private/ -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -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 -DNSS_USE_64 -DFREEBL_LOWHASH -DHAVE_INT128_SUPPORT -DMP_API_COMPATIBLE -I../../../dist/FreeBSD11.1_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 -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 -DNSS_USE_64 -DFREEBL_LOWHASH -DHAVE_INT128_SUPPORT -DMP_API_COMPATIBLE -I../../../dist/FreeBSD11.1_OPT.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl -Iverified -std=gnu99 blinit.c blinit.c:96:10: fatal error: 'sys/auxv.h' file not found #include <sys/auxv.h> ^~~~~~~~~~~~ 1 error generated. blinit.c:134:9: error: 'HWCAP_NEON' macro redefined [-Werror,-Wmacro-redefined] #define HWCAP_NEON (1 << 12) ^ /usr/include/machine/elf.h:134:9: note: previous definition is here #define HWCAP_NEON 0x00001000 ^ blinit.c:139:9: error: 'HWCAP2_AES' macro redefined [-Werror,-Wmacro-redefined] #define HWCAP2_AES (1 << 0) ^ /usr/include/machine/elf.h:148:9: note: previous definition is here #define HWCAP2_AES 0x00000001 ^ blinit.c:140:9: error: 'HWCAP2_PMULL' macro redefined [-Werror,-Wmacro-redefined] #define HWCAP2_PMULL (1 << 1) ^ /usr/include/machine/elf.h:149:9: note: previous definition is here #define HWCAP2_PMULL 0x00000002 ^ blinit.c:141:9: error: 'HWCAP2_SHA1' macro redefined [-Werror,-Wmacro-redefined] #define HWCAP2_SHA1 (1 << 2) ^ /usr/include/machine/elf.h:150:9: note: previous definition is here #define HWCAP2_SHA1 0x00000004 ^ blinit.c:142:9: error: 'HWCAP2_SHA2' macro redefined [-Werror,-Wmacro-redefined] #define HWCAP2_SHA2 (1 << 3) ^ /usr/include/machine/elf.h:151:9: note: previous definition is here #define HWCAP2_SHA2 0x00000008 ^ 5 errors generated. FreeBSD 11.1 aarch64 - https://clbin.com/WjroU (failed) FreeBSD 11.1 armv6 - https://clbin.com/IcVHP (failed) FreeBSD 12.0 aarch64 - https://clbin.com/VgG14 (succeeded) FreeBSD 12.0 armv6 - https://clbin.com/biLA1 (failed) FreeBSD 12.0 armv7 - https://clbin.com/j7oXG (failed)
Priority: -- → P5
Hmm, even fallback branch is broken: blinit.c:171:42: error: too few arguments to function call, expected 1, have 0 long hwcaps = getauxval(AT_HWCAP2); ~~~~~~~~~ ^ 1 error generated.
Attached patch fix (obsolete) (deleted) — Splinter Review
Not on Phabricator because of MFA shenanigans e.g., losing GitHub login. https://hg.mozilla.org/projects/nss-try/rev/951e8ffc461f2dec43a64ed9ad9877ca2c6fcf18
Assignee: nobody → jbeich
Attachment #8956352 - Flags: review?(franziskuskiefer)
Comment on attachment 8956352 [details] [diff] [review] fix Review of attachment 8956352 [details] [diff] [review]: ----------------------------------------------------------------- Can you fix the clang-format error? Otherwise the patch looks fine.
Attachment #8956352 - Flags: review?(franziskuskiefer)
Comment on attachment 8956352 [details] [diff] [review] fix https://treeherder.mozilla.org/#/jobs?repo=try&revision=64060f14baf1c51c74b7287532c352cb21d8097c (In reply to Franziskus Kiefer [:fkiefer or :franziskus] from comment #4) > Can you fix the clang-format error? Otherwise the patch looks fine. clang-format < 5.0 doesn't digest __has_include. /* clang-format off */ probably is the only option unless someone upgrades clang-format job to use the same version as ASAN job. $ cat a.c #ifndef __has_include #define __has_include(x) 0 #endif int main(void) { #if __has_include(<sys/auxv.h>) return 0; #else return 1; #endif } $ clang-format60 a.c | diff a.c - $ clang-format50 a.c | diff a.c - $ clang-format40 a.c | diff a.c - --- a.c 2018-03-06 00:00:00 +++ - 2018-03-06 00:00:01 @@ -3,7 +3,7 @@ #endif int main(void) { -#if __has_include(<sys/auxv.h>) +#if __has_include(<sys / auxv.h>) return 0; #else return 1; $ clang-format39 a.c | diff a.c - --- a.c 2018-03-06 00:00:00 +++ - 2018-03-06 00:00:01 @@ -3,7 +3,7 @@ #endif int main(void) { -#if __has_include(<sys/auxv.h>) +#if __has_include(<sys / auxv.h>) return 0; #else return 1;
Attached patch fix (obsolete) (deleted) — Splinter Review
Attachment #8956352 - Attachment is obsolete: true
Attachment #8956375 - Flags: review?(franziskuskiefer)
Comment on attachment 8956375 [details] [diff] [review] fix Review of attachment 8956375 [details] [diff] [review]: ----------------------------------------------------------------- Moving to clang-format 5 is too disruptive right now (also because of this bug https://bugs.llvm.org/show_bug.cgi?id=36611). So I guess disabling it here is the best we can do. Having it in the if though is not so nice. How about doing it around the entire pre-processor block (94-107)? And can you make the patch against NSS? Thanks.
Attachment #8956375 - Flags: review?(franziskuskiefer)
Attached patch fix (deleted) — Splinter Review
https://treeherder.mozilla.org/#/jobs?repo=nss-try&revision=08071b7d9df574ddce3e6da08f568104a503c51a (In reply to Franziskus Kiefer [:fkiefer or :franziskus] from comment #7) > How about doing it around the entire pre-processor block (94-107)? Like this? > And can you make the patch against NSS? I don't understand. Is there another NSS repository besides https://hg.mozilla.org/projects/nss/ ? Or do you have an issue with patch format? Previous versions of the patch were already against NSS repo and "hg import" accepts git patches just fine.
Attachment #8956375 - Attachment is obsolete: true
Attachment #8957655 - Flags: review?(franziskuskiefer)
Attachment #8957655 - Flags: review?(franziskuskiefer) → review+
Can you backport to NSS 3.36 branch? Firefox 60 would likely update bundled NSS to 3.36.1 (or later) during ESR cycle.
Flags: needinfo?(franziskuskiefer)
We can pick it up if we do a 3.36.1 release at some point. Not sure if that's going to happen though.
Flags: needinfo?(franziskuskiefer)
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: 3.37 → 3.36.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: