summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/ObjectFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Pass the computed magic to createBinary and createObjectFile if available.Rafael Espindola2014-01-221-2/+4
| | | | | | | 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
* Change createObjectFile to return an ErrorOr.Rafael Espindola2014-01-221-14/+10
| | | | llvm-svn: 199776
* Be a bit more consistent about using ErrorOr when constructing Binary objects.Rafael Espindola2014-01-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | 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
* 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-0/+1
| | | | | | | | | | | | | | 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
* Delete the buffer in createObjectFile if it fails.Rafael Espindola2013-07-241-1/+4
| | | | | | | | | | The Binary constructor takes ownership of the memory buffer. This is a fairly unfortunate interface, but for now make createObjectFile consistent with it by also deleting the buffer if it fails. Fixes a leak in llvm-ar found by the valgrind bots. llvm-svn: 187039
* Basic support for parsing Mach-O universal binaries in LLVMObject libraryAlexey Samsonov2013-06-181-0/+1
| | | | llvm-svn: 184191
* Fix variable name style. Don't cast to and from int.Rafael Espindola2013-06-111-0/+2
| | | | | | | This enables the compiler to see the enum and produce warnings about a switch not being fully covered. Fix one of these warnings. llvm-svn: 183749
* Convert another use of sys::identifyFileType.Rafael Espindola2013-06-111-25/+26
| | | | | | No functionality change. llvm-svn: 183747
* Pass a StringRef to sys::identifyFileType.Rafael Espindola2013-06-101-2/+1
| | | | llvm-svn: 183669
* Change how we iterate over relocations on ELF.Rafael Espindola2013-05-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | For COFF and MachO, sections semantically have relocations that apply to them. That is not the case on ELF. In relocatable objects (.o), a section with relocations in ELF has offsets to another section where the relocations should be applied. In dynamic objects and executables, relocations don't have an offset, they have a virtual address. The section sh_info may or may not point to another section, but that is not actually used for resolving the relocations. This patch exposes that in the ObjectFile API. It has the following advantages: * Most (all?) clients can handle this more efficiently. They will normally walk all relocations, so doing an effort to iterate in a particular order doesn't save time. * llvm-readobj now prints relocations in the same way the native readelf does. * probably most important, relocations that don't point to any section are now visible. This is the case of relocations in the rela.dyn section. See the updated relocation-executable.test for example. llvm-svn: 182908
* Add getSymbolAlignment to the ObjectFile interface.Rafael Espindola2013-04-291-0/+6
| | | | | | | | | | | | | For regular object files this is only meaningful for common symbols. An object file format with direct support for atoms should be able to provide alignment information for all symbols. This replaces getCommonSymbolAlignment and fixes test-common-symbols-alignment.ll on darwin. This also includes a fix to MachOObjectFile::getSymbolFlags. It was marking undefined symbols as common (already tested by existing mcjit tests now that it is used). llvm-svn: 180736
* Remove unused argument.Rafael Espindola2013-04-071-1/+1
| | | | llvm-svn: 178987
* When encountering an unknown file format, ObjectFile::createObjectFile shouldEli Bendersky2013-01-251-1/+3
| | | | | | | | | politely report it instead of running into llvm_unreachable. Also patch llvm-dwarfdump to actually check whether the file it's attempting to dump is a valid object file. llvm-svn: 173489
* Remove unused variables.Rafael Espindola2011-12-251-1/+1
| | | | llvm-svn: 147261
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
* ObjectFile: Add support for mach-o-style dSYM companion files.Benjamin Kramer2011-09-141-0/+1
| | | | llvm-svn: 139676
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-251-12/+2
| | | | llvm-svn: 133870
* Revert the last two commits in the series. r132911, r132912.Michael J. Spencer2011-06-131-2/+12
| | | | llvm-svn: 132913
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-131-12/+2
| | | | llvm-svn: 132911
* Hook in mach-o object files into Object interface.Eric Christopher2011-04-221-1/+1
| | | | llvm-svn: 129976
* Object: Add ELF support.Michael J. Spencer2011-01-201-1/+1
| | | | llvm-svn: 123896
* Object: Add COFF Support.Michael J. Spencer2011-01-201-1/+1
| | | | llvm-svn: 123895
* MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer2010-12-161-2/+5
| | | | | | via an out parm. llvm-svn: 121958
* Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer2010-12-091-1/+3
| | | | | | error_code &ec. And fix clients. llvm-svn: 121379
* Merge System into Support.Michael J. Spencer2010-11-291-1/+1
| | | | llvm-svn: 120298
* Fix typo: Exectuable -> ExecutablePeter Collingbourne2010-11-171-1/+1
| | | | llvm-svn: 119433
* Object: Get rid of sys::Path, Triple, and cleanup namespace.Michael J. Spencer2010-11-161-7/+5
| | | | llvm-svn: 119309
* Add LLVMObject Library.Michael J. Spencer2010-11-151-0/+68
llvm-svn: 119107
OpenPOWER on IntegriCloud