compilation - Produce both assembly and object file with gcc/clang: Possible? How? -


is possible produce both object file , source file in once command gcc/g++/clang/clang++ ? how?

i need pass lot of other options, avoid duplicating them in 2 separate commands:

gcc -s test.cc # produce assembly gcc -c test.cc # produce object file 

you can give -save-temps option gcc: leave temporary files (including .s files) in current directory (works clang):

gcc -c --save-temps test.cc 

or use -wa,-aln=test.s option:

gcc -c -wa,-aln=test.s test.c 

from gcc documentation:

-wa,option

pass option option assembler. if option contains commas, split multiple options @ commas.

from as documentation:

-a[cdghlmns] turn on listings, in of variety of ways:

  • -al include assembly
  • -an omit forms processing

[...]

you may combine these options; example, use -aln assembly listing without forms processing.

clang has integrated assembler should switched off (how switch off llvm's integrated assembler?):

clang++ -c -no-integrated-as -wa,-aln=test.s test.c 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -