[Ffmpeg-devel] [Patch] fix swscale shared lib on x86-64
sean
seandarcy2
Mon Sep 18 18:00:22 CEST 2006
building swscale on x86-64 fails:
/usr/bin/ld: yuv2rgb.o: relocation R_X86_64_PC32 against
`mmx_00ffw' can not be used when making a shared object;
recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
With a lot of help from the binutils list, here a patch that
allows libswscale to build. It adds
__attribute__((visibility("hidden"))).
Alan Modra < amodra at bigpond.net.au > described what the
problem is:
>>>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).
Works on x86-64. Dunno if it breaks anything on i386.
sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swscale-x86-64.patch
Type: text/x-patch
Size: 2509 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060918/5a80193e/attachment.bin>
More information about the ffmpeg-devel
mailing list