diff options
author | Kevin Enderby <enderby@apple.com> | 2016-06-15 21:14:01 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2016-06-15 21:14:01 +0000 |
commit | d8a6e83dcf7e21b016a1db27a7cb6c1027bd6982 (patch) | |
tree | 431f5634b7dd50c359fb2a11c39e0643adcb295d /llvm/test/tools/llvm-objdump | |
parent | f2a4f8f10a1399dfe99ad50bb8863c66b41d4c4f (diff) | |
download | bcm5719-llvm-d8a6e83dcf7e21b016a1db27a7cb6c1027bd6982.tar.gz bcm5719-llvm-d8a6e83dcf7e21b016a1db27a7cb6c1027bd6982.zip |
Fix llvm-objdump when disassembling a stripped Mach-O binary with the -macho option.
It was printing out nothing in this case.
llvm-objdump tries to disassemble sections a symbol at a time. In the case of a
fully stripped Mach-O executable the only symbol remaining in the (__TEXT,__text)
section is the special linker defined symbol __mh_execute_header . This
symbol is special in that while it is N_SECT symbol in the (__TEXT,__text)
its address is before the start of the (__TEXT,__text). It’s address is the
start of the __TEXT segment which is where the mach header is statically
linked. So the code in DisassembleMachO() needs to deal with this case specially.
rdar://26778273
llvm-svn: 272837
Diffstat (limited to 'llvm/test/tools/llvm-objdump')
-rwxr-xr-x | llvm/test/tools/llvm-objdump/X86/Inputs/hello.exe.stripped.macho-x86_64 | bin | 0 -> 8504 bytes | |||
-rw-r--r-- | llvm/test/tools/llvm-objdump/X86/macho-dis-symname.test | 6 | ||||
-rw-r--r-- | llvm/test/tools/llvm-objdump/X86/macho-disassembly-stripped.test | 6 |
3 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objdump/X86/Inputs/hello.exe.stripped.macho-x86_64 b/llvm/test/tools/llvm-objdump/X86/Inputs/hello.exe.stripped.macho-x86_64 Binary files differnew file mode 100755 index 00000000000..9c52d168bef --- /dev/null +++ b/llvm/test/tools/llvm-objdump/X86/Inputs/hello.exe.stripped.macho-x86_64 diff --git a/llvm/test/tools/llvm-objdump/X86/macho-dis-symname.test b/llvm/test/tools/llvm-objdump/X86/macho-dis-symname.test index 39d16ecba6f..9e4f2e3c71f 100644 --- a/llvm/test/tools/llvm-objdump/X86/macho-dis-symname.test +++ b/llvm/test/tools/llvm-objdump/X86/macho-dis-symname.test @@ -17,3 +17,9 @@ # CHECK-NOT: __start: # CHECK-NOT: 0000000100000d22 # CHECK-NOT: _main: + +# not RUN: llvm-objdump -m -d %p/Inputs/exeThread.macho-x86_64 -dis-symname _environ 2>&1 | FileCheck -check-prefix BAD-SYMAME-1 %s +BAD-SYMAME-1: -dis-symname: _environ not in the section + +# not RUN: llvm-objdump -m -d %p/Inputs/exeThread.macho-x86_64 -dis-symname __mh_execute_header 2>&1 | FileCheck -check-prefix BAD-SYMAME-2 %s +BAD-SYMAME-2: -dis-symname: __mh_execute_header not in any section diff --git a/llvm/test/tools/llvm-objdump/X86/macho-disassembly-stripped.test b/llvm/test/tools/llvm-objdump/X86/macho-disassembly-stripped.test new file mode 100644 index 00000000000..fab86f8b979 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/X86/macho-disassembly-stripped.test @@ -0,0 +1,6 @@ +// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/hello.exe.stripped.macho-x86_64 | FileCheck %s + +CHECK: (__TEXT,__text) section +CHECK: 0000000100000f30 pushq %rbp +CHECK: 0000000100000f31 movq %rsp, %rbp +CHECK: 0000000100000f34 subq $0x20, %rsp |