Professional Documents
Culture Documents
System Software: Assemblers, Linkers, and Loaders: Program Development
System Software: Assemblers, Linkers, and Loaders: Program Development
System Software: Assemblers, Linkers, and Loaders: Program Development
Examples:
cc hello.c hello.o (C -> ASM/OBJ)
· Assembler: Translates symbolic language source into machine language
binary format and creates an object file, i.e. name.s to name.o/obj
Uses a one-pass or two pass strategy. Forward references are a
problem for one pass assemblers.
A group of common object modules in a single file, i.e. name.lib
Examples:
asm hello.s hello.o (ASM -> OBJ)
System Software:
Assemblers, Linkers, and Loaders
Program Development (cont )
· Linker/Link Editor: Combines object files and libraries to form an executable
file, i.e. name.o to name.out, (a.out). (link control file = .cmd)
Examples:
link hello.o a.out (OBJ -> EXE)
link hello.o -o hello.out lnk.cmd
Libraries:
lib add.o sub.o mul.o div.o -o hello.a (OBJ(s) -> LIB)
· Loader/Debug Loader: Places/relocates an executable file into memory
and starts its execution.
Examples:
load hello.out (EXE->MEM)
System Software:
Source Files to Program Execution
hello.cpp HLL-Source .c, .cpp, .h (preprocessor, code gen, optimize)
Compiler
hello.asm Assembly-Source .s , .asm
Assembler Librarian
hello.obj Machine-Object .o, .obj + library.obj(s) Machine-Object .a, .lib
3) Helps minimize the number of actual machine instructions needed in H/W.
Pass 1:
loct = 0
locd = 0
Read Line
y
.directive? Process Directive .end
y
label? Update label table (label, locx)
Update locx
Pass 2:
loct = 0
locd = 0
loct = 0
locd = 0
Read Line
y
.directive? Process Directive
.word .space .global .end
init locd ref/def copy images to
locd object file
update object file image
n
instruction? error
build instruction
opcode to instruction operation fields
registers to instruction operand fields
immediate to instruction imm field
label to instruction address field
update relocation table
update object file image.
Update loct