PowerPC compilation flags

Segher Boessenkool segher@kernel.crashing.org
Mon Nov 26 00:35:00 GMT 2018


On Sun, Nov 25, 2018 at 06:41:23PM -0500, Felipe GM wrote:
> Em 2018-11-25 6:23 p.m., Segher Boessenkool escreveu:
> >*Your CPU has hardware support for single precision only. You get the 
> >soft float support for double precision (like that __divdf3, yes -- 
> >anything "df"). This is what -mfloat-gprs=single does :-)*
> That is bugging me badly. I am not trying to use double float at any 
> point. Still, I am getting complaints about the linker trying to use 
> them. Any clue why? That is the reason I was (am) trying to use 
> -mfloat-gprs=double.

You may have written something like

  float x = ...;
  x /= 10.0;

which does the calculation as *double*.  You need to write

  x /= 10.0f;

if you want a single-precision division.

Similar for the other unexpected functions.

There is a warning to help you find these: -Wdouble-promotion .

> >*You always should link libgcc. This is the default if you link using 
> >gcc, but your custom linker scripts may have other plans ;-)*
> libcc is not an option, sadly. I have a very restrict (and in need of 
> certification for compliance) application, so extra resources 
> (libraries) are not possible.

All code compiled with GCC always has to be linked with libgcc.  This
library is required.  GCC can (and will, as you saw) generate calls to it
for various constructs that the target port did not implement directly, or
that are best implemented as a function (__divdf3 is more than 1800 bytes
for example, you do not want to inline that everywhere).


Segher



More information about the Gcc-help mailing list