Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use gcc and -msoft-float on an i386/x86-64?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1018638/using-software-floating-point-on-x86-linux">Using software floating point on x86 linux</a> </p> </blockquote> <p>Just for educational reasons I'd like to compile some programmes using the <code>-msoft-float</code> option of <code>gcc</code>, i.e. doing floating point arithmetic without using the x87/sse fpu unit. Take a simple example:</p> <pre><code>#include &lt;cstdio&gt; int main(int argc, char** argv) { double x=3.14; double y=2.71; double z=x+y; printf("z=%f\n",z); return 0; } </code></pre> <p>Compile with either (need to disable sse otherwise <code>-msoft-float</code> has no effect)</p> <pre><code>g++ -msoft-float -mfpmath=387 float.cpp g++ -msoft-float -m32 float.cpp </code></pre> <p>and I get</p> <pre><code>float.cpp:(.text+0x36): undefined reference to `__adddf3' </code></pre> <p>Now the man page warns me that I might need to provide my own soft-float library. However, since I'm not doing cross-compilation, does this still apply?</p> <pre><code> -msoft-float Generate output containing library calls for floating point. Warning: the requisite libraries are not part of GCC. Normally the facilities of the machine's usual C compiler are used, but this can't be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross- compilation. </code></pre> <p>I checked <code>libgcc_s.so</code> as well as other libraries and <code>__adddf3</code> is indeed nowhere to be found. I also looked into the <code>gcc-4.6.2</code> source code and there's a directory <code>./gcc/config/soft-fp/</code> with all the soft-float routines, but I failed to compile them by hand.</p> <p>So is there a way to just compile a soft-float library (or do I have to compile a whole new gcc) or have I overseen something more simple?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload