You can give the -save-temps
option to gcc: it will leave all the temporary files (including the .s
files) in the current directory (works also with clang
):
gcc -c --save-temps test.cc
or use the -Wa,-aln=test.s
option:
gcc -c -Wa,-aln=test.s test.c
From gcc
documentation:
-Wa,option
Pass option
as an option to the assembler. If option contains commas, it is split into multiple options at the commas.
From as
documentation:
-a[cdghlmns]
Turn on listings, in any of a variety of ways:
-al
include assembly
-an
omit forms processing
[...]
You may combine these options; for example, use -aln
for assembly listing without forms processing.
Clang has an integrated assembler that should be switched off (How to switch off LLVM's integrated assembler?):
clang++ -c -no-integrated-as -Wa,-aln=test.s test.c