aboutsummaryrefslogtreecommitdiffstats
path: root/elf.py
diff options
context:
space:
mode:
Diffstat (limited to 'elf.py')
-rwxr-xr-xelf.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/elf.py b/elf.py
index 8990c88..919b690 100755
--- a/elf.py
+++ b/elf.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import sys
-from subx import clean, classify, parse_segment, parse_instr, format_instr
+from subx import clean, classify, parse_segment, parse_instr
"""
Takes a packed & surveyed hex stream (with section headers) and packs it into a
@@ -28,16 +28,14 @@ for line in sys.stdin:
(name, addr) = parse_segment(line)
segment = { 'name': name, 'addr': addr, 'content': [] }
segments.append(segment)
- else:
+ elif type == 'instr':
if segment == None:
raise ValueError("label or code outside of segment!")
- if type == 'label':
- raise NotImplementedError()
- else:
- instr = parse_instr(line)
- segment['content'] += instr
-
+ instr = parse_instr(line)
+ segment['content'] += instr
+ else:
+ raise ValueError("elf input should contain only segments and instructions!")
entrypoint = 0x80000000
cursor = 0