Open Quuxplusone opened 13 years ago
Attached gistfile1.txt
(701 bytes, text/plain): Compile log
Needs more information: preprocessed file that's failing and the command line that's causing the problem.
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.
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.
Attached decode_i586.c
(9236 bytes, application/octet-stream): preprocessed file that is compiled
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
(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.
Attached decode_i586.i
(10756 bytes, application/octet-stream): preprocessed file
(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
FWIW a workaround for this is going to be using -no-integrated-as as one of the CFLAGS.
(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...
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.
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.
As I recall it boils down to needing lookahead. "16 + (%eax)". Is the '(' the opening paren of a sub-expression or an indirection?
gistfile1.txt
(701 bytes, text/plain)decode_i586.c
(9236 bytes, application/octet-stream)decode_i586.i
(10756 bytes, application/octet-stream)