does this fail same way on real machine as well? <br><br>On Monday, September 23, 2013, Hongxu Jia &lt;<a href="mailto:hongxu.jia@windriver.com">hongxu.jia@windriver.com</a>&gt; wrote:<br>&gt; On 09/23/2013 04:55 PM, Hongxu Jia wrote:<br>
&gt;&gt;<br>&gt;&gt; *Preparation<br>&gt;&gt; 1, vim local.conf<br>&gt;&gt; ...<br>&gt;&gt; DISTRO ?= &quot;poky-lsb&quot;<br>&gt;&gt; MACHINE ?= &quot;qemux86-64&quot;<br>&gt;&gt; ...<br>&gt;&gt;<br>&gt;&gt; *Problem<br>
&gt;&gt; 1, Build core-image-lsb<br>&gt;&gt; ..<br>&gt;&gt; bitbake core-image-lsb<br>&gt;&gt; ..<br>&gt;&gt;<br>&gt;&gt; 2, Start qemux86-64, there are 21 LSB tcl test failures on<br>&gt;&gt; qemux86-64, you could reproduce it by tcl interpreter:<br>
&gt;&gt;    1, On qemux86-64&#39;s terminal, start tcl interpreter<br>&gt;&gt;    root@qemux86-64:~# $ tclsh<br>&gt;&gt;    %<br>&gt;&gt;<br>&gt;&gt;    2, Run &#39;binary scan&#39; to assign ieeeValues(-Subnormal)<br>&gt;&gt;    % binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d ieeeValues(-Subnormal)<br>
&gt;&gt;    1<br>&gt;&gt;<br>&gt;&gt;    3, Run &#39;puts&#39; to output ieeeValues(-Subnormal), the result is &#39;0.0&#39;<br>&gt;&gt;    % puts $ieeeValues(-Subnormal)<br>&gt;&gt;    -0.0<br>&gt;&gt;<br>&gt;&gt;    Expected:<br>
&gt;&gt;    -1.1125369292536007e-308<br>&gt;&gt;<br>&gt;&gt; *Analysis<br>&gt;&gt; 1, On the previous environment, add IMAGE_INSTALL_append = &quot; tcl&quot; to<br>&gt;&gt; local.conf and build core-image-sato, the result is expected.<br>
&gt;&gt;<br>&gt;&gt; 2, Trace tcl&#39;s source code, you could also reproduce the issue by<br>&gt;&gt; compiling and executing the following C codes on core-image-lsb-sdk.<br>&gt;&gt;<br>&gt;&gt;    1) Build core-image-lsb-sdk, and Run qemux86-64.<br>
&gt;&gt;    2) On target&#39;s terminal, create a C source file:<br>&gt;&gt;       root@qemux86-64:~# cat &gt;&gt; test.c &lt;&lt; EOF<br>&gt;&gt; #include &lt;stdio.h&gt;<br>&gt;&gt;<br>&gt;&gt; int main(int argc, char *argv[])<br>
&gt;&gt; {<br>&gt;&gt;    double dd = 0;<br>&gt;&gt;    char *p = (char*)&amp;dd;<br>&gt;&gt;    p[0] = 0x00;<br>&gt;&gt;    p[1] = 0x00;<br>&gt;&gt;    p[2] = 0x00;<br>&gt;&gt;    p[3] = 0x00;<br>&gt;&gt;    p[4] = 0x00;<br>
&gt;&gt;    p[5] = 0x00;<br>&gt;&gt;    p[6] = 0x08;<br>&gt;&gt;    p[7] = 0x00;<br>&gt;&gt;<br>&gt;&gt;    if (dd == 0.0)<br>&gt;&gt;      printf(&quot;Incorrect equal 0.0\n&quot;);<br>&gt;&gt;    else<br>&gt;&gt;      printf(&quot;Expected not equal 0.0\n&quot;);<br>
&gt;&gt;<br>&gt;&gt;    return 0;<br>&gt;&gt; }<br>&gt;&gt; EOF<br>&gt;&gt;<br>&gt;&gt;    2) Compile test.c<br>&gt;&gt;      root@qemux86-64:~# gcc test.c -o test<br>&gt;&gt;<br>&gt;&gt;    3, Execute test<br>&gt;&gt;    $ root@qemux86-64:~# ./test<br>
&gt;&gt;      Incorrect equal 0.0<br>&gt;&gt;<br>&gt;&gt;    Expected:<br>&gt;&gt;      Expected not equal 0.0<br>&gt;&gt;<br>&gt;&gt; 3, It&#39;s about x86-64&#39;s FPU: the SSE MXCSR register.<br>&gt;&gt;    If you invoke &#39;feenableexcept(FE_INEXACT);&#39; or<br>
&gt;&gt;    &#39;feclearexcept(FE_INEXACT);&#39; in the above C test,<br>&gt;&gt;    the issue will be fixed. In these two functions,<br>&gt;&gt;    the SSE MXCSR register has been handled.<br>&gt;<br>&gt; vim eglibc-2.18/libc/sysdeps/x86_64/fpu/feenablxcpt.c<br>
&gt; ...<br>&gt; #include &lt;fenv.h&gt;<br>&gt;<br>&gt; int<br>&gt; feenableexcept (int excepts)<br>&gt; {<br>&gt;   unsigned short int new_exc, old_exc;<br>&gt;   unsigned int new;<br>&gt;<br>&gt;   excepts &amp;= FE_ALL_EXCEPT;<br>
&gt;<br>&gt;   /* Get the current control word of the x87 FPU.  */<br>&gt;   __asm__ (&quot;fstcw %0&quot; : &quot;=m&quot; (*&amp;new_exc));<br>&gt;<br>&gt;   old_exc = (~new_exc) &amp; FE_ALL_EXCEPT;<br>&gt;<br>&gt;   new_exc &amp;= ~excepts;<br>
&gt;   __asm__ (&quot;fldcw %0&quot; : : &quot;m&quot; (*&amp;new_exc));<br>&gt;<br>&gt;   /* And now the same for the SSE MXCSR register.  */<br>&gt;   __asm__ (&quot;stmxcsr %0&quot; : &quot;=m&quot; (*&amp;new));<br>&gt;<br>
&gt;   /* The SSE exception masks are shifted by 7 bits.  */<br>&gt;   new &amp;= ~(excepts &lt;&lt; 7);<br>&gt;   __asm__ (&quot;ldmxcsr %0&quot; : : &quot;m&quot; (*&amp;new));<br>&gt;<br>&gt;   return old_exc;<br>&gt; }<br>
&gt; ...<br>&gt;<br>&gt; //Hongxu<br>&gt;<br>&gt;&gt; *Solution<br>&gt;&gt; Is it necessary to invoke &#39;feenableexcept(FE_INEXACT);&#39; or<br>&gt;&gt; &#39;feclearexcept(FE_INEXACT);&#39; to handle SSE MXCSR register?<br>
&gt;&gt;<br>&gt;&gt; Or any good idea about this issue.<br>&gt;&gt;<br>&gt;&gt; Thanks,<br>&gt;&gt; Hongxu<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br>&gt; _______________________________________________<br>
&gt; Openembedded-core mailing list<br>&gt; <a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a><br>&gt; <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
&gt;