Illegal subtraction in tmp-dive_1.s

Torbjorn Granlund tg at gmplib.org
Fri Apr 17 18:11:31 CEST 2009


Marc Glisse <marc.glisse at normalesup.org> writes:

  Funny, on linux x86_64 with Sun Studio I also got an Illegal
  subtraction, but a different one: the Sun assembler refuses to compute
  differences of symbols in different sections, and
  x86_64/sqr_basecase.asm does just that. Moving "TEXT" before L(jmptab)
  in the 2 places where it occurs fixes it (I know gcc had a similar
  problem with bug 31713, fixed in 2007) and the result passes all
  tests.
  
I have now addressed this Sun assembly bug, the one with
sqr_basecase.asm.

Please do

  hg clone http://gmplib.org:8000/gmp-4.3 [TARGDIR]

for a new copy of the code, or

  cd [TARGDIR]
  hg pull -u http://gmplib.org:8000/gmp-4.3

if you already have a copy of the repository.

Indicendally, this patch also improves performance by a cycle or two per
call.

It is difficult to placate working ELF systems (GNU/Linux, BSD) as well
as broken ones (Solaris using the "commercial grade" system tools) and
the very broken Mac tools.  But the new code seems to work on all of
them.  Does it work for you too?

I suspect that a shared lib might need load time relocs on Macs, which
is somewhat bad.  But the entire Mach-O ABI is really archaic so this is
what to expect.  I think lots and lots of binaries will need load time
relocs on these systems.  If there are some Darwin hackers on this list,
and if you know if there is a better way to do this on Macs, please let
us know.

-- 
Torbjörn


More information about the gmp-discuss mailing list