> ----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I'm trying to get ffmpeg, transcode and mplayer repackaged for amd64.
> ffmpeg fails with :
> gcc -shared -o libavcodec.so common.o utils.o mem.o allcodecs.o mpegvideo.o 
> jrevdct.o jfdctfst.o jfdctint.o mpegaudio.o ac3enc.o mjpeg.o resample.o 
> resample2.o dsputil.o motion_est.o imgconvert.o imgresample.o mpeg12.o 
> mpegaudiodec.o pcm.o simple_idct.o ratecontrol.o adpcm.o eval.o dv.o 
> error_resilience.o fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o 
> golomb.o vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o 
> roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o msvideo1.o 
> vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o smc.o parser.o 
> flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o flac.o vp3dsp.o 
> integer.o snow.o tscc.o sonic.o ulti.o h264idct.o qdrw.o xl.o rangecoder.o 
> png.o pnm.o pthread.o h263.o h261.o msmpeg4.o h263dec.o svq1.o rv10.o 
> wmadec.o indeo3.o a52dec.o liba52/bit_allocate.o liba52/bitstream.o 
> liba52/downmix.o liba52/imdct.o  liba52/parse.o liba52/crc.o 
> liba52/resample.o dtsdec.o faad.o faac.o xvidff.o mp3lamea
> udio.o oggvorbis.o i386/fdct_mmx.o i386/cputest.o i386/dsputil_mmx.o 
> i386/mpegvideo_mmx.o i386/idct_mmx.o i386/motion_est_mmx.o 
> i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o i386/vp3dsp_sse2.o  
> -lm -ldts -lz -lpthread -ldl -ldts -lfaac -lxvidcore -lmp3lame -lvorbis 
> -lvorbisenc  -Wl,--warn-common -rdynamic  -Wl,-soname -Wl,libavcodec-cvs.so
> /usr/bin/ld: common.o: relocation R_X86_64_32 can not be used when making a 
> shared object; recompile with -fPIC
> common.o: could not read symbols: Bad value
> 
> My invironment includes
> CFLAGS=-fPIC
> CCFLAG=-fPIC
> 
> Is this a configure problem, or how should I proceed to get -fPIC
> propagated down the chain in a apt-get source --build <package>?
> 

I got this problem even with -fPIC with mythtv.  Look for the MANGLE
macro.  It refers to global constants.  I set local variables equal to
the global values and added an asm "m" variable corresponding to the
local variable, and then it worked.

For a short example, see the usage of the variable otmp below.  File is
motion_est_mmx.c.  There are a lot of MANGLE's in dsputil_mmx.c and a
few in simple_idct_mmx.c.

static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride,
int h)
{ //FIXME reuse src
    long len= -(stride*h);
    unsigned long otmp = bone;
    asm volatile(
        ".balign 16                     \n\t"
        "movq %5, %%mm5 \n\t" 
#if 0
        "movq "MANGLE(bone)", %%mm5     \n\t" 
#endif
        "1:                             \n\t"
        "movq (%1, %%rax), %%mm0        \n\t"
        "movq (%2, %%rax), %%mm2        \n\t"
        "movq 1(%1, %%rax), %%mm1       \n\t"
        "movq 1(%2, %%rax), %%mm3       \n\t"
        "pavgb %%mm2, %%mm0             \n\t"
        "pavgb %%mm1, %%mm3             \n\t"
        "psubusb %%mm5, %%mm3           \n\t"
        "pavgb %%mm3, %%mm0             \n\t"
        "movq (%3, %%rax), %%mm2        \n\t"
        "psadbw %%mm2, %%mm0            \n\t"
        "addq %4, %%rax                 \n\t"
        "movq (%1, %%rax), %%mm1        \n\t"
        "movq (%2, %%rax), %%mm3        \n\t"
        "movq 1(%1, %%rax), %%mm2       \n\t"
        "movq 1(%2, %%rax), %%mm4       \n\t"
        "pavgb %%mm3, %%mm1             \n\t"
        "pavgb %%mm4, %%mm2             \n\t"
        "psubusb %%mm5, %%mm2           \n\t"
        "pavgb %%mm1, %%mm2             \n\t"
        "movq (%3, %%rax), %%mm1        \n\t"
        "psadbw %%mm1, %%mm2            \n\t"
        "paddw %%mm2, %%mm0             \n\t"
        "paddw %%mm0, %%mm6             \n\t"
        "addq %4, %%rax                 \n\t"
        " js 1b                         \n\t"
        : "+a" (len)
        : "r" (blk1 - len), "r" (blk1 - len + stride), "r" (blk2 - len),
"r" ((long)stride), "m" (otmp)
    );
}

Fred


Reply via email to