summaryrefslogtreecommitdiff
path: root/lib/Object/ELFObjectFile.cpp
Commit message (Collapse)AuthorAge
* [Object] Split the ELF interface into 3 parts.Michael J. Spencer2013-08-08
| | | | | | | | * 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188022 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.Michael J. Spencer2013-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182680 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Add LLVM_IS_UNALIGNED_ACCESS_FAST.Michael J. Spencer2013-02-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174271 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object][ELF] Simplify ELFObjectFile by using ELFType.Michael J. Spencer2013-01-15
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172515 91177308-0d34-0410-b5e6-96231b3b80d8
* [Object][ELF] Add a maximum alignment. This is used by createELFObjectFile ↵Michael J. Spencer2013-01-04
| | | | | | to create a properly aligned reader. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171520 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement GDB integration for source level debugging of code JITed usingPreston Gurd2012-04-16
| | | | | | | | | | | | | | | | 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154868 91177308-0d34-0410-b5e6-96231b3b80d8
* Expose the ELFObjectFile class directly in the Object/ELF.h header, similarlyEli Bendersky2012-02-12
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150327 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: avoid undefined behavior when bounds-checkingDylan Noblesmith2012-02-04
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149750 91177308-0d34-0410-b5e6-96231b3b80d8
* Sink assert-only variables into the assertsMatt Beaumont-Gay2012-01-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148849 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence warnings in -asserts buildMatt Beaumont-Gay2012-01-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148715 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic runtime dynamic loading capabilities added to ELFObjectFile, implementedEli Bendersky2012-01-22
| | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148653 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed ObjectFile functions:Danil Malyshev2011-11-29
| | | | | | | | | | | | - 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145408 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r145180 as it is causing test failures on all the bots.Chandler Carruth2011-11-27
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145182 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed ObjectFile functions:Danil Malyshev2011-11-27
| | | | | | | | | | | - 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145180 91177308-0d34-0410-b5e6-96231b3b80d8
* Expand relocation type field to 64 bits. MachO scattered relocations ↵Owen Anderson2011-10-26
| | | | | | require 33 bits of type info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143032 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Add some types to SymbolRef::Type.Michael J. Spencer2011-10-17
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142318 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Add isSymbolAbsolute and getSymbolSection.Michael J. Spencer2011-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142317 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Add isSymbolWeak.Michael J. Spencer2011-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142316 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Implement casting for concrete classes.Michael J. Spencer2011-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142314 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Fix redundant name.Michael J. Spencer2011-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142238 91177308-0d34-0410-b5e6-96231b3b80d8
* ELF: Fix the section that relocations apply to. Add test to verify. Patch by ↵Michael J. Spencer2011-10-13
| | | | | | Danil Malyshev! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141901 91177308-0d34-0410-b5e6-96231b3b80d8
* Elf_Word is not POD! Stop using it in a DenseMap.Nick Lewycky2011-10-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141851 91177308-0d34-0410-b5e6-96231b3b80d8
* lib/Object/ELFObjectFile.cpp: Fix undefined behavior for ↵NAKAMURA Takumi2011-10-12
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141774 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r141605 with fixes for appropriate handling of reserved section numbersNick Lewycky2011-10-11
| | | | | | | in st_shndx fields. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141639 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for .symtab_shnidx. Unfortunately, doing this required breaking aNick Lewycky2011-10-11
| | | | | | | | layer of abstraction around SymbolRef where you can read its private SymbolPimpl member. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141636 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r141605 as it broke tests for llvm-nm.Nick Lewycky2011-10-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141614 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for reading many-section ELF files.Nick Lewycky2011-10-11
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141605 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: add getSectionAlignment.Michael J. Spencer2011-10-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141581 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix GCC again.Michael J. Spencer2011-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141389 91177308-0d34-0410-b5e6-96231b3b80d8
* Change relocation API to be per section. This time without breaking GCC.Michael J. Spencer2011-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141385 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 141376 and 141377 due to breaking the build.Bill Wendling2011-10-07
| | | | | | | | | | | | | | | | | | --- 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141379 91177308-0d34-0410-b5e6-96231b3b80d8
* Change relocation API to be per section.Michael J. Spencer2011-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141376 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Add isSection{Data,BSS}.Michael J. Spencer2011-09-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140721 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: make the following changes into SymbolRefBenjamin Kramer2011-09-14
| | | | | | | | | | | - 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139683 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for relocations to ObjectFile.Benjamin Kramer2011-09-08
| | | | | | Patch by Danil Malyshev! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139314 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectFile: Add a method to check whether a section contains a symbol.Benjamin Kramer2011-07-15
| | | | | | | - No ELF or COFF implementation yet, I don't have a way to test that. Should be straightforward to add though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135288 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Add proper error handling.Michael J. Spencer2011-06-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133872 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133870 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the last two commits in the series. r132911, r132912.Michael J. Spencer2011-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132913 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Binary the parent of ObjectFile and update children to new interface.Michael J. Spencer2011-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132911 91177308-0d34-0410-b5e6-96231b3b80d8
* Assorted bugfixes in object file handling:Eric Christopher2011-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | - 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128799 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Fix type punned pointer issues by making DataRefImpl a union and ↵Michael J. Spencer2011-01-21
| | | | | | using intptr_t. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123962 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Add ELF support.Michael J. Spencer2011-01-20
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123896 91177308-0d34-0410-b5e6-96231b3b80d8