Open alistra opened 13 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?
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.
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.
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...
FWIW a workaround for this is going to be using -no-integrated-as as one of the CFLAGS.
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.cWe 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
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
^
1 error generated.
Please generate the file by using "-save-temps" on the command line and attaching the .i file that's generated.
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
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.
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.
Needs more information: preprocessed file that's failing and the command line that's causing the problem.
Extended Description
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