summaryrefslogtreecommitdiff
path: root/tools/llvm-readobj/MachODumper.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-03-17[C++11] Introduce ObjectFile::symbols() to use range-based loops.Alexey Samsonov1-27/+24
Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3081 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204031 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14[C++11] Introduce SectionRef::relocations() to use range-based loopsAlexey Samsonov1-19/+16
Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3077 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203927 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13[C++11] Use ObjectFile::sections() in commandline llvm toolsAlexey Samsonov1-41/+34
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06Fix warning about mismatched signs in comparison.Rafael Espindola1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203155 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06Fix the printing of n_type.Rafael Espindola1-4/+7
Despite the name, n_type contains the type of the symbol, but also if it is extern or private extern. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203154 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06Use the existing N_STAB from the MachO namespace.Rafael Espindola1-5/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203152 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles1-2/+2
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper1-6/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202621 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10Change the begin and end methods in ObjectFile to match the style guide.Rafael Espindola1-14/+14
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201108 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-30Simplify the handling of iterators in ObjectFile.Rafael Espindola1-23/+7
None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end(). This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200442 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-13Re-sort #include lines again, prior to moving headers around.Chandler Carruth1-1/+0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199080 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-01Remove several unused variables.Rafael Espindola1-2/+0
Patch by Alp Toker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191757 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-01Move everything depending on Object/MachOFormat.h over to Support/MachO.h.Charles Davis1-33/+33
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189728 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-27Revert "Fix the build broken by r189315." and "Move everything depending on ↵Charles Davis1-33/+33
Object/MachOFormat.h over to Support/MachO.h." This reverts commits r189319 and r189315. r189315 broke some tests on what I believe are big-endian platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189321 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-27Move everything depending on Object/MachOFormat.h over to Support/MachO.h.Charles Davis1-33/+33
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189315 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-05Handle relocations that don't point to symbols.Rafael Espindola1-4/+3
In ELF (as in MachO), not all relocations point to symbols. Represent this properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj ELF's dumper to handle relocatios without symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183284 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Use pointers to iterate over symbols.Rafael Espindola1-1/+3
While here, don't report a dummy symbol for relocations that don't have symbols. We used to says such relocations were for the first defined symbol, but now we return end_symbols(). The llvm-readobj output change agrees with otool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180214 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22llvm-readobj: Do not print NULL StringRefsNico Rieck1-5/+4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180005 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-18At Jim Grosbach's request detemplate Object/MachO.h.Rafael Espindola1-75/+58
We are still able to handle mixed endian objects by swapping one struct at a time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179778 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-15Remove getters now that we can specialize structs on the host endianness.Rafael Espindola1-3/+3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179534 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-13Finish templating MachObjectFile over endianness.Rafael Espindola1-52/+80
We are now able to handle big endian macho files in llvm-readobject. Thanks to David Fang for providing the object files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179440 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-12Add -expand-relocs to llvm-readobjNico Rieck1-12/+26
This option expands shown relocations from single line to a dictionary format: Relocation { Offset: 0x4 Type: R_386_32 (1) Symbol: sym Info: 0x0 } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179359 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-12Add 179294 back, but don't use bit fields so that it works on big endian hosts.Rafael Espindola1-4/+12
Original message: Print more information about relocations. With this patch llvm-readobj now prints if a relocation is pcrel, its length, if it is extern and if it is scattered. It also refactors the code a bit to use bit fields instead of shifts and masks all over the place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179345 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11Revert my last two commits while I debug what is wrong in a big endian host.Rafael Espindola1-12/+4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179303 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11Print more information about relocations.Rafael Espindola1-4/+12
With this patch llvm-readobj now prints if a relocation is pcrel, its length, if it is extern and if it is scattered. It also refactors the code a bit to use bit fields instead of shifts and masks all over the place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179294 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-10Template MachOObjectFile over endianness too.Rafael Espindola1-8/+8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179179 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-09Convert MachOObjectFile to a template.Rafael Espindola1-13/+15
For now it is templated only on being 64 or 32 bits. I will add little/big endian next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179097 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08Template the MachO types over the word size.Rafael Espindola1-5/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179051 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-07Remove two uses of getObject.Rafael Espindola1-13/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178985 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-07Remove usage of InMemoryStruct in getSymbol.Rafael Espindola1-26/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178984 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-07Remove a use of InMemoryStruct in llvm-readobj.Rafael Espindola1-9/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178981 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-07Make getObject const. Remove a const_cast.Rafael Espindola1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178980 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05Don't fetch pointers from a InMemoryStruct.Rafael Espindola1-15/+8
InMemoryStruct is extremely dangerous as it returns data from an internal buffer when the endiannes doesn't match. This should fix the tests on big endian hosts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178875 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03Implements low-level object file format specific output for COFF andEric Christopher1-0/+438
ELF with support for: - File headers - Section headers + data - Relocations - Symbols - Unwind data (only COFF/Win64) The output format follows a few rules: - Values are almost always output one per line (as elf-dump/coff-dump already do). - Many values are translated to something readable (like enum names), with the raw value in parentheses. - Hex numbers are output in uppercase, prefixed with "0x". - Flags are sorted alphabetically. - Lists and groups are always delimited. Example output: ---------- snip ---------- Sections [ Section { Index: 1 Name: .text (5) Type: SHT_PROGBITS (0x1) Flags [ (0x6) SHF_ALLOC (0x2) SHF_EXECINSTR (0x4) ] Address: 0x0 Offset: 0x40 Size: 33 Link: 0 Info: 0 AddressAlignment: 16 EntrySize: 0 Relocations [ 0x6 R_386_32 .rodata.str1.1 0x0 0xB R_386_PC32 puts 0x0 0x12 R_386_32 .rodata.str1.1 0x0 0x17 R_386_PC32 puts 0x0 ] SectionData ( 0000: 83EC04C7 04240000 0000E8FC FFFFFFC7 |.....$..........| 0010: 04240600 0000E8FC FFFFFF31 C083C404 |.$.........1....| 0020: C3 |.| ) } ] ---------- snip ---------- Relocations and symbols can be output standalone or together with the section header as displayed in the example. This feature set supports all tests in test/MC/COFF and test/MC/ELF (and I suspect all additional tests using elf-dump), making elf-dump and coff-dump deprecated. Patch by Nico Rieck! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178679 91177308-0d34-0410-b5e6-96231b3b80d8