This patch is a first step toward using the llvm::Error mechanism to surface non-fatal errors in object file handling. This patch adds a new error for unrecognized load command IDs, as an UnknownValueError.
It also adds the ability to ignore UnknownValueErrors since an object file with unknown values may still be structurally valid. This is particularly important for tools that need to operate correctly on binary files produced with newer compilers than the tool itself came from. For example, running an old LLDB on a binary compiled with a newer Clang would need to be able to ignore unknown load commands because we might have added new commands.
We will want to take this one step further by surfacing the object and errors through an "ErrorAnd" construct and allowing the recipient to determine how to handle each error. Since this patch is sufficiently large as-is, and feeding that through all the libObject common APIs is also a large change I'd like to do that in a separate patch.
Doing the larger cleanup will remove the "IgnoreValueErrors" parameter from the common APIs, but will require touching ELF and COFF as well as MachO.
Seems like this bit of added logic will cause the loop over load commands to continue past all errors (even if the errors were not value errors) if IgnoreValueErrs is set and will not stop on the first error. If that what you intended? If so I'm not sure this code was written to be robust enough to handle this and not crash. And I doubt there are single file cases with multiple errors that are tested. Maybe you only wanted multiple value errors and not all multiple types of errors?