summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Define versions of Section that are explicitly marked as little endian.Rafael Espindola2013-04-051-34/+34
| | | | | | These should really be templated like ELF, but this is a start. llvm-svn: 178896
* Don't use InMemoryStruct in getSection and getSection64.Rafael Espindola2013-04-051-86/+51
| | | | llvm-svn: 178894
* Don't fetch pointers from a InMemoryStruct.Rafael Espindola2013-04-051-9/+18
| | | | | | | | InMemoryStruct is extremely dangerous as it returns data from an internal buffer when the endiannes doesn't match. This should fix the tests on big endian hosts. llvm-svn: 178875
* Move an assert earlier in a file and check that the result ofEric Christopher2013-02-281-2/+5
| | | | | | | | our bitwise compare is equal to the field we're looking for. Noticed on inspection. llvm-svn: 176296
* Add static cast to unsigned char whenever a character classification ↵Guy Benyei2013-02-121-1/+1
| | | | | | function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. llvm-svn: 175006
* Object: Fix errant fallthrough.Jim Grosbach2013-01-311-0/+1
| | | | llvm-svn: 174079
* Add a function to get the segment name of a section.Rafael Espindola2012-12-211-14/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On MachO, sections also have segment names. When a tool looking at a .o file prints a segment name, this is what they mean. In reality, a .o has only one anonymous, segment. This patch adds a MachO only function to fetch that segment name. I named it getSectionFinalSegmentName since the main use for the name seems to be inform the linker with segment this section should go to. The patch also changes MachOObjectFile::getSectionName to return just the section name instead of computing SegmentName,SectionName. The main difference from the previous patch is that it doesn't use InMemoryStruct. It is extremely dangerous: if the endians match it returns a pointer to the file buffer, if not, it returns a pointer to an internal buffer that is overwritten in the next API call. We should change all of this code to use support::detail::packed_endian_specific_integral like ELF, but since these functions only handle strings, they work with big and little endian machines as is. I have tested this by installing ubuntu 12.10 ppc on qemu, that is why it took so long :-) llvm-svn: 170838
* Revert 170545 while I debug the ppc failures.Rafael Espindola2012-12-191-25/+10
| | | | llvm-svn: 170547
* Add r170095 back.Rafael Espindola2012-12-191-10/+25
| | | | | | | | | | | | | | | | | | | | | | | I cannot reproduce it the failures locally, so I will keep an eye at the ppc bots. This patch does add the change to the "Disassembly of section" message, but that is not what was failing on the bots. Original message: Add a funciton to get the segment name of a section. On MachO, sections also have segment names. When a tool looking at a .o file prints a segment name, this is what they mean. In reality, a .o has only one anonymous, segment. This patch adds a MachO only function to fetch that segment name. I named it getSectionFinalSegmentName since the main use for the name seems to be infor the linker with segment this section should go to. The patch also changes MachOObjectFile::getSectionName to return just the section name instead of computing SegmentName,SectionName. llvm-svn: 170545
* Teach MachO which sections contain codeTim Northover2012-12-171-2/+2
| | | | llvm-svn: 170349
* Revert "Add a funciton to get the segment name of a section."Eric Christopher2012-12-131-25/+10
| | | | | | This reverts commit r170095 since it appears to be breaking the bots. llvm-svn: 170105
* Add a funciton to get the segment name of a section.Rafael Espindola2012-12-131-10/+25
| | | | | | | | | | | | | | | On MachO, sections also have segment names. When a tool looking at a .o file prints a segment name, this is what they mean. In reality, a .o has only one, anonymous, segment. This patch adds a MachO only function to fetch that segment name. I named it getSectionFinalSegmentName since the main use for the name seems to be informing the linker with segment this section should go to. The patch also changes MachOObjectFile::getSectionName to return just the section name instead of computing SegmentName,SectionName. llvm-svn: 170095
* Remove some dead code.Rafael Espindola2012-12-121-8/+0
| | | | llvm-svn: 169963
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-2/+1
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Object: Pass the buffer name through when making a copy.Benjamin Kramer2012-11-291-1/+2
| | | | | | Should bring the buildbots back to life. llvm-svn: 168935
* Fix a memory leak in MachOObjectFile.Jim Grosbach2012-11-291-8/+15
| | | | | | | | | | | | | MachOObjectFile owns a MachOObj, but never frees it. Both MachOObjectFile and MachOObj want to own the MemoryBuffer, though, so we have to be careful and give them each one of their own. Thanks to Greg Clayton, Eric Christopher and Michael Spencer for helping figure out what's going wrong here. rdar://12561773 llvm-svn: 168923
* Add interface for querying object files for symbol values.Tim Northover2012-10-291-0/+4
| | | | | | | | Currently only implemented for ELF. Patch by Amara Emerson. llvm-svn: 166918
* Cosmetic changesAndrew Kaylor2012-10-101-3/+3
| | | | llvm-svn: 165588
* This patch adds new functions to the SectionRef and ObjectFile interfaces to ↵Andrew Kaylor2012-10-101-0/+11
| | | | | | | | determine whether or not a section is meant to be read-only. These functions will be used by the MCJIT RuntimeDyld to give hints to the memory manager during the object loading process in a future patch. Patch by Ashok Thirumurthi. llvm-svn: 165586
* Mark some static arrays as const.Craig Topper2012-05-241-4/+4
| | | | llvm-svn: 157377
* Fix the implementation of MachOObjectFile::isSectionZeroInit so it follows ↵Eli Friedman2012-05-021-4/+6
| | | | | | the MachO spec. llvm-svn: 155976
* Remove unused variable.Benjamin Kramer2012-04-131-3/+0
| | | | llvm-svn: 154661
* This patch improves the MCJIT runtime dynamic loader by adding new handlingPreston Gurd2012-04-121-4/+51
| | | | | | | | | | of zero-initialized sections, virtual sections and common symbols and preventing the loading of sections which are not required for execution such as debug information. Patch by Andy Kaylor! llvm-svn: 154610
* Add a constructor for DataRefImpl and remove excess initialization.Danil Malyshev2012-04-101-7/+0
| | | | llvm-svn: 154371
* [Object]David Meyer2012-03-091-1/+1
| | | | | | Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big llvm-svn: 152435
* [Object]David Meyer2012-03-011-0/+5
| | | | | | Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object. llvm-svn: 151845
* [Object]David Meyer2012-03-011-0/+21
| | | | | | | | | * Add begin_dynamic_table() / end_dynamic_table() private interface to ELFObjectFile. * Add begin_libraries_needed() / end_libraries_needed() interface to ObjectFile, for grabbing the list of needed libraries for a shared object or dynamic executable. * Implement this new interface completely for ELF, leave stubs for COFF and MachO. * Add 'llvm-readobj' tool for dumping ObjectFile information. llvm-svn: 151785
* [Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and ↵David Meyer2012-02-291-2/+7
| | | | | | | | | ST_Undefined. Implement these completely for ELF. Rename ST_External to ST_Unknown, and slightly change its semantics. It now only indicates that the symbol's type is unknown, not that the symbol is undefined. (For that, use ST_Undefined). llvm-svn: 151696
* In the ObjectFile interface, replace isInternal(), isAbsolute(), isGlobal(), ↵David Meyer2012-02-281-43/+17
| | | | | | and isWeak(), with a bitset of flags. llvm-svn: 151670
* [Object] Add {begin,end}_dynamic_symbols stubs and implementation for ELF.Michael J. Spencer2012-02-281-0/+9
| | | | | | | | Add -D option to llvm-nm to dump dynamic symbols. Patch by David Meyer. llvm-svn: 151600
* Fixed ObjectFile functions:Danil Malyshev2011-11-291-11/+86
| | | | | | | | | | | - 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-72/+11
| | | | | | | | | | | | | 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-11/+72
| | | | | | | | | | | - 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
* If we're searching for a symbol reference to pretty-print a scattered ↵Owen Anderson2011-10-271-0/+18
| | | | | | relocation address, and we don't find a symbol table entry, try section begin addresses as well. llvm-svn: 143151
* Fix pretty printing of i386 local sect diff relocations, TLV relocations, ↵Owen Anderson2011-10-271-7/+50
| | | | | | and x86_64 TLV relocations in MachO. llvm-svn: 143140
* Add support for scattered relocations to the MachO relocatation pretty printer.Owen Anderson2011-10-261-86/+144
| | | | llvm-svn: 143051
* The order of the two symbol listings in a Macho x86_64 subtractor relocation ↵Owen Anderson2011-10-261-1/+3
| | | | | | is reversed from what seems intuitive to me. llvm-svn: 143035
* Include the full 64 bits of relocation data in the type info for MachO ↵Owen Anderson2011-10-261-1/+3
| | | | | | relocations, so that we can recognize scattered relocations. llvm-svn: 143033
* Expand relocation type field to 64 bits. MachO scattered relocations ↵Owen Anderson2011-10-261-1/+1
| | | | | | require 33 bits of type info. llvm-svn: 143032
* Improve pretty printing of GOT relocations in MachO on x86_64.Owen Anderson2011-10-261-0/+7
| | | | llvm-svn: 143031
* Remove unused variable.Eric Christopher2011-10-261-1/+0
| | | | llvm-svn: 143011
* Remove extraneous printing of "-PC".Owen Anderson2011-10-251-1/+0
| | | | llvm-svn: 142970
* Add support for the notion of "hidden" relocations. On MachO, these are ↵Owen Anderson2011-10-251-0/+32
| | | | | | | | relocation entries that are used as additional information for other, real relocations, rather than being relocations themselves. I'm not familiar enough with ELF or COFF to know if they should have any relocations marked hidden. llvm-svn: 142961
* Teach the MachO relocation pretty-printer to interpret ARM half-relocations.Owen Anderson2011-10-251-42/+104
| | | | llvm-svn: 142938
* More fixes and improvements to MachO relocation pretty-printing, particular ↵Owen Anderson2011-10-241-31/+127
| | | | | | for x86 and x86_64 relocations with addends. llvm-svn: 142875
* Get relocation parsing/dumping to a mostly-working state for MachO files.Owen Anderson2011-10-241-6/+127
| | | | llvm-svn: 142852
* Stub out some of the MachO relocation decoding hooks.Owen Anderson2011-10-241-0/+4
| | | | llvm-svn: 142840
* STABS symbols are debug symbols.Owen Anderson2011-10-211-1/+3
| | | | llvm-svn: 142673
* Object: Add isSymbolAbsolute and getSymbolSection.Michael J. Spencer2011-10-171-0/+37
| | | | llvm-svn: 142317
* Object: Add isSymbolWeak.Michael J. Spencer2011-10-171-0/+14
| | | | llvm-svn: 142316
OpenPOWER on IntegriCloud