summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-10-27 20:59:10 +0000
committerKevin Enderby <enderby@apple.com>2016-10-27 20:59:10 +0000
commitbc5c29a65f5326484b12384a519945df341aa557 (patch)
tree6cd051b43e595fa7c67011d9bd556411a0f5d55f /llvm/test
parent58e14743cae66da3a19bed8e95f2c6a118263933 (diff)
downloadbcm5719-llvm-bc5c29a65f5326484b12384a519945df341aa557.tar.gz
bcm5719-llvm-bc5c29a65f5326484b12384a519945df341aa557.zip
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
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-fvmfile-obsoletebin0 -> 44 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-ident-obsoletebin0 -> 36 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-idfvmlib-obsoletebin0 -> 48 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-loadfvmlib-obsoletebin0 -> 48 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-prebind_cksum-obsoletebin0 -> 40 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-prebound_dylib-obsoletebin0 -> 48 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-prepage-obsoletebin0 -> 44 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-symseg-obsoletebin0 -> 44 bytes
-rw-r--r--llvm/test/Object/macho-invalid.test24
9 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Object/Inputs/macho-invalid-fvmfile-obsolete b/llvm/test/Object/Inputs/macho-invalid-fvmfile-obsolete
new file mode 100644
index 00000000000..10e0df5b544
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-fvmfile-obsolete
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-ident-obsolete b/llvm/test/Object/Inputs/macho-invalid-ident-obsolete
new file mode 100644
index 00000000000..74d61677d68
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-ident-obsolete
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-idfvmlib-obsolete b/llvm/test/Object/Inputs/macho-invalid-idfvmlib-obsolete
new file mode 100644
index 00000000000..bf83e5b4a53
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-idfvmlib-obsolete
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-loadfvmlib-obsolete b/llvm/test/Object/Inputs/macho-invalid-loadfvmlib-obsolete
new file mode 100644
index 00000000000..bac12a2e5f4
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-loadfvmlib-obsolete
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-prebind_cksum-obsolete b/llvm/test/Object/Inputs/macho-invalid-prebind_cksum-obsolete
new file mode 100644
index 00000000000..6fa90d030a5
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-prebind_cksum-obsolete
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-prebound_dylib-obsolete b/llvm/test/Object/Inputs/macho-invalid-prebound_dylib-obsolete
new file mode 100644
index 00000000000..04d9f82bf3e
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-prebound_dylib-obsolete
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-prepage-obsolete b/llvm/test/Object/Inputs/macho-invalid-prepage-obsolete
new file mode 100644
index 00000000000..cfd6bae900e
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-prepage-obsolete
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-symseg-obsolete b/llvm/test/Object/Inputs/macho-invalid-symseg-obsolete
new file mode 100644
index 00000000000..6330997e409
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-symseg-obsolete
Binary files differ
diff --git a/llvm/test/Object/macho-invalid.test b/llvm/test/Object/macho-invalid.test
index 897b28e4a0f..f95eebc315a 100644
--- a/llvm/test/Object/macho-invalid.test
+++ b/llvm/test/Object/macho-invalid.test
@@ -409,3 +409,27 @@ INVALID-TWOLEVELHINTS-OFFSET-HNINTS: macho-invalid-twolevelhints-offset-nhints':
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-fat_cputype 2>&1 | FileCheck -check-prefix INVALID-FAT-CPUTYPE %s
INVALID-FAT-CPUTYPE: macho-invalid-fat_cputype': truncated or malformed object (universal header architecture: 0's cputype does not match object file's mach header)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-prebind_cksum-obsolete 2>&1 | FileCheck -check-prefix INVALID-PREBIND_CKSUM-OBSOLETE %s
+INVALID-PREBIND_CKSUM-OBSOLETE: macho-invalid-prebind_cksum-obsolete': truncated or malformed object (load command 0 for cmd value of: 23 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-symseg-obsolete 2>&1 | FileCheck -check-prefix INVALID-SYMSEG-OBSOLETE %s
+INVALID-SYMSEG-OBSOLETE: macho-invalid-symseg-obsolete': truncated or malformed object (load command 0 for cmd value of: 3 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-idfvmlib-obsolete 2>&1 | FileCheck -check-prefix INVALID-IDFVMLIB-OBSOLETE %s
+INVALID-IDFVMLIB-OBSOLETE: macho-invalid-idfvmlib-obsolete': truncated or malformed object (load command 0 for cmd value of: 7 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-loadfvmlib-obsolete 2>&1 | FileCheck -check-prefix INVALID-LOADFVMLIB-OBSOLETE %s
+INVALID-LOADFVMLIB-OBSOLETE: macho-invalid-loadfvmlib-obsolete': truncated or malformed object (load command 0 for cmd value of: 6 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-prebound_dylib-obsolete 2>&1 | FileCheck -check-prefix INVALID-PREBOUND_DYLIB-OBSOLETE %s
+INVALID-PREBOUND_DYLIB-OBSOLETE: macho-invalid-prebound_dylib-obsolete': truncated or malformed object (load command 0 for cmd value of: 16 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-ident-obsolete 2>&1 | FileCheck -check-prefix INVALID-IDENT-OBSOLETE %s
+INVALID-IDENT-OBSOLETE: macho-invalid-ident-obsolete': truncated or malformed object (load command 0 for cmd value of: 8 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-fvmfile-obsolete 2>&1 | FileCheck -check-prefix INVALID-FVMFILE-OBSOLETE %s
+INVALID-FVMFILE-OBSOLETE: macho-invalid-fvmfile-obsolete': truncated or malformed object (load command 0 for cmd value of: 9 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-prepage-obsolete 2>&1 | FileCheck -check-prefix INVALID-PREPAGE-OBSOLETE %s
+INVALID-PREPAGE-OBSOLETE: macho-invalid-prepage-obsolete': truncated or malformed object (load command 0 for cmd value of: 10 is obsolete and not supported)
OpenPOWER on IntegriCloud