For some strange reason IAMCU sets e_machine to 0x06 which causes QEMU to freak out. This is just x86 code with a different C calling convention, hack it back to 0x03 (EM_386) before running under the emulator. Change-Id: Ia5d51b771cad41f3013eb3d6a17912c8909c9bac Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
11 lines
309 B
Python
11 lines
309 B
Python
import sys
|
|
|
|
# For some baffling reason IAMCU sets the instruction set architecture
|
|
# in the ELF header to 0x06 instead of 0x03 even though it is just
|
|
# 386 code. This gives QEMU fits. Hack it!
|
|
fd = open(sys.argv[1], "r+b")
|
|
fd.seek(0x12)
|
|
# Write 0x03 which is EM_386 to e_machine
|
|
fd.write(b'\x03')
|
|
fd.close()
|
|
|