Bug: GMP 4.2.1 will not build as x86 fat binary

Torbjorn Granlund tege at swox.com
Tue May 16 11:43:47 CEST 2006

A non-text attachment was scrubbed...
Name: foo
Type: application/octet-stream
Size: 3865 bytes
Desc: not available
Url : http://gmplib.org/list-archives/gmp-bugs/attachments/20060516/67d258d5/foo.obj
-------------- next part --------------

<librik at panix.com> writes:

  GMP 4.2.1 will not build as an x86 fat binary.  It is missing the
  functions mpn_add_nc and mpn_sub_nc, which mpn/generic/addsub_n.c
  The "fat mpn" mechanism does not make mpn_add_nc() and mpn_sub_nc()
  available, although mpn_add_n() and mpn_sub_n() are provided.
  (Each of the CPU-specific *_add_n.asm/*_sub_n.asm files does provide
  its own version of mpn_add_nc and mpn_sub_nc, but the fat.c system
  doesn't pick them up and use them to make a "master" mpn_add_nc or
  mpn_sub_nc.  They're not in the CPUVEC.  I don't know why not.)
Me neither.
  When a "fat binary" is built, almost none of the HAVE_NATIVE macros
  are defined in config.h:
  /* Define to 1 each of the following for which a native (ie. CPU specific)
      implementation of the corresponding routine exists.  */
  /* #undef HAVE_NATIVE_mpn_add_n */
  /* #undef HAVE_NATIVE_mpn_add_nc */
  .... etc. etc. ...
I suppose this ought to be fixed, but it seems difficult to ix it.
Maybe you're the right person to look into it?

For a fat build, one can only define HAVE_NATIVE_X if X is defined for
every identifiable processor, of course.

  (1) Add mpn_add_nc and mpn_sub_nc to the list of functions made
      available by fat.c.  This means adding it to the CPUVEC.
      (I think this is the right thing to do, because why should a
      GMP operation available in every x86 CPU-specific binary not
      be available in the x86 "fat binary"?)
      However, this requires changes in fat.c, x86-defs.m4, and
      something complicated inside configure.  It's a bit beyond
      my expertise, unfortunately.
Supposedly, one just needs to add add_nc whereever add_n is mentioned.

  (2) Rewrite addsub_n.c so it uses mpn_add_n() and mpn_sub_n()
      exclusively, not relying on mpn_add_nc() or mpn_sub_nc().
As per the patch above.


More information about the gmp-bugs mailing list