import sys, struct, shutil, os def patch_relocs(build_dir, out_dir, object_files): patched = 0 for f in object_files: f = os.path.join(build_dir, os.path.basename(f)) outfile = os.path.join(out_dir, os.path.basename(f).replace('.obj', '.o')) shutil.copy(f, outfile) with open(outfile, 'rb+') as file: file.seek(0) if file.read(4) != b'\x7fELF': continue file.seek(40) hdr = struct.unpack('