summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* llvm-readobj: Add support for dumping the DOS header in PE filesDavid Majnemer2014-11-051-13/+13
| | | | llvm-svn: 221333
* [yaml2obj] Allow yaml2obj tool to recognize EF_MIPS_NAN2008 flagSimon Atanasyan2014-11-041-0/+1
| | | | llvm-svn: 221268
* 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
* Object, COFF: Cleanup symbol type code, improve binutils compatibilityDavid Majnemer2014-10-311-44/+75
| | | | | | | Do a better job classifying symbols. This increases the consistency between the COFF handling code and the ELF side of things. llvm-svn: 220952
* Fix unicode chars into ascii in comment lines.NAKAMURA Takumi2014-10-271-1/+1
| | | | llvm-svn: 220668
* Don't ever call materializeAllPermanently during LTO.Rafael Espindola2014-10-241-11/+1
| | | | | | | | | | To do this, change the representation of lazy loaded functions. The previous representation cannot differentiate between a function whose body has been removed and one whose body hasn't been read from the .bc file. That means that in order to drop a function, the entire body had to be read. llvm-svn: 220580
* [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
* Be more specific about return type of MachOUniversalBinary::getObjectForArchAlexey Samsonov2014-10-201-2/+2
| | | | llvm-svn: 220230
* [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
* Object, COFF: Move the VirtualSize/SizeOfRawData logic to getSectionSizeDavid Majnemer2014-10-091-18/+23
| | | | | | | | While getSectionContents was updated to do the right thing, getSectionSize wasn't. Move the logic to getSectionSize and leverage it from getSectionContents. llvm-svn: 219391
* Object, COFF: Cap the section contents to min(VirtualSize, SizeOfRawData)David Majnemer2014-10-091-5/+19
| | | | | | | | | | | | | | | | It is not useful to return the data beyond VirtualSize it's less than SizeOfRawData. An implementation detail of COFF requires the section size to be rounded up to a multiple of FileAlignment; this means that SizeOfRawData is not representative of how large the section is. Instead, we should cap it to VirtualSize when this occurs as it represents the true size of the section. Note that this is only relevant in executable files because this rounding doesn't occur in object files (and VirtualSize is always zero). llvm-svn: 219388
* Object: Add range iterators for COFF import/export tableRui Ueyama2014-10-091-0/+26
| | | | llvm-svn: 219383
* Correctly compute the size of common symbols in COFF.Rafael Espindola2014-10-081-4/+9
| | | | llvm-svn: 219324
* Remove bogus std::error_code returns form SectionRef.Rafael Espindola2014-10-083-139/+67
| | | | | | | | | | | | | | 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
* Don't check for null after calling COFFObjectFile::toSec.Rafael Espindola2014-10-071-2/+0
| | | | | | | | | | | It can only return null if passed a corrupted reference with a null Ref.p. Checking for null is then an issue for asserts to check for internal consistency, not control flow to check for invalid input. I didn't add an assert(sec != nullptr) because toSec itself has a far more complete assert. llvm-svn: 219235
* Optimize COFFObjectFile::sectionContainsSymbol a bit.Rafael Espindola2014-10-071-7/+2
| | | | | | | | | There is no need to compute the coff_section of the symbol just to compare the pointer. Inspired by the ELF implementation. llvm-svn: 219233
* llvm-readobj: print out the fields of the COFF delay-import tableRui Ueyama2014-10-031-0/+6
| | | | llvm-svn: 218996
* llvm-readobj: print COFF delay-load import tableRui Ueyama2014-10-031-13/+90
| | | | | | | | | This patch adds another iterator to access the delay-load import table and use it from llvm-readobj. http://reviews.llvm.org/D5594 llvm-svn: 218933
* llvm-readobj: print COFF imported symbolsRui Ueyama2014-10-021-0/+90
| | | | | | | | This patch defines a new iterator for the imported symbols. Make a change to COFFDumper to use that iterator to print out imported symbols and its ordinals. llvm-svn: 218915
* This patch adds a new flag "-coff-imports" to llvm-readobj.Rui Ueyama2014-10-021-5/+18
| | | | | | | | | | | | | | When the flag is given, the command prints out the COFF import table. Currently only the import table directory will be printed. I'm going to make another patch to print out the imported symbols. The implementation of import directory entry iterator in COFFObjectFile.cpp was buggy. This patch fixes that too. http://reviews.llvm.org/D5569 llvm-svn: 218891
* Object: BSS/virtual sections don't have contentsDavid Majnemer2014-09-261-0/+4
| | | | | | | | | | | | Users of getSectionContents shouldn't try to pass in BSS or virtual sections. In all instances, this is a bug in the code calling this routine. N.B. Some COFF implementations (like CL) will mark their BSS sections as taking space on disk. This would confuse COFFObjectFile into thinking the section is larger than the file. llvm-svn: 218549
* Converting object's error_category to a ManagedStatic to avoid static ↵Chris Bieneman2014-09-191-2/+4
| | | | | | constructors and destructors. llvm-svn: 218160
* LTO: introduce object file-based on-disk module format.Peter Collingbourne2014-09-183-4/+60
| | | | | | | | | | | | | | | | | | This format is simply a regular object file with the bitcode stored in a section named ".llvmbc", plus any number of other (non-allocated) sections. One immediate use case for this is to accommodate compilation processes which expect the object file to contain metadata in non-allocated sections, such as the ".go_export" section used by some Go compilers [1], although I imagine that in the future we could consider compiling parts of the module (such as large non-inlinable functions) directly into the object file to improve LTO efficiency. [1] http://golang.org/doc/install/gccgo#Imports Differential Revision: http://reviews.llvm.org/D4371 llvm-svn: 218078
* [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
* Support: Delete {aligned_,}{u,}{little,big}8_tRui Ueyama2014-09-111-1/+0
| | | | | | | The byte has no endianness, so these types don't make sense. uint8_t should be used instead. llvm-svn: 217631
* Attempt to pacify buildbots.David Majnemer2014-09-101-11/+0
| | | | llvm-svn: 217499
* Object: Add support for bigobjDavid Majnemer2014-09-101-113/+160
| | | | | | | | | | | | | | | | | | | | | | This adds support for reading the "bigobj" variant of COFF produced by cl's /bigobj and mingw's -mbig-obj. The most significant difference that bigobj brings is more than 2**16 sections to COFF. bigobj brings a few interesting differences with it: - It doesn't have a Characteristics field in the file header. - It doesn't have a SizeOfOptionalHeader field in the file header (it's only used in executable files). - Auxiliary symbol records have the same width as a symbol table entry. Since symbol table entries are bigger, so are auxiliary symbol records. Write support will come soon. Differential Revision: http://reviews.llvm.org/D5259 llvm-svn: 217496
* Restore the ability to check if LLVMCreateObjectFile was successfulBjorn Steinbrink2014-09-051-3/+4
| | | | | | | | | | | | | | | | | | | | Summary: Until r216870 LLVMCreateObjectFile returned nullptr in case of an error, so callers could check if the call was successful. Now, it always returns an OwningBinary wrapped as an LLVMObjectFileRef, so callers can't check if the call was successul. This results in a segfault running e.g. llvm-c-test --object-list-sections < /dev/null So the old behaviour should be restored. Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5143 llvm-svn: 217279
* 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
* unique_ptrify IRObjectFile::createIRObjectFileDavid Blaikie2014-09-032-4/+3
| | | | | | | | I took a guess at the changes to the gold plugin, because that doesn't seem to build by default for me. Not sure what dependencies I might be missing for that. llvm-svn: 217056
* unique_ptrify MachOUniversalBinary::createDavid Blaikie2014-09-032-4/+3
| | | | llvm-svn: 217052
* Pass a && to getLazyBitcodeModule.Rafael Espindola2014-09-031-1/+1
| | | | | | | | This forces callers to use std::move when calling it. It is somewhat odd to have code with std::move that doesn't always move, but it is also odd to have code without std::move that sometimes moves. llvm-svn: 217049
* Ensure ErrorOr cannot implicitly invoke explicit ctors of the underlying type.David Blaikie2014-09-032-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | An unpleasant surprise while migrating unique_ptrs (see changes in lib/Object): ErrorOr<int*> was implicitly convertible to ErrorOr<std::unique_ptr<int>>. Keep the explicit conversions otherwise it's a pain to convert ErrorOr<int*> to ErrorOr<std::unique_ptr<int>>. I'm not sure if there should be more SFINAE on those explicit ctors (I could check if !is_convertible && is_constructible, but since the ctor has to be called explicitly I don't think there's any need to disable them when !is_constructible - they'll just fail anyway. It's the converting ctors that can create interesting ambiguities without proper SFINAE). I had to SFINAE the explicit ones because otherwise they'd be ambiguous with the implicit ones in an explicit context, so far as I could tell. The converting assignment operators seemed unnecessary (and similarly buggy/dangerous) - just rely on the converting ctors to convert to the right type for assignment instead. llvm-svn: 217048
* 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-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
OpenPOWER on IntegriCloud