CALL & Pthread
This content delves into the intricacies of the compilation process in software development, covering topics such as interpretation vs. translation, assembler functions, symbolic tables, relocation tables, and more. It provides detailed insights into the stages involved in converting high-level language code to assembly code, object code, and finally generating executable programs.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
CALL & Pthread yiming
Interpretation vs Translation Interpreter: Directly executes a program in the source language For example: python foo.py sh foo.sh Translator: Converts a program from the source language to anequivalent program in another language For example: gcc -FLAG flags foo.c -o foo ./foo javac logism.java o logism.jar java -jar logism.jar
CALL chain Compiler Assembler Linker Loader
Compiler foo.s High-Level Language Code -> Assembly Language Code (e.g. MAL) Convert marcos Output may contain pseudo-instructions For example: Move $x $y
Assembler-Proj1.1 foo.o Assembly Language Code (MAL) -> Object Code, information tables(TAL) Totally numbers TAL is some numbers
Assembler-Proj1.1 foo.o Contains 2 passes. first pass Replace pseudo-instruction To code without labels Second pass Handle branches and labels
Assembler-Proj1.1 pass1 TODO list 1. Skip comments 2. Add labels in symbol table (labels, data) 3. Give addresses 4. Check if invalid inst int pass_one(FILE* input, FILE* output, SymbolTable* symtbl) Note: There are characters. I mean, normal codes No pseudo. The symbol table contains position of labels.
Assembler-Proj1.1 pass2 TODO list 1. Check if invalid inst 2. Use label position to generate numbers. 3. Record relocation things to reltbl int pass_two(FILE *input, FILE* output, SymbolTable* symtbl, SymbolTable* reltbl) Note: the pc is with suffix 00 or not
After Assembler-Proj1.1 1. The object file with header 2. Code (number) 3. Data 4. Relocation table 5. Symbol table 6. Debug infos
Linker-Proj1.2 TODO list Object code files, information tables -> Executable code Briefly. Combine multiple object file to a single one Use relocation table and symbol table. 1. Merge text/data segment 2. Create absolute memory addresses 3. Modify & merge symbol and relocation tables 4. Edit Addresses in relocation table 5. Output executable of merged modules(instructions + data + details)
Loader Loader project2 part ./a.out 1. Read instructions allocate space for program 2. Copy data to memory 3. Copy args to stack 4. Init register 5. Execute
Guest lecture: Pthread Yifan