diff options
| author | Dave Lee <davelee.com@gmail.com> | 2018-08-03 00:06:38 +0000 |
|---|---|---|
| committer | Dave Lee <davelee.com@gmail.com> | 2018-08-03 00:06:38 +0000 |
| commit | 3fb120f12eb612b66208496b96b4735f43aac864 (patch) | |
| tree | c83eb7491615e33b08cd9f7d1cf208e0477b86cd /llvm/test/tools/llvm-objdump | |
| parent | 1ba5e9ac249fc425abe4f1be70d04960c0ce957a (diff) | |
| download | bcm5719-llvm-3fb120f12eb612b66208496b96b4735f43aac864.tar.gz bcm5719-llvm-3fb120f12eb612b66208496b96b4735f43aac864.zip | |
objdump: Better handling of Mach-O universal binaries
Summary:
With Mach-O, there is a flag requirement discrepancy between working with
universal binaries and thin binaries. Many flags that don't require the `-macho`
flag (for example `-private-headers` and `-disassemble`) fail to work on
universal binaries unless `-macho` is given. When this happens, the error
message is unhelpful, stating:
The file was not recognized as a valid object file.
Which can lead to confusion.
This change allows generic flags to be used on universal binaries with and
without the `-macho` flag. This means flags that can be used for thin files can
be used consistently with fat files too.
To do this, the universal binary support within `ParseInputMachO()` is extracted
into a new function. This new function is called directly from `DumpInput()`
when the input binary is universal. Additionally the `-arch` flag validation in
`ParseInputMachO()` was extracted to be reused.
Reviewers: compnerd
Reviewed By: compnerd
Subscribers: keith, llvm-commits
Differential Revision: https://reviews.llvm.org/D48702
llvm-svn: 338792
Diffstat (limited to 'llvm/test/tools/llvm-objdump')
| -rw-r--r-- | llvm/test/tools/llvm-objdump/X86/macho-private-headers.test | 2 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objdump/X86/macho-private-headers.test b/llvm/test/tools/llvm-objdump/X86/macho-private-headers.test index d1ea0cf140b..b8642fcf6e0 100644 --- a/llvm/test/tools/llvm-objdump/X86/macho-private-headers.test +++ b/llvm/test/tools/llvm-objdump/X86/macho-private-headers.test @@ -19,6 +19,8 @@ // RUN: | FileCheck %s -check-prefix=THREAD // RUN: llvm-objdump -macho -p -arch i386 %p/Inputs/macho-universal.x86_64.i386 \ // RUN: | FileCheck %s -check-prefix=FATi386 +// RUN: llvm-objdump -p -arch i386 %p/Inputs/macho-universal.x86_64.i386 \ +// RUN: | FileCheck %s -check-prefix=FATi386 // RUN: llvm-objdump -p -non-verbose %p/Inputs/hello.obj.macho-x86_64 \ // RUN: | FileCheck %s -check-prefix=NON_VERBOSE // RUN: llvm-objdump -p %p/Inputs/codesig.macho-x86_64 \ diff --git a/llvm/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test b/llvm/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test index 9089716f7a5..6de7e18e437 100644 --- a/llvm/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test +++ b/llvm/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test @@ -1,5 +1,7 @@ RUN: llvm-objdump %p/Inputs/macho-universal.x86_64.i386 -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -arch all \ RUN: | FileCheck %s -check-prefix UEXE-all +RUN: llvm-objdump %p/Inputs/macho-universal.x86_64.i386 -d -no-show-raw-insn -full-leading-addr -print-imm-hex -arch all \ +RUN: | FileCheck %s -check-prefix UEXE-all RUN: llvm-objdump %p/Inputs/macho-universal-archive.x86_64.i386 -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -arch i386 \ RUN: | FileCheck %s -check-prefix UArchive-i386 RUN: llvm-objdump %p/Inputs/macho-universal.x86_64.i386 -universal-headers -m \ |

