added pseudo-op .set name val, and .global symb

float_support
Anton Lydike 4 years ago
parent db8cc9b00c
commit 9aaaf7313f

@ -18,6 +18,7 @@ class ExecutableParser:
self.active_section: Optional[str] = None self.active_section: Optional[str] = None
self.implicit_sections = False self.implicit_sections = False
self.stack_pref: Optional[int] = None self.stack_pref: Optional[int] = None
self.globals: List[str] = list()
def parse(self): def parse(self):
for token in self.tokenizer.tokens: for token in self.tokenizer.tokens:
@ -100,6 +101,17 @@ class ExecutableParser:
size = parse_numeric_argument(op.args) size = parse_numeric_argument(op.args)
self.stack_pref = size self.stack_pref = size
def op_global(self, op: 'RiscVPseudoOpToken'):
ASSERT_LEN(op.args, 1)
name = op.args[1]
self.globals.append(name)
def op_set(self, op: 'RiscVPseudoOpToken'):
ASSERT_LEN(op.args, 2)
name = op.args[0]
val = parse_numeric_argument(op.args[1])
self.symbols[name] = ('_static_', val)
## Section handler code ## Section handler code
def set_sec(self, name: str, flags: MemoryFlags, cls=MemorySection): def set_sec(self, name: str, flags: MemoryFlags, cls=MemorySection):
if name not in self.sections: if name not in self.sections:

@ -13,6 +13,8 @@ class MMU:
binaries: List[LoadedExecutable] binaries: List[LoadedExecutable]
last_bin: Optional[LoadedExecutable] = None last_bin: Optional[LoadedExecutable] = None
global_symbols: Dict[str, int]
def __init__(self, conf: RunConfig): def __init__(self, conf: RunConfig):
self.sections = list() self.sections = list()
self.binaries = list() self.binaries = list()

Loading…
Cancel
Save