gcd_11 asm

Torbjörn Granlund tg at gmplib.org
Fri Aug 23 13:18:34 UTC 2019


"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

  One question about PIC/PLT and the gcd_22 to gcd_11 tail-call.

3 questions, actually...

  Is it safe to tail-call (jump to, in asm) another function that may not
  have the same return type?

A private call can have any private ABI.

  I mean, is it possible, for a program dynamically-linked to the library,
  to force the usage of another gcd_11 function returning its result in %rax
  as expected but not taking care of %rdx?
  I mean: such a gcd_11 function would be completely valid...

Dynamically or statically linked, yes, gcc_11 can be overriden.

  Can the tail-call be forced as internal to the library? Or maybe it is so,
  by default...

The "hidden" attribute could take care of a dynamic library.  For
static, I am not aware of anything which could help.

I'd say this is a very generic problem.  Our fine library will mishave
too if somebody overrode mpn_mul_basecase with something incompatible.
:-)

(I'm not 100% happy with our private ABI between _22 and _11, but for
now it will serve its purpose well enough, I think.)

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list