Andrew Boie | e79c960 | 2016-03-10 16:02:24 -0800 | [diff] [blame] | 1 | import sys |
2 | |||||
3 | # For some baffling reason IAMCU sets the instruction set architecture | ||||
4 | # in the ELF header to 0x06 instead of 0x03 even though it is just | ||||
5 | # 386 code. This gives QEMU fits. Hack it! | ||||
6 | fd = open(sys.argv[1], "r+b") | ||||
7 | fd.seek(0x12) | ||||
8 | # Write 0x03 which is EM_386 to e_machine | ||||
9 | fd.write(b'\x03') | ||||
10 | fd.close() | ||||
11 |