[gnutls-devel] GnuTLS | no such instruction: `xgetbv' when compiling for macOS (#914)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Fri Jan 24 10:15:40 CET 2020




Pierre Ossman (Work account) commented:


Suggested patch:

```diff
diff -up gnutls-3.6.10/lib/accelerated/x86/x86-common.c.xgetbv gnutls-3.6.10/lib/accelerated/x86/x86-common.c
--- gnutls-3.6.10/lib/accelerated/x86/x86-common.c.xgetbv	2020-01-24 10:06:30.782100264 +0100
+++ gnutls-3.6.10/lib/accelerated/x86/x86-common.c	2020-01-24 10:08:04.851463216 +0100
@@ -151,7 +151,9 @@ static unsigned check_4th_gen_intel_feat
 #if defined(_MSC_VER) && !defined(__clang__)
 	xcr0 = _xgetbv(0);
 #else
-	__asm__ ("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx");
+	// Apple's assembler doesn't support xgetbv:
+	// __asm__ ("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx");
+	__asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (xcr0) : "c" (0) : "%edx");
 #endif
 	/* Check if xmm and ymm state are enabled in XCR0. */
 	return (xcr0 & 6) == 6;
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/issues/914#note_276350680
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20200124/f83ab5c1/attachment.html>


More information about the Gnutls-devel mailing list