Undefined symbols for architecture x86_64 on OS X with fat library

It looks to be a bug in the code generator for x64 in the static library case.

The easiest, non patch openssl change workaround is to add a reference to OPENSSL_cleanse somewhere in your code, even if it's not used. That will fix up the link-time reference.

What's actually happening is that the symbol is being referenced in some assembly code.

The assembly code simply says that _OPENSSL_ia32cap_P is an extern symbol, without making the cross-link to state that it needs to be linked in. This works for libcrypto.dylib because the reference is resolved when generating the .dylib file; however the reference is never resolved in the .a case because the only code that actually contains the symbol is x86_64cpuid.o, which only gets linked in if you use any of the routines provided by that .o.

Symbols in this file includes OPENSSL_cleanse, so if you reference this routine, the link works.