C compiler (cc): - Only support ELF format. - Options: -B mode - If mode is dynamic, produce a dynamically linked executable file. - If mode is static, produce a static executable. -c - Suppress the link-edit phase of compilation, and do not remove any object files that are produced. -D name[=value] - Define name as if by C-Language #define directive. If no =value is given, a value of 1 is used. The -D option has lower precedence than the -U option. -E - Copy C-language source file to standard output, executing all preprocessor directives; no compilation shall be performed. -G - Create a shared library or object files suitable for inclusion in such a shared library. - Produce PIE or PIC depending if -c option is used. -g - Produce symbolic information in the object or executable files. -I directory - Search for include files in directory then the usual system defined places. -l library - Search for library liblibrary.a or liblibrary.so depending if -G or -B is used. -L directory - Search for libraries in directory then the usual system defined places. -O optlevel - Specify code optimization. - If optlevel is 0 then no optimizations shall be performed. - If optlevel is 1 then all optimizations shall be performed. - Other implementation values for optlevel can exist. -o outfile - Object output file name outfile. -s - Strip symbolic and other information from object file not required for proper execution. -R directory - If the object file supports it specify a directory to be searched for shared libraries. -U name - Remove an initial definition of name. - Sane compiler options: -G Create a position independant executable - If -c included produce position independant code. - Mark object suitable for dynamic allocation. -B mode mode static and dynamic - Because -G and -B options exist produce static binaries by default. - Optimizations (lightly optimized): - Trust the programmer. Try to be accommodating when programmer requests using registers. Prioritize allocation according to programmer (stack, rodata, data, and .bss). -O1: - Remove branches when possible. - Aggressive inlining of code. - Allow hardlinks to enfoce C standard compliance: - Example c89 -s -c cfile.c # (Would compile cfile.c according to the C89 standard). - Hardlinks: c89, c99, c11, c17 - Also include flag to select standard. - Include extended features: - struct packed: Pack a struct regardless of endianess. Compiler handles conversion. Useful for Internet protocols. - Well defined sizes for integers: Start allocation from smallest to largest addressable unit respectively. char -> short -> int -> long -> long long Useful for systems programming and kernel development. - Following headers should be part of compiler internals include option to dump these headers. - stdarg.h - stdint.h - stddef.h