summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Binary.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-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. llvm-svn: 203083
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-051-4/+4
| | | | llvm-svn: 202957
* Add a SymbolicFile interface between Binary and ObjectFile.Rafael Espindola2014-02-211-5/+5
| | | | | | | | | | | This interface allows IRObjectFile to be implemented without having dummy methods for all section and segment related methods. Both llvm-ar and llvm-nm are changed to use it. Unfortunately the mangler is still not plugged in since it requires some refactoring to make a Module hold a DataLayout. llvm-svn: 201881
* Make createObjectFile's signature a bit less error prone.Rafael Espindola2014-01-291-1/+1
| | | | | | | This will be better with c++11, but right now file_magic converts to bool, which makes the api really easy to misuse. llvm-svn: 200357
* Make ObjectFile ownership of the MemoryBuffer optional.Rafael Espindola2014-01-241-4/+4
| | | | | | This allows llvm-ar to mmap the input files only once. llvm-svn: 200040
* Pass the computed magic to createBinary and createObjectFile if available.Rafael Espindola2014-01-221-10/+10
| | | | | | | identify_magic is not free, so we should avoid calling it twice. The argument also makes it cheap for createBinary to just forward to createObjectFile. llvm-svn: 199813
* Be a bit more consistent about using ErrorOr when constructing Binary objects.Rafael Espindola2014-01-211-35/+10
| | | | | | | | | | | | | | | | | | | | | | | The constructors of classes deriving from Binary normally take an error_code as an argument to the constructor. My original intent was to change them to have a trivial constructor and move the initial parsing logic to a static method returning an ErrorOr. I changed my mind because: * A constructor with an error_code out parameter is extremely convenient from the implementation side. We can incrementally construct the object and give up when we find an error. * It is very efficient when constructing on the stack or when there is no error. The only inefficient case is where heap allocating and an error is found (we have to free the memory). The result is that this is a much smaller patch. It just standardizes the create* helpers to return an ErrorOr. Almost no functionality change: The only difference is that this found that we were trying to read past the end of COFF import library but ignoring the error. llvm-svn: 199770
* Return an ErrorOr<Binary *> from createBinary.Rafael Espindola2014-01-151-31/+25
| | | | | | | | I did write a version returning ErrorOr<OwningPtr<Binary> >, but it is too cumbersome to use without std::move. I will keep the patch locally and submit when we switch to c++11. llvm-svn: 199326
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* Path: Recognize COFF import library file magic.Rui Ueyama2013-11-151-0/+1
| | | | | | | | | | | | Summary: Make identify_magic to recognize COFF import file. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2165 llvm-svn: 194852
* Path: Recognize Windows compiled resource file.Rui Ueyama2013-10-151-1/+2
| | | | | | | | | | | | | | Some background: One can pass compiled resource files (.res files) directly to the linker on Windows. If a resource file is given, the linker will run "cvtres" command in background to convert the resource file to a COFF file to link it. What I'm trying to do with this patch is to make the linker to recognize the resource file by file magic, so that it can run cvtres command. Differential Revision: http://llvm-reviews.chandlerc.com/D1943 llvm-svn: 192742
* Make a switch in createBinary fully-covered. Add forgotten ↵Alexey Samsonov2013-06-281-2/+7
| | | | | | macho_dsym_companion case. llvm-svn: 185139
* Basic support for parsing Mach-O universal binaries in LLVMObject libraryAlexey Samsonov2013-06-181-0/+7
| | | | llvm-svn: 184191
* readobj: Dump PE/COFF optional records.Rui Ueyama2013-06-121-2/+4
| | | | | | | | | | | | These records are mandatory for executables and are used by the loader. Reviewers: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D939 llvm-svn: 183852
* Convert a use of sys::identifyFileType to sys::fs::identify_magic.Rafael Espindola2013-06-111-16/+18
| | | | | | No functionality change. llvm-svn: 183745
* Pass a StringRef to sys::identifyFileType.Rafael Espindola2013-06-101-2/+1
| | | | llvm-svn: 183669
* Don't artifically restrict input object size.Sean Silva2013-06-081-2/+0
| | | | | | | | sys::IdentifyFileType is already conscious of the length, and object_error::invalid_file_type is returned below anyway if sys::IdentifyFileType doesn't recognize the file. llvm-svn: 183605
* Object: Add support for opening stdin.Michael J. Spencer2011-10-081-1/+1
| | | | llvm-svn: 141449
* Object: Add archive support.Michael J. Spencer2011-09-271-1/+8
| | | | llvm-svn: 140626
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-251-3/+49
| | | | llvm-svn: 133870
* Add Binary class. This is a cleaner parent than ObjectFile.Michael J. Spencer2011-06-251-0/+50
| | | | llvm-svn: 133869
* Revert r132910 and r132909 on behalf of Michael. They didn't build with clang.Benjamin Kramer2011-06-131-50/+0
| | | | llvm-svn: 132914
* Revert the last two commits in the series. r132911, r132912.Michael J. Spencer2011-06-131-49/+3
| | | | llvm-svn: 132913
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-131-3/+49
| | | | llvm-svn: 132911
* Add Binary class. This is a cleaner parent than ObjectFile.Michael J. Spencer2011-06-131-0/+50
llvm-svn: 132910
OpenPOWER on IntegriCloud