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