Recently my friend highlighted something that can be use to examining gcc complier behavior.
You can pass following options to gcc
- -v : Display the commands executed to run the stages of compilation on screen.
- -x language : I am using C
- /dev/null : Use /dev/null as input file
For example when I type the following command:
gcc -v -x c /dev/null
Output:
Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.0.4 20060507 (prerelease) (Debian 4.0.3-3) /usr/lib/gcc/i486-linux-gnu/4.0.4/cc1 -quiet -v /dev/null -quiet -dumpbase null -mtune=i686 -auxbase null -version -o /tmp/ccMVab5b.s ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include search starts here: /usr/local/include /usr/lib/gcc/i486-linux-gnu/4.0.4/include /usr/include End of search list. GNU C version 4.0.4 20060507 (prerelease) (Debian 4.0.3-3) (i486-linux-gnu) compiled by GNU C version 4.0.4 20060507 (prerelease) (Debian 4.0.3-3). GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96075 as -V -Qy --32 -o /tmp/ccyCAfmi.o /tmp/ccMVab5b.s GNU assembler version 2.16.91 (i486-linux-gnu) using BFD version 2.16.91 20060413 Debian GNU/Linux /usr/lib/gcc/i486-linux-gnu/4.0.4/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc/i486-linux-gnu/4.0.4/../../../../lib/crt1.o /usr/lib/gcc/i486-linux-gnu/4.0.4/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.0.4/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/4.0.4 -L/usr/lib/gcc/i486-linux-gnu/4.0.4 -L/usr/lib/gcc/i486-linux-gnu/4.0.4/../../../../lib -L/usr/lib/gcc/i486-linux-gnu/4.0.4/../../.. -L/lib/../lib -L/usr/lib/../lib /tmp/ccyCAfmi.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i486-linux-gnu/4.0.4/crtend.o /usr/lib/gcc/i486-linux-gnu/4.0.4/../../../../lib/crtn.o /usr/lib/gcc/i486-linux-gnu/4.0.4/../../../../lib/crt1.o: In function `_start': ../sysdeps/i386/elf/start.S:115: undefined reference to `main' collect2: ld returned 1 exit status
🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |