Apple's GCC and .s/.S files in llvm-test

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Apple's GCC and .s/.S files in llvm-test

Julien Lerouge
Hello,

Apple's GCC does not make the distinction between .s and .S files and
always run the preprocessor. From the man:

|  file.s
|      Assembler code. Apple's version of GCC runs the preprocessor on these
|      files as well as those ending in .S.
|
|  file.S
|      Assembler code which must be preprocessed.

The problem is that sometimes llc generates comments in the assembly
that look like this for x86:

        ...
        pushl   %esi
        ...
        # implicit-def: EDI
        ...
        ret

The comment line is perfectly valid for the assembler, but the
preprocessor does not like it because it tries to interpret it as a
macro... I can see it happening for example if -std=c99 is set in the
CFLAGS (that's the case in SingleSource/Regression/C++) :

  $ gcc --std=c99  -o t t.s
  t.s:5:4: error: invalid preprocessing directive #implicit

One solution is to force the language to be assembler (and not
assembler-with-cpp) on Darwin, that's what the attached patch does, but
maybe there is a nicer solution ?

Thanks,
julien

--
Julien Lerouge
PGP Key Id: 0xB1964A62
PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62
PGP Public Key from: keyserver.pgp.com

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Makefile.programs.diff (1K) Download Attachment