开发者

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

开发者 https://www.devze.com 2023-03-23 23:45 出处:网络
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 opt

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 thi开发者_StackOverflow社区nk 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号