[Advanced Compiler Lecture Notes] Week 02 (2003/9/22) 1. 1> standard output 2> standard error 2. The GCC making process (bootstrap) Example: GCC-old means gcc 2.95; GCC-new means gcc 3.1.1 Stage 1: Tool: GCC-old binary Input: GCC-new source Output: GCC-new binary#1 Stage 2: Tool: GCC-new binary#1 Input: GCC-new source Output: GCC-new binary#2 Stage 3: Tool: GCC-new binary#2 Input: GCC-new source Output: GCC-new binary#3 The output of phase 2 and phase 3 should be the identical; if not, the bootstrap step fails. The final GCC executable file would be GCC-new binary#3 (same as GCC-new binary#2). 3. The GCC invocation process Example: Executable files are with ".exe" extension here, and the GCC is build only for C language. Step 1: gcc.exe parses command options (according to gccspec) Step 2: gcc.exe forks cpp.exe (from cppmain.c) Step 3: cpp.exe forks cc1.exe (from main.c) 4. CPP: C Pre-Processor 5. The brief structure of GCC: [pre-processor] -> [scanner + parser](language-dependent) -> [backend](machine dependent) 6. About gengentrl (generate generate register transfer language) gengentrl.c --> genrtl.c (the kernel of GCC) --> genrtl.h 7. On object and library An object file is with ".o" extension on Linux. An library file is with ".a" extension on Linux. To make a library file: ar -rc xxx.a aaa.o bbb.o .... 8. What's inside libbackend.a? Common backend objects (fron download) Common dependent objects (from genxxx.c and genxxx.h files) Machine dependent objects (fron download) 9. make -d: to print out debugging information when executing Makefile