Another additional error check for invalid Mach-O files for the
authorKevin Enderby <enderby@apple.com>
Thu, 27 Oct 2016 20:59:10 +0000 (20:59 +0000)
committerKevin Enderby <enderby@apple.com>
Thu, 27 Oct 2016 20:59:10 +0000 (20:59 +0000)
commitbc5c29a65f5326484b12384a519945df341aa557
tree6cd051b43e595fa7c67011d9bd556411a0f5d55f
parent58e14743cae66da3a19bed8e95f2c6a118263933
Another additional error check for invalid Mach-O files for the
obsolete load commands.

Again the philosophy of the error checking in libObject for
Mach-O files, the idea behind the checking is that we never
will return a Mach-O file out of libObject that contains unknown
things the library code can’t operate on.  So known obsolete
load commands will cause a hard error.

Also to make things clear I have added comments to the
values and structures in Support/Mach-O.h and
Support/MachO.def as to what is obsolete.

As noted in a TODO in the code, there may need to be a
non-default mode to allow some unknown values for well
structured Mach-O files with things like unknown load
load commands.  So things like using an old lldb on a newer
Mach-O file could still provide some limited functionality.

llvm-svn: 285342
12 files changed:
llvm/include/llvm/Support/MachO.def
llvm/include/llvm/Support/MachO.h
llvm/lib/Object/MachOObjectFile.cpp
llvm/test/Object/Inputs/macho-invalid-fvmfile-obsolete [new file with mode: 0644]
llvm/test/Object/Inputs/macho-invalid-ident-obsolete [new file with mode: 0644]
llvm/test/Object/Inputs/macho-invalid-idfvmlib-obsolete [new file with mode: 0644]
llvm/test/Object/Inputs/macho-invalid-loadfvmlib-obsolete [new file with mode: 0644]
llvm/test/Object/Inputs/macho-invalid-prebind_cksum-obsolete [new file with mode: 0644]
llvm/test/Object/Inputs/macho-invalid-prebound_dylib-obsolete [new file with mode: 0644]
llvm/test/Object/Inputs/macho-invalid-prepage-obsolete [new file with mode: 0644]
llvm/test/Object/Inputs/macho-invalid-symseg-obsolete [new file with mode: 0644]
llvm/test/Object/macho-invalid.test