Apple's GCC does not make the distinction between .s and .S files and
always run the preprocessor. From the man:
Assembler code. Apple's version of GCC runs the preprocessor on these
files as well as those ending in .S.
Assembler code which must be preprocessed.
The problem is that sometimes llc generates comments in the assembly
that look like this for x86:
# implicit-def: EDI
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 ?
Makefile.programs.diff (1.09 KB)