
{"id":8126,"date":"2013-01-25T15:49:58","date_gmt":"2013-01-25T15:49:58","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=8126"},"modified":"2013-01-25T15:49:58","modified_gmt":"2013-01-25T15:49:58","slug":"gcc-save-temps","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2013\/01\/25\/gcc-save-temps\/","title":{"rendered":"GCC commandline option  -save-temps"},"content":{"rendered":"<pre>\n<b>-save-temps<\/b>\n\nStore the usual \"temporary\" intermediate files \npermanently; place them in the current directory\nand name them based on the source file. Thus, \ncompiling `foo.c' with `-c -save-temps' would produce\nfiles `foo.i' and `foo.s', as well as `foo.o'. This\ncreates a preprocessed `foo.i' output file even though\nthe compiler now normally uses an integrated preprocessor. \n\n\nSESSION 1\n\n$ls\nmain.c\n$gcc -save-temp main.c\ngcc: error: unrecognized command line option \u2018-save-temp\u2019\n$gcc -save-temps main.c\n$ls\na.out  main.c  main.i  main.o  main.s\n$.\/a.out\n\n The Geek Stuff [0]\n$ls -l main.o\n-rw-r--r-- 1 jeffrin jeffrin 1504 Jan 25 21:18 main.o\n$\n\nSESSION 2\n\n\n$cat hello.c \n#include \n\nmain()\n{\n  printf(\"hello\");\n}\n$gcc -save-temps hello.c \nhello.c:3:1: warning: return type defaults to \u2018int\u2019 [-Wimplicit-int]\n main()\n ^~~~\n$ls\na.out  hello.c  hello.i  hello.o  hello.s\n$file he\nhello.c  hello.i  hello.o  hello.s  \n$file hello.i \nhello.i: C source, ASCII text\n$file hello.o \nhello.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped\n$.\/hello.o\nbash: .\/hello.o: Permission denied\n$chmod +x hello.o\n$.\/hello.o\nbash: .\/hello.o: cannot execute binary file: Exec format error\n$.\/hello.o\nbash: .\/hello.o: cannot execute binary file: Exec format error\n$file hello.s\nhello.s: assembler source, ASCII text\n$head hello.s\n\t.file\t\"hello.c\"\n\t.section\t.rodata\n.LC0:\n\t.string\t\"hello\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n$head hello.i\n# 1 \"hello.c\"\n# 1 \"\"\n# 1 \"\"\n# 31 \"\"\n# 1 \"\/usr\/include\/stdc-predef.h\" 1 3 4\n# 32 \"\" 2\n# 1 \"hello.c\"\n# 1 \"\/usr\/include\/stdio.h\" 1 3 4\n# 27 \"\/usr\/include\/stdio.h\" 3 4\n# 1 \"\/usr\/include\/features.h\" 1 3 4\n$\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>-save-temps Store the usual &#8220;temporary&#8221; intermediate files permanently; place them in the current directory and name them based on the source file. Thus, compiling `foo.c&#8217; with `-c -save-temps&#8217; would produce files `foo.i&#8217; and `foo.s&#8217;, as well as `foo.o&#8217;. This creates a preprocessed `foo.i&#8217; output file even though the compiler now normally uses an integrated preprocessor. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2013\/01\/25\/gcc-save-temps\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;GCC commandline option  -save-temps&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[1405],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/8126"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=8126"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/8126\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=8126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=8126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=8126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}