aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-01-06Don't loop endlessly for MachO files with 0 ncmdsFilipe Cabecinhas1-0/+3
llvm-svn: 225271
2014-12-23Add printing the LC_THREAD load commands with llvm-objdump’s -private-headers.Kevin Enderby1-0/+5
llvm-svn: 224792
2014-12-19Add printing the LC_ROUTINES load commands with llvm-objdump’s ↵Kevin Enderby1-0/+10
-private-headers. llvm-svn: 224627
2014-12-19Add printing the LC_SUB_CLIENT load command with llvm-objdump’s ↵Kevin Enderby1-0/+5
-private-headers. llvm-svn: 224616
2014-12-19Add printing the LC_SUB_LIBRARY load command with llvm-objdump’s ↵Kevin Enderby1-0/+5
-private-headers. llvm-svn: 224607
2014-12-19[Object] Don't crash on empty export lists.Juergen Ributzka1-1/+4
Summary: This fixes the exports iterator if the export list is empty. Reviewers: Bigcheese, kledzik Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6732 llvm-svn: 224563
2014-12-18Add printing the LC_SUB_UMBRELLA load command with llvm-objdump’s ↵Kevin Enderby1-0/+5
-private-headers. llvm-svn: 224548
2014-12-18Add printing the LC_SUB_FRAMEWORK load command with llvm-objdump’s ↵Kevin Enderby1-0/+4
-private-headers. llvm-svn: 224534
2014-12-18Add printing the LC_LINKER_OPTION load command with llvm-objdump’s ↵Kevin Enderby1-3/+3
-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. llvm-svn: 224485
2014-12-17Add printing the LC_ENCRYPTION_INFO_64 load command with llvm-objdump’s ↵Kevin Enderby1-0/+5
-private-headers and add tests for the two AArch64 binaries. llvm-svn: 224400
2014-12-16Add printing the LC_ENCRYPTION_INFO load command with llvm-objdump’s ↵Kevin Enderby1-0/+5
-private-headers. llvm-svn: 224390
2014-12-10Move three methods only used by MCJIT to MCJIT.Rafael Espindola1-21/+6
These methods are only used by MCJIT and are very specific to it. In fact, they are also fairly specific to the fact that we have a dynamic linker of relocatable objects. llvm-svn: 223964
2014-12-04Add mach-o LC_RPATH support to llvm-objdumpJean-Daniel Dupas1-0/+5
Summary: Add rpath load command support in Mach-O object and update llvm-objdump to use it. Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6512 llvm-svn: 223343
2014-11-13Object, Mach-O: Refactor and clean code upDavid Majnemer1-12/+25
Don't assert if we can return an error code, reuse existing functionality like is64Bit(). llvm-svn: 221915
2014-11-04Remove the static version of getScatteredRelocationType() now that r221211 addedKevin Enderby1-5/+0
a public version MachOObjectFile::getScatteredRelocationType(). This should fix the build bot for the unused function error. llvm-svn: 221216
2014-11-04Add the code and test cases for 32-bit Intel to llvm-objdump’s Mach-O ↵Kevin Enderby1-0/+5
symbolizer. llvm-svn: 221211
2014-10-27Fix unicode chars into ascii in comment lines.NAKAMURA Takumi1-1/+1
llvm-svn: 220668
2014-10-24[Object] Fix MachO's getUuid to return a pointer into the object instead of ↵Benjamin Kramer1-2/+3
a dangling ArrayRef. This works because uuid's are always little endian so it's not swapped. Fixes use-after-return reported by asan. llvm-svn: 220567
2014-10-23Update llvm-objdump’s Mach-O symbolizer code for Objective-C references.Kevin Enderby1-2/+38
This prints disassembly comments for Objective-C references to CFStrings, Selectors, Classes and method calls. llvm-svn: 220500
2014-10-21[MCJIT] Temporarily revert r220245 - it broke several bots.Lang Hames1-3/+0
(See e.g. http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/17653) llvm-svn: 220249
2014-10-20[MCJIT] Make MCJIT honor symbol visibility settings when populating the globalLang Hames1-0/+3
symbol table. Patch by Anthony Pesch. Thanks Anthony! llvm-svn: 220245
2014-10-18[llvm-objdump] Fix mach-o binding decompression errorNick Kledzik1-3/+3
llvm-svn: 220119
2014-10-15Add MachOObjectFile::getUuid()Alexander Potapenko1-1/+10
This CL introduces MachOObjectFile::getUuid(). This function returns an ArrayRef to the object file's UUID, or an empty ArrayRef if the object file doesn't contain an LC_UUID load command. The new function is gonna be used by llvm-symbolizer. llvm-svn: 219866
2014-10-08Remove bogus std::error_code returns form SectionRef.Rafael Espindola1-81/+41
There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. llvm-svn: 219314
2014-09-17[Object] keep trailing '\0' out of StringRef when parsing mach-o bindingsNick Kledzik1-1/+1
llvm-svn: 217935
2014-09-17[llvm-objdump] properly use c_str() with format("%s"). Improve ↵Nick Kledzik1-10/+5
getLibraryShortNameByIndex() error handling. llvm-svn: 217930
2014-09-16[llvm-objdump] for mach-o add -bind, -lazy-bind, and -weak-bind optionsNick Kledzik1-1/+281
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. llvm-svn: 217853
2014-09-12[llvm-objdump] support -rebase option for mach-o to dump rebasing infoNick Kledzik1-0/+172
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. llvm-svn: 217709
2014-09-04Adds the next bit of support for llvm-objdump’s -private-headers for ↵Kevin Enderby1-0/+25
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. llvm-svn: 217172
2014-09-02Code review tweaksNick Kledzik1-9/+9
llvm-svn: 216931
2014-08-30Fix typo and formattingNick Kledzik1-3/+3
llvm-svn: 216809
2014-08-30Object/llvm-objdump: allow dumping of mach-o exports trieNick Kledzik1-2/+241
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. llvm-svn: 216808
2014-08-27Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper1-2/+2
just letting them be implicitly created. llvm-svn: 216525
2014-08-19Don't own the buffer in object::Binary.Rafael Espindola1-10/+9
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too. Keeping this ownership would make supporting IR inside native objects particularly painful. This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer. This patch introduces a few new types. * MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer. The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how. llvm-svn: 216002
2014-08-18Make llvm-objdump handle both arm and thumb disassembly from the same Mach-OKevin Enderby1-1/+84
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. llvm-svn: 215931
2014-08-17llvm-objdump: don't print relocations in non-relocatable files.Rafael Espindola1-0/+4
This matches the behavior of GNU objdump. llvm-svn: 215844
2014-08-08Delete dead code. NFC.Rafael Espindola1-20/+0
llvm-svn: 215224
2014-08-08getLoadName is only implemented for ELF, make it ELF only.Rafael Espindola1-5/+0
llvm-svn: 215219
2014-08-08Use a simpler predicate. NFC.Rafael Espindola1-31/+19
llvm-svn: 215218
2014-08-08pr20589: Fix duplicated arch flag.Rafael Espindola1-1/+1
llvm-svn: 215216
2014-08-07Add two missing ARM cpusubtypes to the switch statement in Kevin Enderby1-0/+4
MachOObjectFile::getArch(uint32_t CPUType, uint32_t CPUSubType) . Upcoming changes will cause existing test cases to use this but I wanted to check in this obvious change separately. llvm-svn: 215150
2014-07-31Use std::unique_ptr to make the ownership explicit.Rafael Espindola1-2/+2
llvm-svn: 214377
2014-07-23AArch64: remove arm64 triple enumerator.Tim Northover1-2/+1
Having both Triple::arm64 and Triple::aarch64 is extremely confusing, and invites bugs where only one is checked. In reality, the only legitimate difference between the two (arm64 usually means iOS) is also present in the OS part of the triple and that's what should be checked. We still parse the "arm64" triple, just canonicalise it to Triple::aarch64, so there aren't any LLVM-side test changes. llvm-svn: 213743
2014-07-20Namespace cleanup (no functional change)Artyom Skrobov1-11/+7
llvm-svn: 213478
2014-07-18extracting swapStruct into include/llvm/Support/MachO.h (no functional change)Artyom Skrobov1-208/+9
llvm-svn: 213361
2014-07-15[RuntimeDyld] Revert r211652 - MachO object GDB registration support.Lang Hames1-5/+1
The registration scheme used in r211652 violated the read-only contract of MemoryBuffer. This caused crashes in llvm-rtdyld where macho objects were backed by read-only mmap'd memory. llvm-svn: 213086
2014-07-04llvm-readobj: fix MachO relocatoin printing a bit.Tim Northover1-0/+3
There were two issues here: 1. At the very least, scattered relocations cannot use the same code to determine the corresponding symbol being referred to. For some reason we pretend there is no symbol, even when one actually exists in the symtab, so to match this behaviour getRelocationSymbol should simply return symbols_end for scattered relocations. 2. Printing "-" when we can't get a symbol (including the scattered case, but not exclusively), isn't that helpful. In both cases there *is* interesting information in that field, so we should print it. As hex will do. Small part of rdar://problem/17553104 llvm-svn: 212332
2014-06-30Speculatively fix some code handling Power64 MachO filesReid Kleckner1-1/+1
MSVC was warning on a switch containing only default labels. In this instance, it looks like it uncovered a real bug. :) llvm-svn: 212062
2014-06-30Add the -arch flag support to llvm-nm to select the slice out of a Mach-OKevin Enderby1-0/+102
universal file. This also includes support for -arch all, selecting the host architecture by default from a universal file and checking if -arch is used with a standard Mach-O it matches that architecture. llvm-svn: 212054
2014-06-30macho-dump: add code to print LC_ID_DYLIB load commands.Tim Northover1-0/+6
I want to check them in lld. llvm-svn: 212043