summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-06-28 23:16:13 +0000
committerKevin Enderby <enderby@apple.com>2016-06-28 23:16:13 +0000
commit42398051d8fb6fed821703280b1da4bc0694ceea (patch)
tree4c5ba4d9ec19e6b14129eeb31f620f68ed612f0b /llvm/test/Object
parent9c12639370c43d58d43f9a5a87128f1da5c93a1c (diff)
downloadbcm5719-llvm-42398051d8fb6fed821703280b1da4bc0694ceea.tar.gz
bcm5719-llvm-42398051d8fb6fed821703280b1da4bc0694ceea.zip
Finish cleaning up most of the error handling in libObject’s MachOUniversalBinary
and its clients to use the new llvm::Error model for error handling. Changed getAsArchive() from ErrorOr<...> to Expected<...> so now all interfaces there use the new llvm::Error model for return values. In the two places it had if (!Parent) this is actually a program error so changed from returning errorCodeToError(object_error::parse_failed) to calling report_fatal_error() with a message. In getObjectForArch() added error messages to its two llvm::Error return values instead of returning errorCodeToError(object_error::arch_not_found) with no error message. For the llvm-obdump, llvm-nm and llvm-size clients since the only binary files in Mach-O Universal Binaries that are supported are Mach-O files or archives with Mach-O objects, updated their logic to generate an error when a slice contains something like an ELF binary instead of ignoring it. And added a test case for that. The last error stuff to be cleaned up for libObject’s MachOUniversalBinary is the use of errorOrToExpected(Archive::create(ObjBuffer)) which needs Archive::create() to be changed from ErrorOr<...> to Expected<...> first, which I’ll work on next. llvm-svn: 274079
Diffstat (limited to 'llvm/test/Object')
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-fat.obj.elf-x86_64bin0 -> 1516 bytes
-rw-r--r--llvm/test/Object/macho-invalid.test3
2 files changed, 3 insertions, 0 deletions
diff --git a/llvm/test/Object/Inputs/macho-invalid-fat.obj.elf-x86_64 b/llvm/test/Object/Inputs/macho-invalid-fat.obj.elf-x86_64
new file mode 100644
index 00000000000..4fa5afb9087
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-fat.obj.elf-x86_64
Binary files differ
diff --git a/llvm/test/Object/macho-invalid.test b/llvm/test/Object/macho-invalid.test
index 4c66f5c402e..0be522eb49b 100644
--- a/llvm/test/Object/macho-invalid.test
+++ b/llvm/test/Object/macho-invalid.test
@@ -97,3 +97,6 @@ INCOMPLETE-SEGMENT-LOADC-FAT-ARCHIVE: macho-universal-archive-bad2.x86_64.i386(m
RUN: not llvm-objdump -macho -universal-headers %p/Inputs/macho-invalid-fat 2>&1 | FileCheck -check-prefix INVALID-FAT %s
INVALID-FAT: truncated or malformed fat file (fat_arch_64 structs would extend past the end of the file)
+
+RUN: not llvm-objdump -macho -private-headers -arch all %p/Inputs/macho-invalid-fat.obj.elf-x86_64 2>&1 | FileCheck -check-prefix INVALID-FAT-ELF %s
+INVALID-FAT-ELF: Mach-O universal file: {{.*}}/macho-invalid-fat.obj.elf-x86_64 for architecture x86_64 is not a Mach-O file or an archive file
OpenPOWER on IntegriCloud