This is the mail archive of the binutils@sourceware.org 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


H. J. Lu wrote:
On Sun, Sep 17, 2006 at 09:27:29PM -0400, sean wrote:

Alan Modra wrote:

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.


Nope. Same error message.


grep 00ffw ffmpeg/libswscale/yuv2rgb.c
uint64_t attribute_used __attribute__((aligned(8))) __attribute__((hidden)) mmx_00ffw = 0x00ff00ff00ff00ffULL;


It should be __attribute__((visibility("hidden"))).


H.J.



Yup. That did it.


Is this a generalizable lesson. That is, if I have another problem with -fPIC not allowing linking, I need to modify the attributes? Or is this clever thinking amongst the cognescenti?

In any event, thanks for all the help. I appreciate the time and attention.

sean


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