Amd64 relocation R_X86_64_32S in a static lib

Niels Möller nisse at
Tue Nov 5 15:39:35 CET 2013

Torbjorn Granlund <tg at> writes:

> Now we have (at least) two OpenBSD ABIs for AMD64, pre 5.3 and now 5.3,
> 5.4.  To make sense of things, I would not be surprised to see
> R_X86_64_64 banned from 5.5 and on, creating a 3rd OpenBSD AMD64 ABI.

I don't understand the fine details of which reloc types make sense in
pic code, but if I understand Philip correctly, the main problem is not
a ABI change, but changed compiler default. And then you get link errors
when linking together pic objects created by the compiler, with non-pic
objects created from the gmp assembly files.

I think you'd get similar problems as if a user configures gmp with,
e.g., --disable-shared CFLAGS=-fpic. Do you agree with this analysis?

To figure out if an invocation $(CC) $(CFLAGS) generates pic code or
not, one needs a configure test like

  #if __PIC__
  bla bla

Using the result of that test when deciding whether or not assembly
files should use pic mode should give the correct behavior, both with
compilers doing pic by default, and users enabling it explicitly.


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list