Some fixes + starting a very hacky support for elf64.

It will obviously require *much* of redesigning and stuff, and
polymorphization, but meh for now.