This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: where do I figure out "relocation R_X86_64_PC32" errors

On Sun, Sep 17, 2006 at 05:05:14PM -0400, sean wrote:
> H. J. Lu wrote:
> >On Sun, Sep 17, 2006 at 10:38:23AM -0400, sean wrote:
> >>mmx_00ffw is just a constant in yuv2rgb.c:
> >>
> >>uint64_t attribute_used __attribute__((aligned(8))) 
> >>mmx_00ffw = 0x00ff00ff00ff00ffULL;

The trouble is that this variable is used in asm statements using rip
addressing, and the variable is global.  ELF shared libraries have
particular rules regarding global symbol resolution;  A global symbol
in a shared library may be overridden by the same symbol in the main
app code (or another shared lib).  rip addressing won't work in this
situation for two reasons: a) the rip offset is in read-only code, so
relocating the offset means the library can't share that page of text,
and more seriously, b) the rip offset is only 32-bit so might not
reach to the app symbol or another library sym (64-bit address space).

There is a simple fix.  Add __attribute__ ((hidden)) to the variable
definition to make it local to the shared library.

Alan Modra
IBM OzLabs - Linux Technology Centre

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]