cassemblyopensslboringssl

Building boringSSL x64 on Windows


While building BoringSSL on windows, the x32 build works just fine. But the x64 (adding -m64 to c & cxx flags in cmake) I get a link error, two symbols are missing: fiat_p256_adx_sqr and fiat_p256_adx_mul.

ld.lld: error: undefined symbol: fiat_p256_adx_sqr
>>>               libcrypto.a(bcm.c.obj):(fiat_p256_square)
ld.lld: error: undefined symbol: fiat_p256_adx_mul
>>>               libcrypto.a(bcm.c.obj):(fiat_p256_mul)

I read through the code and I found this:

#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86_64) && defined(__APPLE__) || defined(__ELF__))
...
#endif

both missing symbols are defined inside checks for __APPLE__ or __ELF__ That means they won't be compiled (or assembled since it's a .S file) for windows. Am I missing something or is boringSSL no supported on windows without -DOPENSSL_NO_ASM?

Links: fiat_p256_adx_mul.S fiat_p256_adx_sqr.S


Solution

  • As mentioned by @agl over here. You need to apply this change "&& !defined(OPENSSL_WINDOWS)" to every instance where the compound condition "!defined(OPENSSL_NO_ASM) && defined(GNUC) && defined(x86_64)" causes a compiler error.