Refactor the main transformation method (ExecuteElfObjcopyOnBinary) to be agnostic of which Reader subclass (currently ELFReader) is passed in.
This adds RTTI to the Reader class so that we can infer the ELF output type from the input reader. As a TODO, we should explicitly require this to be set by the --binary-architechture flag if the Reader is a BinaryReader.
This is a small refactoring in preparation for implementing BinaryReader (see also D41687). It should have no functional change.
So I realized (thanks to the other change) that it does not really make sense to put getKind here. I think this is what James was pointing out already but I was just not thinking clearly. I apologize. ELFReader *should* have this as a means of telling us what was read in but Reader should not. The ELFType should be determined using the machine info and be passed to handle args as it was before. If If it weren't for -split-dwo (which quite frankly is kind of a dumb option now that a better alternative exists) we would pass the Writer directly to HandleArgs. The only other planned option is a -split-debug option but that only makes sense for the ELF input format case so when that's implemented it can be moved elsewhere.