Fix bootloader to work when using mac codesigning

I've made some additional changes to the bootloader to work with codesigned mac binaries.

Similar to the way it works on Windows, we look backwards in the binary for the magic cookie. On Mac though, the signature can vary in length and can be pretty long, so we look at the mach header to determine where the signature starts. Since segments are aligned, we then scan backward from there looking for the cookie. On Mac, the segments are aligned to 4kb multiples (vs 8-bytes on Windows).