Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

mplayer doesn't compile, error during inline asm parsing #10941

Open Quuxplusone opened 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR10693
Status NEW
Importance P normal
Reported by Aleksander Balicki (balicki.aleksander@gmail.com)
Reported on 2011-08-17 16:00:15 -0700
Last modified on 2012-10-12 15:09:25 -0700
Version 2.9
Hardware PC Linux
CC dimitry@andric.com, echristo@gmail.com, efriedma@quicinc.com, grosbach@apple.com, llvm-bugs@lists.llvm.org, nlewycky@google.com, rafael@espindo.la, wendling@apple.com
Fixed by commit(s)
Attachments gistfile1.txt (701 bytes, text/plain)
decode_i586.c (9236 bytes, application/octet-stream)
decode_i586.i (10756 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 7091
Compile log

mplayer-1.0_rc4_p20110322 doesn't compile under clang. Generated log attached.

This was compiled on Gentoo Linux x86 by using:

CC=clang CXX=clang emerge mplayer

USE=3dnow 3dnowext X a52 alsa amr ass cdio dga dirac doc dts dv dvd dvdnav enca
encode faac faad ftp gif iconv ipv6 jpeg jpeg2k kernel_linux live lzo mad mmx
mmxext mp3 network openal opengl osdmenu oss png quicktime rar real rtc
schroedinger sdl shm speex sse sse2 theora toolame tremor truetype twolame
unicode vidix vorbis vpx win32codecs x264 xanim xinerama xscreensaver xv xvid
xvmc -aalib -altivec -aqua -bidi -bindist -bl -bluray -bs2b -cddb -cdparanoia -
cpudetection -custom-cpuopts -debug -directfb -dvb -dxr3 -esd -fbcon -ggi -gsm -
jack -joystick -ladspa -libcaca -libmpeg2 -lirc -md5sum -mng -mpg123 -nas -nut -
pnm -pulseaudio -pvr -radio -rtmp -samba -ssse3 -tga -v4l -v4l2 -vdpau -
video_cards_mga -video_cards_s3virge -video_cards_tdfx -video_cards_vesa -zoran
Quuxplusone commented 13 years ago

Attached gistfile1.txt (701 bytes, text/plain): Compile log

Quuxplusone commented 13 years ago

Needs more information: preprocessed file that's failing and the command line that's causing the problem.

Quuxplusone commented 13 years ago

In this case, the log happens to be enough: the issue is integrated-as rejecting the following:

movl 8+(%esp), %eax

I can't recall whether we've discussed this before.

Quuxplusone commented 13 years ago

Aaah. I wasn't sure if it was rejecting that or some weirdness with not liking \t which might be a parse error from earlier.

And no, I don't know if we've discussed it or not.

Quuxplusone commented 13 years ago

Attached decode_i586.c (9236 bytes, application/octet-stream): preprocessed file that is compiled

Quuxplusone commented 13 years ago

this is the compile line:

clang -MD -MP -D_ISOC99_SOURCE -D_BSD_SOURCE -O2 -march=i686 -pipe -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -Iffmpeg -D_REENTRANT -I/usr/include -I/usr/include/freetype2 -DFF_API_MAX_STREAMS=0 -I/usr/include/dirac -I/usr/include/schroedinger-1.0 -I/usr/include/orc-0.4 -I/usr/include -I/usr/include/libdvdread -fomit-frame-pointer -c -o mp3lib/decode_i586.o mp3lib/decode_i586.c

Quuxplusone commented 13 years ago
(In reply to comment #5)
> this is the compile line:
>
> clang -MD -MP -D_ISOC99_SOURCE -D_BSD_SOURCE -O2 -march=i686 -pipe
> -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -D_LARGEFILE64_SOURCE -I. -Iffmpeg  -D_REENTRANT  -I/usr/include
> -I/usr/include/freetype2   -DFF_API_MAX_STREAMS=0 -I/usr/include/dirac
> -I/usr/include/schroedinger-1.0 -I/usr/include/orc-0.4   -I/usr/include
> -I/usr/include/libdvdread -fomit-frame-pointer -c -o mp3lib/decode_i586.o
> mp3lib/decode_i586.c

We need the *preprocessed* file. This one doesn't compile for us:

decode_i586.c:32:10: fatal error: 'config.h' file not found
#include "config.h"
         ^
1 error generated.

Please generate the file by using "-save-temps" on the command line and
attaching the .i file that's generated.
Quuxplusone commented 13 years ago

Attached decode_i586.i (10756 bytes, application/octet-stream): preprocessed file

Quuxplusone commented 13 years ago
(In reply to comment #6)
> (In reply to comment #5)
> > this is the compile line:
> >
> > clang -MD -MP -D_ISOC99_SOURCE -D_BSD_SOURCE -O2 -march=i686 -pipe
> > -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> > -D_LARGEFILE64_SOURCE -I. -Iffmpeg  -D_REENTRANT  -I/usr/include
> > -I/usr/include/freetype2   -DFF_API_MAX_STREAMS=0 -I/usr/include/dirac
> > -I/usr/include/schroedinger-1.0 -I/usr/include/orc-0.4   -I/usr/include
> > -I/usr/include/libdvdread -fomit-frame-pointer -c -o mp3lib/decode_i586.o
> > mp3lib/decode_i586.c
>
> We need the *preprocessed* file. This one doesn't compile for us:
>
> decode_i586.c:32:10: fatal error: 'config.h' file not found
> #include "config.h"
>          ^
> 1 error generated.
>
> Please generate the file by using "-save-temps" on the command line and
> attaching the .i file that's generated.

sorry, attached the correct file
Quuxplusone commented 13 years ago

FWIW a workaround for this is going to be using -no-integrated-as as one of the CFLAGS.

Quuxplusone commented 12 years ago
(In reply to comment #2)
> In this case,  the log happens to be enough: the issue is integrated-as
> rejecting the following:
>
> movl 8+(%esp), %eax

Clang does seem to accept:

  __asm__ volatile("movl 8+4(%esp),%eax");

producing:

   0:   8b 44 24 0c             mov    0xc(%esp),%eax

GNU as obviously also accepts the '8+4(%esp)'.  When leaving out the second
operand of the +, you do get a warning from gas; e.g. clang -no-integrated-as
of:

  __asm__ volatile("movl 8+(%esp),%eax");

will print:

  /tmp/asmofs-xUVQvy.s: Assembler messages:
  /tmp/asmofs-xUVQvy.s:9: Warning: missing operand; zero assumed

So there you have it: if the operand is missing, assume zero.  The question is
whether clang should also warn...
Quuxplusone commented 12 years ago

I vaguely recall this coming up before. IIRC, there's grammatical ambiguities that get pretty ugly in trying to accept this form of the expression. The proper syntax is to include the '0' in the source asm string. That is, "movl 8+0(%esp), %eax".

Usual caveat applies: I'm not an x86 expert.

Quuxplusone commented 12 years ago

Yeah, I'd love for that to work, unfortunately the assembler thinks that 04 is octal and complains. (i.e. not safe if the stack offset for the variable changes).

Can you elaborate on the grammatical ambiguities? I'm running out of clever ideas for this sort of problem.

Quuxplusone commented 12 years ago

As I recall it boils down to needing lookahead. "16 + (%eax)". Is the '(' the opening paren of a sub-expression or an indirection?