summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-272-6/+5
| | | | | | just letting them be implicitly created. llvm-svn: 216525
* Pass a std::unique_ptr<MemoryBuffer>& to getLazyBitcodeModule.Rafael Espindola2014-08-261-2/+1
| | | | | | | By taking a reference we can do the ownership transfer in one place instead of expecting every caller to do it. llvm-svn: 216492
* Pass a MemoryBufferRef when we can avoid taking ownership.Rafael Espindola2014-08-261-4/+1
| | | | | | | | | | | | | The attached patch simplifies a few interfaces that don't need to take ownership of a buffer. For example, both parseAssembly and parseBitcodeFile will parse the entire buffer before returning. There is no need to take ownership. Using a MemoryBufferRef makes it obvious in the type signature that there is no ownership transfer. llvm-svn: 216488
* Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using ↵David Blaikie2014-08-211-1/+1
| | | | | | std::unique_ptr llvm-svn: 216223
* Fix a pair of use after free. Should bring the bots back.Rafael Espindola2014-08-191-2/+2
| | | | llvm-svn: 216005
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-1910-148/+143
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Added forgotten noexcept.Abramo Bagnara2014-08-181-1/+1
| | | | llvm-svn: 215886
* llvm-objdump: don't print relocations in non-relocatable files.Rafael Espindola2014-08-172-0/+8
| | | | | | This matches the behavior of GNU objdump. llvm-svn: 215844
* Add a non-templated ELFObjectFileBase class.Rafael Espindola2014-08-171-0/+4
| | | | | | | Use it to implement some ELF only virtual interfaces instead of using error prone series of dyn_casts. llvm-svn: 215838
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-131-2/+2
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* AArch64: add support for dynamic-loader relocationsTim Northover2014-08-111-0/+11
| | | | | | | | | LLD needs them, and it's good to be able to print them properly when our object dumpers encounter them. Patch by Daniel Stewart. llvm-svn: 215352
* Delete dead code. NFC.Rafael Espindola2014-08-082-40/+0
| | | | llvm-svn: 215224
* getLoadName is only implemented for ELF, make it ELF only.Rafael Espindola2014-08-082-10/+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
* A std::unique_ptr case I missed in the previous patch.Rafael Espindola2014-07-312-4/+6
| | | | llvm-svn: 214379
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-317-14/+19
| | | | 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
* Correct the ownership passing semantics of object::createBinary and make ↵David Blaikie2014-07-212-3/+3
| | | | | | | | | | | | | | | | them explicit in the type system. createBinary documented that it destroyed the parameter in error cases, though by observation it does not. By passing the unique_ptr by value rather than lvalue reference, callers are now explicit about passing ownership and the function implements the documented contract. Remove the explicit documentation, since now the behavior cannot be anything other than what was documented, so it's redundant. Also drops a unique_ptr::release in llvm-nm that was always run on a null unique_ptr anyway. llvm-svn: 213557
* Remove unnecessary use of unique_ptr::release() used to construct another ↵David Blaikie2014-07-211-2/+1
| | | | | | unique_ptr. llvm-svn: 213556
* Remove unused variable.David Blaikie2014-07-211-1/+0
| | | | llvm-svn: 213554
* Namespace cleanup (no functional change)Artyom Skrobov2014-07-201-11/+7
| | | | llvm-svn: 213478
* [PowerPC] 32-bit ELF PIC supportHal Finkel2014-07-181-0/+1
| | | | | | | | | | This adds initial support for PPC32 ELF PIC (Position Independent Code; the -fPIC variety), thus rectifying a long-standing deficiency in the PowerPC backend. Patch by Justin Hibbits! llvm-svn: 213427
* 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
* Object/LLVMBuild.txt: Sort required_libraries by alphabetical order.NAKAMURA Takumi2014-07-141-1/+1
| | | | llvm-svn: 212917
* Add forgotten `break` statement.Simon Atanasyan2014-07-131-0/+1
| | | | llvm-svn: 212910
* [Mips] Support SHT_MIPS_ABIFLAGS section type flag in the llvm-readobj,Simon Atanasyan2014-07-131-0/+1
| | | | | | obj2yaml and yaml2obj tools. llvm-svn: 212908
* [ELFYAML] Group ELF section type flags to target specific blocks.Simon Atanasyan2014-07-121-9/+23
| | | | | | Recognize only flags which correspond to the current target. llvm-svn: 212880
* Add support for BSD format Archive map symbols (aka the table of contentsKevin Enderby2014-07-081-6/+63
| | | | | | from a __.SYMDEF or "__.SYMDEF SORTED" archive member). llvm-svn: 212568
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-062-6/+8
| | | | llvm-svn: 212405
* This only needs a StringRef. No functionality change.Rafael Espindola2014-07-051-1/+2
| | | | llvm-svn: 212371
* Make RecordStreamer.h private.Rafael Espindola2014-07-043-3/+45
| | | | llvm-svn: 212361
* Ignore llvm.* globals.Rafael Espindola2014-07-041-6/+3
| | | | | | | It is not clear if llvm.global_ctors should or should not be in llvm.metadata, but in practice it is not and we need to ignore it for LTO. llvm-svn: 212351
* Implement LTOModule on top of IRObjectFile.Rafael Espindola2014-07-041-14/+12
| | | | | | | | | | | | | IRObjectFile provides all the logic for producing mangled names and getting symbols from inline assembly. LTOModule then adds logic for linking specific tasks, like constructing llvm.compiler_user or extracting linker options from the bitcode. The rule of the thumb is that IRObjectFile has the functionality that is needed by both LTO and llvm-ar. llvm-svn: 212349
* Mark intrinsic functions as llvm-specific.Rafael Espindola2014-07-041-0/+5
| | | | llvm-svn: 212347
* Don't include llvm.metadata variables in archive symbol tables.Rafael Espindola2014-07-041-0/+5
| | | | llvm-svn: 212344
* llvm-readobj: fix MachO relocatoin printing a bit.Tim Northover2014-07-041-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
* Move createIRObjectFile to the IRObjectFile class and return the concrete type.Rafael Espindola2014-07-031-1/+1
| | | | llvm-svn: 212301
* Add support for inline asm symbols to IRObjectFile.Rafael Espindola2014-07-034-22/+232
| | | | | | This also enables it in llvm-nm so that it can be tested. llvm-svn: 212282
* Invert the MC -> Object dependency.Rafael Espindola2014-07-034-120/+1
| | | | | | | | | Now that we have a lib/MC/MCAnalysis, the dependency was there just because of two helper classes. Move the two over to MC. This will allow IRObjectFile to parse inline assembly. llvm-svn: 212248
* Speculatively fix some code handling Power64 MachO filesReid Kleckner2014-06-301-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
* Add the -arch flag support to llvm-nm to select the slice out of a Mach-OKevin Enderby2014-06-301-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
* macho-dump: add code to print LC_ID_DYLIB load commands.Tim Northover2014-06-301-0/+6
| | | | | | I want to check them in lld. llvm-svn: 212043
* Revert "Introduce a string_ostream string builder facilty"Alp Toker2014-06-261-3/+4
| | | | | | Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
* Introduce a string_ostream string builder faciltyAlp Toker2014-06-261-4/+3
| | | | | | | | | | | | | | | | | | | | string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
* [RuntimeDyld] Adds the necessary hooks to MCJIT to be able to debug generatedLang Hames2014-06-251-1/+5
| | | | | | | | MachO files using the GDB JIT debugging interface. Patch by Keno Fischer. Thanks Keno! llvm-svn: 211652
OpenPOWER on IntegriCloud