summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* dd the option, -link-opt-hints to llvm-objdump used with -macho to print theKevin Enderby2015-01-271-2/+25
| | | | | | Mach-O AArch64 linker optimization hints for ADRP code optimization. llvm-svn: 227246
* Fix edge case when Start overflowed in 32 bit modeFilipe Cabecinhas2015-01-151-2/+3
| | | | llvm-svn: 226229
* Report fatal errors instead of segfaulting/asserting on a few invalid ↵Filipe Cabecinhas2015-01-151-8/+46
| | | | | | | | | | | | | | | | | accesses while reading MachO files. Summary: Shift an older “invalid file” test to get a consistent naming for these tests. Bugs found by afl-fuzz Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6945 llvm-svn: 226219
* [Object] Add SF_Exported flag. This flag will be set on all symbols that wouldLang Hames2015-01-151-0/+3
| | | | | | | | | be exported from a dylib if their containing object file were linked into one. No test case: No command line tools query this flag, and there are no Object unit tests. llvm-svn: 226217
* Don't loop endlessly for MachO files with 0 ncmdsFilipe Cabecinhas2015-01-061-0/+3
| | | | llvm-svn: 225271
* Add printing the LC_THREAD load commands with llvm-objdump’s -private-headers.Kevin Enderby2014-12-231-0/+5
| | | | llvm-svn: 224792
* Add printing the LC_ROUTINES load commands with llvm-objdump’s ↵Kevin Enderby2014-12-191-0/+10
| | | | | | -private-headers. llvm-svn: 224627
* Add printing the LC_SUB_CLIENT load command with llvm-objdump’s ↵Kevin Enderby2014-12-191-0/+5
| | | | | | -private-headers. llvm-svn: 224616
* Add printing the LC_SUB_LIBRARY load command with llvm-objdump’s ↵Kevin Enderby2014-12-191-0/+5
| | | | | | -private-headers. llvm-svn: 224607
* [Object] Don't crash on empty export lists.Juergen Ributzka2014-12-191-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
* Add printing the LC_SUB_UMBRELLA load command with llvm-objdump’s ↵Kevin Enderby2014-12-181-0/+5
| | | | | | -private-headers. llvm-svn: 224548
* Add printing the LC_SUB_FRAMEWORK load command with llvm-objdump’s ↵Kevin Enderby2014-12-181-0/+4
| | | | | | -private-headers. llvm-svn: 224534
* Add printing the LC_LINKER_OPTION load command with llvm-objdump’s ↵Kevin Enderby2014-12-181-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
* Add printing the LC_ENCRYPTION_INFO_64 load command with llvm-objdump’s ↵Kevin Enderby2014-12-171-0/+5
| | | | | | | | -private-headers and add tests for the two AArch64 binaries. llvm-svn: 224400
* Add printing the LC_ENCRYPTION_INFO load command with llvm-objdump’s ↵Kevin Enderby2014-12-161-0/+5
| | | | | | -private-headers. llvm-svn: 224390
* Move three methods only used by MCJIT to MCJIT.Rafael Espindola2014-12-101-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
* Add mach-o LC_RPATH support to llvm-objdumpJean-Daniel Dupas2014-12-041-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
* Object, Mach-O: Refactor and clean code upDavid Majnemer2014-11-131-12/+25
| | | | | | | Don't assert if we can return an error code, reuse existing functionality like is64Bit(). llvm-svn: 221915
* Remove the static version of getScatteredRelocationType() now that r221211 addedKevin Enderby2014-11-041-5/+0
| | | | | | | | a public version MachOObjectFile::getScatteredRelocationType(). This should fix the build bot for the unused function error. llvm-svn: 221216
* Add the code and test cases for 32-bit Intel to llvm-objdump’s Mach-O ↵Kevin Enderby2014-11-041-0/+5
| | | | | | symbolizer. llvm-svn: 221211
* Fix unicode chars into ascii in comment lines.NAKAMURA Takumi2014-10-271-1/+1
| | | | llvm-svn: 220668
* [Object] Fix MachO's getUuid to return a pointer into the object instead of ↵Benjamin Kramer2014-10-241-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
* Update llvm-objdump’s Mach-O symbolizer code for Objective-C references.Kevin Enderby2014-10-231-2/+38
| | | | | | | This prints disassembly comments for Objective-C references to CFStrings, Selectors, Classes and method calls. llvm-svn: 220500
* [MCJIT] Temporarily revert r220245 - it broke several bots.Lang Hames2014-10-211-3/+0
| | | | | | (See e.g. http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/17653) llvm-svn: 220249
* [MCJIT] Make MCJIT honor symbol visibility settings when populating the globalLang Hames2014-10-201-0/+3
| | | | | | | | symbol table. Patch by Anthony Pesch. Thanks Anthony! llvm-svn: 220245
* [llvm-objdump] Fix mach-o binding decompression errorNick Kledzik2014-10-181-3/+3
| | | | llvm-svn: 220119
* Add MachOObjectFile::getUuid()Alexander Potapenko2014-10-151-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
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-081-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
* [Object] keep trailing '\0' out of StringRef when parsing mach-o bindingsNick Kledzik2014-09-171-1/+1
| | | | llvm-svn: 217935
* [llvm-objdump] properly use c_str() with format("%s"). Improve ↵Nick Kledzik2014-09-171-10/+5
| | | | | | getLibraryShortNameByIndex() error handling. llvm-svn: 217930
* [llvm-objdump] for mach-o add -bind, -lazy-bind, and -weak-bind optionsNick Kledzik2014-09-161-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
* [llvm-objdump] support -rebase option for mach-o to dump rebasing infoNick Kledzik2014-09-121-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
* Adds the next bit of support for llvm-objdump’s -private-headers for ↵Kevin Enderby2014-09-041-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
* Code review tweaksNick Kledzik2014-09-021-9/+9
| | | | llvm-svn: 216931
* Fix typo and formattingNick Kledzik2014-08-301-3/+3
| | | | llvm-svn: 216809
* Object/llvm-objdump: allow dumping of mach-o exports trieNick Kledzik2014-08-301-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
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-2/+2
| | | | | | just letting them be implicitly created. llvm-svn: 216525
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-191-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
* Make llvm-objdump handle both arm and thumb disassembly from the same Mach-OKevin Enderby2014-08-181-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
* llvm-objdump: don't print relocations in non-relocatable files.Rafael Espindola2014-08-171-0/+4
| | | | | | This matches the behavior of GNU objdump. llvm-svn: 215844
* Delete dead code. NFC.Rafael Espindola2014-08-081-20/+0
| | | | llvm-svn: 215224
* getLoadName is only implemented for ELF, make it ELF only.Rafael Espindola2014-08-081-5/+0
| | | | llvm-svn: 215219
* Use a simpler predicate. NFC.Rafael Espindola2014-08-081-31/+19
| | | | llvm-svn: 215218
* pr20589: Fix duplicated arch flag.Rafael Espindola2014-08-081-1/+1
| | | | llvm-svn: 215216
* Add two missing ARM cpusubtypes to the switch statement in Kevin Enderby2014-08-071-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
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-311-2/+2
| | | | llvm-svn: 214377
* AArch64: remove arm64 triple enumerator.Tim Northover2014-07-231-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
* Namespace cleanup (no functional change)Artyom Skrobov2014-07-201-11/+7
| | | | llvm-svn: 213478
* extracting swapStruct into include/llvm/Support/MachO.h (no functional change)Artyom Skrobov2014-07-181-208/+9
| | | | llvm-svn: 213361
* [RuntimeDyld] Revert r211652 - MachO object GDB registration support.Lang Hames2014-07-151-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
OpenPOWER on IntegriCloud