Skip to content

processing of labels (address symbols) #26

@ThomasWaldmann

Description

@ThomasWaldmann

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

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions