summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/ELFObjectFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-051-1/+1
| | | | llvm-svn: 202957
* Make ObjectFile ownership of the MemoryBuffer optional.Rafael Espindola2014-01-241-9/+18
| | | | | | This allows llvm-ar to mmap the input files only once. llvm-svn: 200040
* Be a bit more consistent about using ErrorOr when constructing Binary objects.Rafael Espindola2014-01-211-15/+18
| | | | | | | | | | | | | | | | | | | | | | | 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
* [Object] Split the ELF interface into 3 parts.Michael J. Spencer2013-08-081-2/+1
| | | | | | | | * ELFTypes.h contains template magic for defining types based on endianess, size, and alignment. * ELFFile.h defines the ELFFile class which provides low level ELF specific access. * ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface. llvm-svn: 188022
* Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.Michael J. Spencer2013-05-241-1/+1
| | | | llvm-svn: 182680
* [Support] Add LLVM_IS_UNALIGNED_ACCESS_FAST.Michael J. Spencer2013-02-031-4/+16
| | | | llvm-svn: 174271
* [Object][ELF] Simplify ELFObjectFile by using ELFType.Michael J. Spencer2013-01-151-8/+8
| | | | | | | | | | | | | This simplifies the usage and implementation of ELFObjectFile by using ELFType to replace: <endianness target_endianness, std::size_t max_alignment, bool is64Bits> This does complicate the base ELF types as they must now use template template parameters to partially specialize for the 32 and 64bit cases. However these are only defined once. llvm-svn: 172515
* [Object][ELF] Add a maximum alignment. This is used by createELFObjectFile ↵Michael J. Spencer2013-01-041-6/+28
| | | | | | to create a properly aligned reader. llvm-svn: 171520
* Implement GDB integration for source level debugging of code JITed usingPreston Gurd2012-04-161-10/+0
| | | | | | | | | | | | | | | the MCJIT execution engine. The GDB JIT debugging integration support works by registering a loaded object image with a pre-defined function that GDB will monitor if GDB is attached. GDB integration support is implemented for ELF only at this time. This integration requires GDB version 7.0 or newer. Patch by Andy Kaylor! llvm-svn: 154868
* Expose the ELFObjectFile class directly in the Object/ELF.h header, similarlyEli Bendersky2012-02-121-1695/+25
| | | | | | | | | | to what's done for MachO and COFF. This allows advanced uses of the class to be implemented outside the Object library. In particular, the DyldELFObject subclass is now moved into its logical home - ExecutionEngine/RuntimeDyld. This patch was reviewed by Michael Spencer. llvm-svn: 150327
* Object: avoid undefined behavior when bounds-checkingDylan Noblesmith2012-02-041-8/+22
| | | | | | | | | | Don't form an out of bounds pointer just to test if it would be out of bounds. Also perform the same bounds checking for all the previous mapped structures. llvm-svn: 149750
* Sink assert-only variables into the assertsMatt Beaumont-Gay2012-01-241-16/+10
| | | | llvm-svn: 148849
* Silence warnings in -asserts buildMatt Beaumont-Gay2012-01-231-0/+6
| | | | llvm-svn: 148715
* Basic runtime dynamic loading capabilities added to ELFObjectFile, implementedEli Bendersky2012-01-221-19/+239
| | | | | | | | | | | | | in a subclass named DyldELFObject. This class supports rebasing the object file it represents by re-mapping section addresses to the actual memory addresses the object was placed in. This is required for MC-JIT implementation on ELF with debugging support. Patch reviewed on llvm-commits. Developed together with Ashok Thirumurthi and Andrew Kaylor. llvm-svn: 148653
* Fixed ObjectFile functions:Danil Malyshev2011-11-291-13/+36
| | | | | | | | | | | - getSymbolOffset() renamed as getSymbolFileOffset() - getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile. - added getRelocationOffset() - fixed MachOObjectFile::getSymbolSize() - fixed MachOObjectFile::getSymbolSection() - fixed MachOObjectFile::getSymbolOffset() for symbols without section data. llvm-svn: 145408
* Revert r145180 as it is causing test failures on all the bots.Chandler Carruth2011-11-271-36/+13
| | | | | | | | | | | | | Original commit message: Fixed ObjectFile functions: - getSymbolOffset() renamed as getSymbolFileOffset() - getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile. - added getRelocationOffset() - fixed MachOObjectFile::getSymbolSize() - fixed MachOObjectFile::getSymbolSection() - fixed MachOObjectFile::getSymbolOffset() for symbols without section data. llvm-svn: 145182
* Fixed ObjectFile functions:Danil Malyshev2011-11-271-13/+36
| | | | | | | | | | | - getSymbolOffset() renamed as getSymbolFileOffset() - getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile. - added getRelocationOffset() - fixed MachOObjectFile::getSymbolSize() - fixed MachOObjectFile::getSymbolSection() - fixed MachOObjectFile::getSymbolOffset() for symbols without section data. llvm-svn: 145180
* Expand relocation type field to 64 bits. MachO scattered relocations ↵Owen Anderson2011-10-261-2/+2
| | | | | | require 33 bits of type info. llvm-svn: 143032
* Object: Add some types to SymbolRef::Type.Michael J. Spencer2011-10-171-0/+6
| | | | | | | | Some of these can be true at the same time and there are a lot to add, so this should be turned into a bitfield. Some of the other accessors should probably be folded into this. llvm-svn: 142318
* Object: Add isSymbolAbsolute and getSymbolSection.Michael J. Spencer2011-10-171-0/+29
| | | | llvm-svn: 142317
* Object: Add isSymbolWeak.Michael J. Spencer2011-10-171-0/+12
| | | | llvm-svn: 142316
* Object: Implement casting for concrete classes.Michael J. Spencer2011-10-171-0/+5
| | | | llvm-svn: 142314
* Object: Fix redundant name.Michael J. Spencer2011-10-171-2/+2
| | | | llvm-svn: 142238
* ELF: Fix the section that relocations apply to. Add test to verify. Patch by ↵Michael J. Spencer2011-10-131-3/+3
| | | | | | Danil Malyshev! llvm-svn: 141901
* Elf_Word is not POD! Stop using it in a DenseMap.Nick Lewycky2011-10-131-7/+4
| | | | llvm-svn: 141851
* lib/Object/ELFObjectFile.cpp: Fix undefined behavior for ↵NAKAMURA Takumi2011-10-121-1/+4
| | | | | | | | MC/ELF/many-section.s not to fail (on msvc). DenseMap::lookup(k) would return "default constructor value" when k was not met. It would be useless when value type were POD. llvm-svn: 141774
* Reapply r141605 with fixes for appropriate handling of reserved section numbersNick Lewycky2011-10-111-17/+50
| | | | | | in st_shndx fields. llvm-svn: 141639
* Add support for .symtab_shnidx. Unfortunately, doing this required breaking aNick Lewycky2011-10-111-9/+42
| | | | | | | layer of abstraction around SymbolRef where you can read its private SymbolPimpl member. llvm-svn: 141636
* Revert r141605 as it broke tests for llvm-nm.Nick Lewycky2011-10-111-34/+13
| | | | llvm-svn: 141614
* Add support for reading many-section ELF files.Nick Lewycky2011-10-111-13/+34
| | | | | | | If you want to tackle adding the testcase, let me know. It's a 4.2MB ELF file and I'll be happy to mail it to you. llvm-svn: 141605
* Object: add getSectionAlignment.Michael J. Spencer2011-10-101-0/+10
| | | | llvm-svn: 141581
* Fix GCC again.Michael J. Spencer2011-10-071-1/+1
| | | | llvm-svn: 141389
* Change relocation API to be per section. This time without breaking GCC.Michael J. Spencer2011-10-071-79/+301
| | | | llvm-svn: 141385
* Revert 141376 and 141377 due to breaking the build.Bill Wendling2011-10-071-301/+79
| | | | | | | | | | | | | | | | --- Reverse-merging r141377 into '.': U tools/llvm-objdump/MachODump.cpp --- Reverse-merging r141376 into '.': U include/llvm/Object/COFF.h U include/llvm/Object/ObjectFile.h U include/llvm-c/Object.h U tools/llvm-objdump/llvm-objdump.cpp U lib/Object/MachOObjectFile.cpp U lib/Object/COFFObjectFile.cpp U lib/Object/Object.cpp U lib/Object/ELFObjectFile.cpp llvm-svn: 141379
* Change relocation API to be per section.Michael J. Spencer2011-10-071-79/+301
| | | | llvm-svn: 141376
* Object: Add isSection{Data,BSS}.Michael J. Spencer2011-09-281-0/+28
| | | | llvm-svn: 140721
* Object: make the following changes into SymbolRefBenjamin Kramer2011-09-141-1/+78
| | | | | | | | | | | - Add enum SymbolType and function getSymbolType() - Add function isGlobal() - it's returns true for symbols that can be used in another objects, such as library functions. - Rename function getAddress() to getOffset() and add new function getAddress(), because currently getAddress() returns section offset of symbol first byte. new getAddress() return symbol address. - Change usage SymbolRef::getAddress() to getOffset() in tools/llvm-nm and tools/llvm-objdump. Patch by Danil Malyshev! llvm-svn: 139683
* Add support for relocations to ObjectFile.Benjamin Kramer2011-09-081-12/+280
| | | | | | Patch by Danil Malyshev! llvm-svn: 139314
* ObjectFile: Add a method to check whether a section contains a symbol.Benjamin Kramer2011-07-151-0/+12
| | | | | | | - No ELF or COFF implementation yet, I don't have a way to test that. Should be straightforward to add though. llvm-svn: 135288
* Object: Add proper error handling.Michael J. Spencer2011-06-251-62/+100
| | | | llvm-svn: 133872
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-251-20/+22
| | | | llvm-svn: 133870
* Revert the last two commits in the series. r132911, r132912.Michael J. Spencer2011-06-131-22/+20
| | | | llvm-svn: 132913
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-131-20/+22
| | | | llvm-svn: 132911
* Assorted bugfixes in object file handling:Eric Christopher2011-04-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | - Adds support for sniffing PE/COFF files on win32 (.exe and .dll) which are COFF files that have an MS-DOS compatibility stub on the front of them. - Fixes a bug in the COFFObjectFile's support for the Microsoft COFF extension for long symbol names, wherein it was attempting to parse the leading '/' in an extended symbol name reference as part of the integer offset. - Fixes bugs in COFFObjectFile and ELFObjectFile wherein section and symbol iterators were being returned with uninitialized bytes; the type DataRefImpl is a union between 2 32-bit words (d.a and d.b) and a single intptr_t word (p). Only p was being initialized, so in 32-bit builds the result would be iterators with random upper 32-bit words in their DataRefImpls. This caused random failures when seeking around in object files. Patch by Graydon Hoare! llvm-svn: 128799
* Object: Fix type punned pointer issues by making DataRefImpl a union and ↵Michael J. Spencer2011-01-211-60/+40
| | | | | | using intptr_t. llvm-svn: 123962
* Object: Add ELF support.Michael J. Spencer2011-01-201-0/+706
llvm-svn: 123896
OpenPOWER on IntegriCloud