On Sunday, June 6, 2021 at 6:52:44 AM UTC-7, Steve Lionel wrote:
> On 6/6/2021 9:05 AM, Dieter Britz wrote:
(snip)
> > ./findI0.out: Symbol `free' causes overflow in R_X86_64_PC32 relocation
> > ./findI0.out: Symbol `free' causes overflow in R_X86_64_PC32 relocation
> > The program does not use these symbols. What is this telling me?
> You may not use these symbols, but the Fortran language support library
> does, as might some other library you are linking to. The message is
> telling you that the executable loader is unable to resolve an address
> reference in a compiled library. Some web searches I find recommend
> making sure that any static libraries are compiled with -fpic. I have
> also seen -no-pie referenced. A lot depends on which distro you are running.
>
https://stackoverflow.com/questions/43367427/32-bit-absolute-addresses-no-longer-allowed-in-x86-64-linux
> seems relevant.
I do remember when PIC was needed for dynamic linked code, but not
static linked, since dynamic linked code doesn't know that address it will
end up in.
In this case, as you might guess from the message, it is related to the transition
from 32 bit to 64 bit code.
If everything and everyone went to 64 bits, all would be fine. But even when using
very large amounts of data, one does not usually need more than 2GB of code,
and so code still wants to use 32 bit addresses. Using relative addressing,
you can still use 32 bit offsets, even if the code is actually loaded above 2GB.
I am not sure now which OS will still run 32 bit code, or which compilers
will generate it. I suspect that a large number of programs would still be
fine in 32 bits.