-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Description
Looks like that for a simple implementation we need a 2-pass assembler:
- pass 1: generating code (text segment), data segment, bss segment. but as we do not know all labels yet, some absolute addresses or relative offsets will be unknown (for code generation we'll just use 0) and thus the generated code will be wrong. But we are only interested in knowing all labels (offsets relative to some segment start) at the end of pass 1.
- pass 2: really create text, data, bss segments as we now know correct addresses.
Symbol table would be like:
symbol/label ---> (global, segment, value)
global: flag set to True by .global
segment: TEXT, DATA, BSS or None if it is not some kind of address
value: relative offset from segment start
Metadata
Metadata
Assignees
Labels
No labels