added escape character deocoding for ascii and asciiz pseudo-ops

float_support
Anton Lydike 4 years ago
parent 3bcabfbf78
commit 7cb29c5b89

@ -87,13 +87,13 @@ class ExecutableParser:
def op_ascii(self, op: 'RiscVPseudoOpToken'): def op_ascii(self, op: 'RiscVPseudoOpToken'):
ASSERT_IN(self.active_section, ('data', 'rodata')) ASSERT_IN(self.active_section, ('data', 'rodata'))
ASSERT_LEN(op.args, 1) ASSERT_LEN(op.args, 1)
str = op.args[0][1:-1] str = op.args[0][1:-1].encode('ascii').decode('unicode_escape')
self.curr_sec().add(bytearray(str, 'ascii')) self.curr_sec().add(bytearray(str, 'ascii'))
def op_asciiz(self, op: 'RiscVPseudoOpToken'): def op_asciiz(self, op: 'RiscVPseudoOpToken'):
ASSERT_IN(self.active_section, ('data', 'rodata')) ASSERT_IN(self.active_section, ('data', 'rodata'))
ASSERT_LEN(op.args, 1) ASSERT_LEN(op.args, 1)
str = op.args[0][1:-1] str = op.args[0][1:-1].encode('ascii').decode('unicode_escape')
self.curr_sec().add(bytearray(str + '\0', 'ascii')) self.curr_sec().add(bytearray(str + '\0', 'ascii'))
def op_stack(self, op: 'RiscVPseudoOpToken'): def op_stack(self, op: 'RiscVPseudoOpToken'):

Loading…
Cancel
Save