Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell GCC that input file is assembler even if it's really .c?

I have an unusual situation: I have an assembler file, which has .c extension and I cannot change build scripts, where this file is defined as "C" type. However, I can build it with the same GCC options if I rename it into .asm or *.s.

Is there any standard method to make GCC to think an input file is Assembler even if it has .c extension?

I can't change build script! I can only change the .c file. So, maybe there is a way to set command-line option '-x assembler' using preprocessor?

like image 389
psihodelia Avatar asked Oct 11 '22 09:10

psihodelia


1 Answers

This sounds a bit complicated, but if you use bash or anything similar you can alias gcc to a script you'll write and in this script when it gets the file you want to change behavior use the -x assembler parameter with gcc and act normally in otherfiles.

like image 192
rgngl Avatar answered Jan 01 '23 10:01

rgngl