Menu

#29 Make jpeg-mmx ready for -fPIC

closed
nobody
None
5
2006-06-01
2005-01-22
No

Position-independent code is a necessity when linking
jpeg-mmx as a shared library and/or for use by shared
libraries, such as GStreamer. To see why, refer to
http://people.redhat.com/drepper/dsohowto.pdf

The jpeg-mmx sources cannot be compiled with -fPIC in
their present state, because they clobber the EBX
register that is used for PIC.

Discussion

  • Bernhard Praschinger

    Logged In: YES
    user_id=155293

    Hallo

    With your patch I have problems linking the stuff together:
    gcc -o djpeg djpeg.o wrppm.o wrgif.o wrtarga.o wrrle.o
    wrbmp.o rdcolmap.o cdjpeg.o libjpeg-mmx.a
    libjpeg-mmx.a(jidctint.o)(.text+0x46): In function
    `domidct8x8llmW':
    : undefined reference to `fix_054n184_054'
    ....
    libjpeg-mmx.a(jidctint.o)(.text+0xce8): more undefined
    references to `const_0x0808' follow
    ....
    libjpeg-mmx.a(jdcolor.o)(.text+0x185): In function
    `ycc_rgb_convert_mmx':
    : undefined reference to `te0'
    .
    I tried to compile it on a Suse 9.2 Athlon 32Bit System.
    gcc (GCC) 3.3.4 (pre 3.3.5 20040809)
    NASM version 0.98.38 compiled on Oct 2 2004

    If you need fuerther information please tell me.

     
  • Mikhail Zabaluev

    Logged In: YES
    user_id=313104

    > Date: 2005-02-16 22:02
    > Sender: waldviertler
    > With your patch I have problems linking the stuff together:

    Are you sure it's this patch that causes the problem?
    I had basically the same, unrelated, issue with undefined
    symbols, and I made a patch for gcc 3.4 that is posted under
    item 1107275:
    https://sourceforge.net/tracker/?func=detail&aid=1107275&group_id=5776&atid=305776

     
  • Bernhard Praschinger

    Logged In: YES
    user_id=155293

    Appling your other patch first, and thes errors go away,
    but, now I have problems appling this patch:
    cat jpeg-mmx-0.1.5-alt-pic-register-use.patch | patch -p0
    patching file jpeg-mmx-0.1.5/jidctfst.c
    patching file jpeg-mmx-0.1.5/jdcolor.c
    Hunk #2 FAILED at 348.
    1 out of 2 hunks FAILED -- saving rejects to file
    jpeg-mmx-0.1.5/jdcolor.c.rej

    patching file jpeg-mmx-0.1.5/jidctint.c
    Hunk #2 FAILED at 2837.
    1 out of 2 hunks FAILED -- saving rejects to file
    jpeg-mmx-0.1.5/jidctint.c.rej
    patching file jpeg-mmx-0.1.5/jdmerge.c
    patching file jpeg-mmx-0.1.5/cpu_accel.c
    patching file jpeg-mmx-0.1.5/jdapimin.c
    Hunk #1 succeeded at 413 (offset 1 line).
    Hunk #2 succeeded at 462 (offset 1 line).
    Hunk #3 succeeded at 481 (offset 1 line).
    Hunk #4 succeeded at 490 (offset 1 line).
    patching file jpeg-mmx-0.1.5/jdsample.c

    When I try to apply you patch maunaly the compiling fails.
    When I ignore them compiling works well. (except the other
    integer constant is too large for "long" type) messages from
    your other patch.

    PS: You can write me directly, or use the mailinglist. That
    is usually a bit faster.

     
  • Gernot Ziegler

    Gernot Ziegler - 2005-02-20
    • status: open --> closed
     
  • Gernot Ziegler

    Gernot Ziegler - 2005-02-20

    Logged In: YES
    user_id=8236

    The patch compiled correctly against the current CVS on my
    machine. I let Bernhard decide if he accepts the patch into
    the source, but it is looking good.

     
  • Bernhard Praschinger

    Logged In: YES
    user_id=155293

    Just added it to the CVS

     
  • Bernhard Praschinger

    • status: closed --> closed-accepted
     
  • Bernhard Praschinger

    Logged In: YES
    user_id=155293

    From what we know the jpeg-mmx is only used with the mjpegtools.
    If there are other programms using it it would be nice if
    you could tell us which use the jpeg-mmx.

    The patches you sent made the jpeg-mmx uncompilabel on gcc
    2.95.x (2.95.3 is know by now):
    gcc -O6 -I. -c -o jidctint.o jidctint.c
    jidctint.c: In function `domidct8x8llmW':
    jidctint.c:2868: more than 10 operands in `asm'
    gmake: *** [jidctint.o] Error 1
    Is it possible that you check it with the old compiler ?

    Have the change to run any tests on a 64Bit Machine ?
    One person had tried to compile it on a Opter 250 with Suse
    9.2 and gcc 3.3.4. And it didn't compile.

     
  • Nobody/Anonymous

    Logged In: NO

    There is a GStreamer plugin that uses jpeg-mmx, and
    GStreamer is all dynamically loaded.
    Libquicktime and transcode also seem to use it.

    I admit I didn't check my patch on any antiquated gcc
    version. I'm afraid you simply can't have it both ways.

    I don't have a 64bit machine to try my patch against.

     
  • Mikhail Zabaluev

    • status: closed-accepted --> open
     
  • Mikhail Zabaluev

    Logged In: YES
    user_id=313104

    Strangely, on two files the patch was applied halfway, as
    can be seen in 0.1.6. As a result, the routines got "pushl
    %ebx\n" with no matching "popl %ebx\n" at the end (and ebx
    still in the clobber clause, which allowed me to catch that
    quickly)!
    I guess this broken code gets little to no use. I attach the
    fix here.

     
  • Mikhail Zabaluev

    PIC register use (and code unbreaking) patch for jpeg-mmx 0.1.6

     
  • Steven Schultz

    Steven Schultz - 2006-06-01
    • status: open --> closed
     

Log in to post a comment.