GCC is normally instructed to output to a file via the -o
switch. If this isn't provided it seems to decide on an appropriate name and output to that. How do I make GCC write its generated output to stdout?
Try: $ make 2>&1 | tee your_build_log. txt this will redirect stdout, 2>&1 redirects stderr to the same place as stdout while allowing you to simultaneously see the output in your terminal.
Luckily, gcc does not output binary machine code directly. Instead, it internally writes assembler code, which then is translated by as into binary machine code (actually, gcc creates more intermediate structures). This internal assembler code can be outputted to a file, with some annotation to make it easier to read.
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.
Use the -S option to gcc (or g++), optionally with -fverbose-asm which works well at the default -O0 to attach C names to asm operands as comments.
gcc -o /dev/stdout foo.c
Note that /dev/stdout
is defined as a symlink: /dev/stdout -> /proc/self/fd/1
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With