blob: bff8c296e2a4273ae9053d0e424db12bb1fe3469 [file] [log] [blame]
Anas Nashifed3d7c12017-04-10 08:53:23 -04001#!/usr/bin/env python3
2
Andrew Boiee79c9602016-03-10 16:02:24 -08003import 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!
8fd = open(sys.argv[1], "r+b")
9fd.seek(0x12)
10# Write 0x03 which is EM_386 to e_machine
11fd.write(b'\x03')
12fd.close()