|
|
@ -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:
|
|
|
|