Professional Documents
Culture Documents
Separate Compilation: - These Two Program Can Now Be
Separate Compilation: - These Two Program Can Now Be
1
Binary Symbolic Subroutine Tasks for BSS Loader
Loaders (BSS)
• One of the first relocating loaders • Allocation
– 1956: IBM, GE, UNIVAC – assembler calculates each segment length
• Allows multiple program segments – loader adds them all up
((“control
control sections”
sections in your textbook) – load location obtained from OS
– different languages
Separate compilation!
• Relocation
– different times – assembler flags words for relocation (bit
• Let’s examine each of the “tasks” in turn… masks)
– loader makes modifications
2
Disadvantages of Transfer
Data Sharing with BSS Loaders
Vector
• Overhead
• Permit 1 common (shared) “data segment”
– time (extra call instruction) • All external data is in this one data segment
– space (for transfer vector in object file)
DS
• Works for subroutine calls
calls, but what about X
3
Introduction Assembler Responsibilities
• General linking/loading strategy 1. Header information
– length of segment
• Very common in modern systems
– execution start address
• And used in Lab #3! 2. List of entry points
• Advantages: – those defined in this segment
– separate assembly – gives their (relative) value
– multiple control and data segments 3. List of external references
– lower time overhead (in program execution) – used in this segment
– defined outside of segment
– lower space overhead (in program’s object
file)
4
External Records II
5
Pass #1: Pseudocode Example
calculate total size (all segments) Main .ORIG Lib .ORIG
get IPLA (from OS) .EXT Put .EXT Num
for each segment do: .ENT Num .ENT Put
calculate PLA JMP Put Put LD R0,Num
,
add entry symbols to “external symbol
Num .FILL #7 TRAP x31
table” (EST)
if symbol already present .END TRAP x25
flag an error .END
rof
6
Checking External Symbols II Unifying “X” and “M”
• Option #2: during pass 2 • Don’t really need 2 separate mechanisms!
– we know: • Recall meanings of
• external symbols used ⊆ EXT symbols declared
– T______M
– read in the records generated from EXT declarations
– T _ _ _ _ _ _ XSym
y
– check symbols in these against the EST • “Sym” is in EST
• Option #3: during pass 2 • add this value of “Sym” to address field
– when each text record is processed, report an error if • Recall that segment names always in EST
the symbol is not in the EST
• This suggests that X can be seen as a more
general form of M!
Problem: Space
7
Dynamic Loading Dynamic Loading - Overlays
• Observe: program does 1 thing at a time
• B/D never together with C/E/F
∴ don’t need all segments present • Define an “overlay structure” for how segments can
simultaneously be swapped in and out
• 3 scenarios:
• Example A 200 A 200 A 200
A 200 500 300 300
B C C
E 200 F 400
B 500 C 300 D 300
Problem: Time