Commit Graph

82 Commits

Author SHA1 Message Date
Kevin Enderby
6248d1b153 Add the option, -universal-headers, used with -macho to print the Mach-O universal headers to llvm-objdump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225537 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 19:22:37 +00:00
Kevin Enderby
60e9ca4c0f Slightly refactor things for llvm-objdump and the -macho option so it can be used with
options other than just -disassemble so that universal files can be used with other
options combined with -arch options.

No functional change to existing options and use.  One test case added for the
additional functionality with a universal file an a -arch option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225383 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 21:02:18 +00:00
Kevin Enderby
9a516cdc3e Add printing the LC_THREAD load commands with llvm-objdump’s -private-headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224792 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-23 22:56:39 +00:00
Kevin Enderby
5ebdee51db Add printing the LC_ROUTINES load commands with llvm-objdump’s -private-headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224627 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 22:25:22 +00:00
Kevin Enderby
728b8cfc76 Add printing the LC_SUB_CLIENT load command with llvm-objdump’s -private-headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224616 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 21:06:24 +00:00
Kevin Enderby
2ef4e25dd1 Add printing the LC_SUB_LIBRARY load command with llvm-objdump’s -private-headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224607 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 19:48:16 +00:00
Kevin Enderby
604a34e086 Add printing the LC_SUB_UMBRELLA load command with llvm-objdump’s -private-headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224548 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 23:13:26 +00:00
Kevin Enderby
a42da31d2c Add printing the LC_SUB_FRAMEWORK load command with llvm-objdump’s -private-headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 19:24:35 +00:00
Kevin Enderby
1025e9e9d6 Add printing the LC_LINKER_OPTION load command with llvm-objdump’s -private-headers.
Also corrected the name of the load command to not end in an ’S’ as well as corrected
the name of the MachO::linker_option_command struct and other places that had the
word option as plural which did not match the Mac OS X headers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224485 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 00:53:40 +00:00
Kevin Enderby
e479df2161 Add printing the LC_ENCRYPTION_INFO_64 load command with llvm-objdump’s -private-headers
and add tests for the two AArch64 binaries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224400 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-17 01:01:30 +00:00
Kevin Enderby
46a81fde99 Add printing the LC_ENCRYPTION_INFO load command with llvm-objdump’s -private-headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224390 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 23:25:52 +00:00
Kevin Enderby
5b7369ddf5 Fix a bug in llvm-objdump’s -private-headers for the LC_VERSION_MIN_IPHONEOS
load command not getting printed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224376 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 21:48:27 +00:00
Kevin Enderby
c981753745 Fix a bug in llvm-objdump’s -private-headers for 32-bit Mach-O files
printing the section header.  And add some tests for this for 32-bit files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224302 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 01:14:45 +00:00
Kevin Enderby
543abe4906 Re-add support to llvm-objdump for Mach-O universal files and archives with -macho
with fixes.  Includes the move of tests for llvm-objdump for universal files to an X86
directory.  And the fix where it was failing on linux Rafael tracked down with asan.
I had both Jim Grosbach and Adam Hemet look over the second fix since I could not
set up asan to reproduce with the old version but not with the fix.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223416 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 23:56:27 +00:00
Rafael Espindola
cc0061b299 This reverts commit r223306 and r223277.
The code is using uninitialized memory and failing on linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223315 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 23:29:34 +00:00
Kevin Enderby
15d4003c46 Move tests for llvm-objdump for universal files to X86 directory to fix build bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223306 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 23:00:16 +00:00
Kevin Enderby
5b9d42b68c Add support to llvm-objdump for Mach-O universal files and archives with -macho.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223277 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 22:29:40 +00:00
Kevin Enderby
61ab3a1cc5 Add the code and test cases for 64-bit ARM to llvm-objdump’s Mach-O symbolizer.
FYI, removed the unused MCInstrAnalysis as it does not exist for 64-bit ARM and
was causing a “couldn't initialize disassembler for target” error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222045 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 21:52:18 +00:00
David Majnemer
1dd631fe02 llvm-objdump: Skip empty sections when dumping contents
Empty sections are just noise when using objdump.
This is similar to what binutils does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221680 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 09:58:25 +00:00
Kevin Enderby
3b80486e3a Plumb in the ARM thumb symbolizer in llvm-objdump’s Mach-O disassembler and
add the code and test cases for 32-bit ARM symbolizer.

Also fixed the printing of data in code as it was not using the table correctly
and needed to fix one of the test cases too.

This will break lld’s test/mach-o/arm-interworking-movw.yaml till the tweak
for that is made. Which I’ll be committing immediately after this commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221470 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-06 19:00:13 +00:00
Kevin Enderby
a25032214d Add the code and test cases for 32-bit Intel to llvm-objdump’s Mach-O symbolizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221211 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 00:43:16 +00:00
NAKAMURA Takumi
68a70cdbfb macho-symbolized-disassembly.test: Don't check C++ demangler unconditionally.
For example, MS PSDK is not expected to have <cxxabi.h>.
You should introduce the new feature in lit.cfg corresponding to HAVE_CXXABI_H if you would like to test demangler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220840 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-29 08:08:21 +00:00
Kevin Enderby
17380c7afa Update llvm-objdump’s Mach-O symbolizer code to demangle C++ names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220833 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-28 23:39:46 +00:00
Kevin Enderby
a1afbd6421 Update llvm-objdump’s Mach-O symbolizer code for Objective-C references.
This prints disassembly comments for Objective-C references to CFStrings,
Selectors, Classes and method calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220500 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 19:37:31 +00:00
Nick Kledzik
5357e3ae1b [llvm-objdump] don't test timestamp dump as that is time zone dependent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220123 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 02:28:01 +00:00
Nick Kledzik
e0b3f29da9 [llvm-objdump] enhance test case for mach-o -private-headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220120 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 01:50:55 +00:00
Nick Kledzik
50ede1623d [llvm-objdump] Fix mach-o binding decompression error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220119 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 01:21:02 +00:00
Nick Kledzik
1a0afd82b1 [llvm-objdump] Update error message and add test case for mach-o file with bad library ordinals
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219746 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14 23:29:38 +00:00
Kevin Enderby
7118c73867 Update llvm-objdump’s Mach-O symbolizer code to print the name of symbol stubs.
So in fully linked images when a call is made through a stub it now gets a
comment like the following in the disassembly:

    callq	0x100000f6c             ## symbol stub for: _printf

indicating the call is to a symbol stub and which symbol it is for.  This is
done for branch reference types and seeing if the branch target is in a stub
section and if so using the indirect symbol table entry for that stub and
using that symbol table entries symbol name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218546 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26 22:20:44 +00:00
Kevin Enderby
e793862979 Flush out enough of llvm-objdump’s SymbolizerSymbolLookUp() for Mach-O files to
get the literal string “Hello world” printed as a comment on the instruction
that loads the pointer to it. For now this is just for x86_64. So for object
files with relocation entries it produces things like:

	leaq	L_.str(%rip), %rax      ## literal pool for: "Hello world\n"

and similar for fully linked images like executables:

	leaq	0x4f(%rip), %rax        ## literal pool for: "Hello world\n"

Also to allow testing against darwin’s otool(1), I hooked up the existing 
-no-show-raw-insn option to the Mach-O parser code, added the new Mach-O
only -full-leading-addr option to match otool(1)'s printing of addresses and
also added the new -print-imm-hex option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218423 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 23:08:22 +00:00
Nick Kledzik
69e88e8b40 [llvm-objdump] clean up test cases now that build bots are green
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217985 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 21:53:07 +00:00
Nick Kledzik
2b90611892 [llvm-objdump] properly use c_str() with format("%s"). Improve getLibraryShortNameByIndex() error handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217930 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 00:25:22 +00:00
Nick Kledzik
a0b4148700 tweak test case for debugging bot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217906 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 21:29:54 +00:00
Kevin Enderby
fdedee296f Hookup the MCSymbolizer to llvm-objdump’s disassembly for Mach-O files.
First step done in this commit is to get flush out enough of the
SymbolizerGetOpInfo() routine to symbolic an X86_64 hello world .o and
its loading of the literal string and call to printf.  Also the code to
symbolicate the X86_64_RELOC_SUBTRACTOR relocation and a test is also
added to show a slightly more complicated case.

Next will be to flush out enough of SymbolizerSymbolLookUp() to get the
literal string “Hello world” printed as a comment on the instruction that load
the pointer to it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217893 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 18:00:57 +00:00
Nick Kledzik
91737e133a tweak test case to help build bot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217860 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 04:51:38 +00:00
Nick Kledzik
23ed1eab04 tweak test case to help solve why failing on one build bot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217856 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 02:33:36 +00:00
Nick Kledzik
367cf70f27 [llvm-objdump] for mach-o add -bind, -lazy-bind, and -weak-bind options
This finishes the ability of llvm-objdump to print out all information from
the LC_DYLD_INFO load command.

The -bind option prints out symbolic references that dyld must resolve 
immediately.

The -lazy-bind option prints out symbolc reference that are lazily resolved on 
first use.

The -weak-bind option prints out information about symbols which dyld must
try to coalesce across images.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217853 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 01:41:51 +00:00
Nick Kledzik
2981a19485 Stop suppress error messages in test case to see why one buildbot is failing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217715 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12 22:46:01 +00:00
Nick Kledzik
a240fc5cb9 [llvm-objdump] support -rebase option for mach-o to dump rebasing info
Similar to my previous -exports-trie option, the -rebase option dumps info from
the LC_DYLD_INFO load command. The rebasing info is a list of the the locations
that dyld needs to adjust if a mach-o image is not loaded at its preferred 
address. Since ASLR is now the default, images almost never load at their
preferred address, and thus need to be rebased by dyld.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217709 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12 21:34:15 +00:00
Tim Northover
4faf24b6b7 llvm-objdump: don't crash when __compact_unwind has no relocs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217433 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-09 10:45:06 +00:00
Kevin Enderby
54dfc533fc Removed the ctime printed “time stamp” from macho-private-headers.test to fix the builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217175 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 17:13:44 +00:00
Kevin Enderby
37598b62a7 Adds the next bit of support for llvm-objdump’s -private-headers for executable Mach-O files.
This adds the printing of more load commands, so that the normal load commands
in a typical X86 Mach-O executable can all be printed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217172 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 16:54:47 +00:00
Nick Kledzik
46d52b1627 Fix test case to match correct llvm-objdump output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217006 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 01:34:58 +00:00
Nick Kledzik
aa4d2acf37 Object/llvm-objdump: allow dumping of mach-o exports trie
MachOObjectFile in lib/Object currently has no support for parsing the rebase, 
binding, and export information from the LC_DYLD_INFO load command in final 
linked mach-o images. This patch adds support for parsing the exports trie data
structure. It also adds an option to llvm-objdump to dump that export info.

I did the exports parsing first because it is the hardest. The information is 
encoded in a trie structure, but the standard ObjectFile way to inspect content 
is through iterators. So I needed to make an iterator that would do a 
non-recursive walk through the trie and maintain the concatenation of edges 
needed for the current string prefix.

I plan to add similar support in MachOObjectFile and llvm-objdump to 
parse/display the rebasing and binding info too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216808 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-30 00:20:14 +00:00
Kevin Enderby
e306159429 Next bit of support for llvm-objdump’s -private-headers for Mach-O files.
This adds the printing of the LC_SEGMENT load command and sections,
LC_SYMTAB and LC_DYSYMTAB load commands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216795 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 22:30:52 +00:00
Kevin Enderby
d9757b42ad Add the start of the support for llvm-objdump’s -private-headers for Mach-O files.
This adds the printing of the mach header. Load command printing will be next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216285 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-22 20:35:18 +00:00
Kevin Enderby
f759032ccd Make llvm-objdump handle both arm and thumb disassembly from the same Mach-O
file with -macho, the Mach-O specific object file parser option.

After some discussion I chose to do this implementation contained in the logic
of llvm-objdump’s MachODump.cpp using a second disassembler for thumb when
needed and with updates mostly contained in the MachOObjectFile class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215931 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-18 20:21:02 +00:00
Tim Northover
48bfab80aa llvm-objdump: print contents of MachO __unwind_info sections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215437 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 11:52:59 +00:00
NAKAMURA Takumi
94287f1561 llvm/test/tools/llvm-objdump: Reorganize target-dependent some tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215122 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 17:17:19 +00:00
Kevin Enderby
75d423feed Add the -mcpu= option to llvm-objdump for use with the disassemblers.
Also make the disassembler created with the Mach-O parser (the -m option)
pick up the Target specific attributes specified with -mattr option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215032 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-06 23:24:41 +00:00