Sunday, March 15, 2020

An Introduction to GCC by Brian Gough

This book is a beginner's guide on GCC and covers the topic comprehensively. The topics I like most are Compilation options, optimization and tools section. Its amazing that a high quality tool, like this, developed by open source community. Great book and a great tool!

Recommended option: gcc -ansi -pedantic -Wall -Wextra -Wconversion -Wshadow -Wcast-qual -Wwrite-strings
To core dump: ulimit -c unlimited
GDB command: gdb a.out core
Optimization level: -O0 to -O3
Verbose debugging: gcc -v
Prevent excessive memory usage: ulimit -v limit
Prevent excessive memory usage soft limit : ulimit -S -v limit
GNU archiver to create: ar cr
GNU archiver to list .o: ar t
Profiler gprof: gcc -pg file.c, gprof a.out
Code coverage gcov: gcc -fprofile-arcs -ftest-coverage cov.c, gcov cov.c
Tool-chain:
  Preprocessing: cpp
                           gcc --save-temps
  To assembly:  gcc -S
  Assembly to machine: as file.s -o file.o
  Linker: ld -dynamic-linker

To find details of a.out: file a.out
Examining symbol table: nm a.out
Find dynamically linked libraries: ldd a.out

No comments:

Linux Command Line and Shell Scripting Bible

 Linux Command Line and Shell Scripting Bible, 4th Edition, by Richard Blum and Christine Bresnahan is a complete guide for software profess...