Closed Bug 1662833 Opened 4 years ago Closed 4 years ago

nss fails to build with clang on aarch64

Categories

(NSS :: Build, defect)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1659256

People

(Reporter: mikael.urankar, Unassigned)

References

(Regression)

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:79.0) Gecko/20100101 Firefox/79.0

Steps to reproduce:

On FreeBSD aarch64:
make -C /usr/ports/security/nss
/usr/ports/security/nss/work/nss-3.56/nss/cmd/shlibsign/../../../dist/FreeBSD13.0_OPT.OBJ/lib/libfreeblpriv3.so: Undefined symbol "gcm_HashInit_hw"
C_Initialize failed: 0x00000030, CKR_DEVICE_ERROR
NSPR error code: -5977: Failure to load dynamic library
Initiailzing softoken failed: 0x00000030, CKR_DEVICE_ERROR
NSPR error code: -5977: Failure to load dynamic library

FreeBSD clang version 11.0.0 (git@github.com:llvm/llvm-project.git llvmorg-11.0.0-rc2-0-g414f32a9e86)

regressed with https://github.com/nss-dev/nss/commit/189d45b71fc004d8737e000987038fe1ffa857b4

In the commit log, I don't understand what is a 'GCC aarch64 code', can someone explain ?
clang can build these files just fine, it shouldn't be limited to GCC: aes-armv8.c gcm-aarch64.c sha256-armv8.c

downstream bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249053

Keywords: regression
Regressed by: 1652032
Has Regression Range: --- → yes

(In reply to Mikael Urankar from comment #0)

regressed with https://github.com/nss-dev/nss/commit/189d45b71fc004d8737e000987038fe1ffa857b4

In the commit log, I don't understand what is a 'GCC aarch64 code', can someone explain ?
clang can build these files just fine, it shouldn't be limited to GCC: aes-armv8.c gcm-aarch64.c sha256-armv8.c

I'm building / cross-compiling NSS on Windows Arm64 using MSVC (as aarch64-pc-cygwin), which doesn't understand the gcc inline assembler.

The regressed patch uses NS_USE_GCC, but that seems to exclude clang, which I didn't test. There is also CC_IS_CLANG and CC_IS_GCC. In theory a mingw aarch64 compiler would also work with these files, so filtering based on OS_TARGET seems to be wrong too.

Maybe

-ifdef NS_USE_GCC
+if defined NS_USE_GCC || defined CC_IS_GCC || defined CC_IS_CLANG 

should be used instead? I would like to filter MSVC as a not-supported compiler, but I couldn't find anything in coreconf/WIN32.mk to use instead.

Any better suggestion?

Interestingly the Makefile also has the following code in the arm section, just a few lines below:

    ifdef CC_IS_CLANG
        ....
    else ifeq (1,$(CC_IS_GCC))

… once it checks ifdef, the other checks ifeq

in nss/coreconf/Werror.mk
ifdef CC_IS_CLANG

Clang claims GCC 4.2.1 compatibility, see GCC_VERSION

CC_IS_GCC = 1

Replacing NS_USE_GCC with CC_IS_GCC works on FreeBSD/aarch64 (I have no way to test on linux/windows)

There is also bug 1659256, which has basically a more complex version of the tested change attached, and should also fix this bug. Would be nice, if you can test this too.

(In reply to Jan-Marek Glogowski from comment #3)

There is also bug 1659256, which has basically a more complex version of the tested change attached, and should also fix this bug. Would be nice, if you can test this too.

Yes, that fixes the problem on FreeBSD aarch64, thanks for the pointer.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.