CPU detection, -mcpu and -force_cpusubtype_ALL under Darwin/ppc

Vincent Lefevre vincent at vinc17.org
Tue Mar 3 15:59:45 CET 2009

GMP 4.2.4 uses both -mcpu=<arch> and -force_cpusubtype_ALL (at least
in the 32-bit ABI), but -force_cpusubtype_ALL overrides -mcpu, so I'm
wondering... Apple's gcc man page says:

  The subtype of the file created (like ppc7400 or ppc970 or i686) is
  determined by the flags that specify the ISA that GCC is targetting,
  like -mcpu or -march.  The -force_cpusubtype_ALL option can be used
  to override this.


    This causes GCC's output file to have the ALL subtype, instead of
    one controlled by the -mcpu or -march option.

If GMP uses specific asm instructions for the native processor, this
might lead to subtle bugs when the binaries are used on a different
computer (still with a PowerPC, but with a CPU that does not accept
such specific instructions), as the object file is declared to have
ALL cpusubtype. Unfortunately I can't test.

IMHO, subtype CPU detection should be disabled when -force_cpusubtype_ALL
is used.

Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

More information about the gmp-discuss mailing list