Patch function for executable.

Honestly I'm still not sure if this is the right way to handle this
since the resulting file clearly has some small late section missing,
but it runs fine so I guess it's okay?