gcc 用combine 选项将多个源文件编译为一个目标文件

来源:互联网 发布:xp怎么安装网络打印机 编辑:程序博客网 时间:2024/06/06 07:18

gcc -c -combine test_a.c test_b.c 


-combine

 If you are compiling multiple source files, this option tells the driver to pass
all the source files to the compiler at once (for those languages for which the
compiler can handle this). This will allow intermodule analysis (IMA) to be
performed by the compiler. Currently the only language for which this is supported
is C. If you pass source files for multiple languages to the driver, using
this option, the driver will invoke the compiler(s) that support IMA once each,
passing each compiler all the source files appropriate for it. For those languages
that do not support IMA this option will be ignored, and the compiler will be
invoked once for each source file in that language. If you use this option in conjunction
with ‘-save-temps’, the compiler will generate multiple pre-processed
files (one for each source file), but only one (combined) ‘.o’ or ‘.s’ file.




原创粉丝点击