[clang-cl] missing _xgetbv() during link
Building with clang-cl v5.0.1, causes this link-error:
x86-common.obj : error LNK2019: unresolved external symbol __xgetbv referenced in function _register_x86_crypto
After a bit of searching through clang's <intrin.h>
, I figured the call to _xgetbv()
can simply be written in GAS inline assembly.
Hence, this fixed my link-problem:
--- a/accelerated/x86/x86-common.c 2017-09-04 11:07:50
+++ b/accelerated/x86/x86-common.c 2018-01-25 16:15:28
@@ -99,7 +99,7 @@
if ((ecx & OSXSAVE_MASK) != OSXSAVE_MASK)
return 0;
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
xcr0 = _xgetbv(0);
#else
__asm__ ("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx");