bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make fnstcw work with emscripten


From: Diomidis Spinellis
Subject: Make fnstcw work with emscripten
Date: Sat, 12 Oct 2019 15:34:49 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

When glibc is compiled with emscripten toolchain for compiling to asm.js and WebAssembly [1] (e.g. as part of groff), the compilation fails due to the inclusion of assembly code, as shown in the example below.

emcc groff.bc -o groff.html
In function vasnprintf()
void (i16*)* asm sideeffect "fnstcw $0", "=*m"
LLVM ERROR: asm() with non-empty content not supported, use EM_ASM() (see emscripten.h)

The following small change corrects this problem.

--- a/lib/fpucw.h  2019-10-12 15:27:25.810899880 +0300
+++ b/lib/fpucw.h 2019-10-12 14:25:30.875463263 +0300
@@ -62,7 +62,7 @@
  */

 /* Inline assembler like this works only with GNU C.  */
-#if (defined __i386__ || defined __x86_64__) && defined __GNUC__
+#if (defined __i386__ || defined __x86_64__) && defined __GNUC__ && !defined __EMSCRIPTEN__

 typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */


[1] https://emscripten.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]