summaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
AgeCommit message (Collapse)Author
2013-04-08Add all 4 MachO object types. Use the stored type to implement is64Bits().Rafael Espindola
llvm-svn: 179021
2013-04-07Make MachOObjectFile independent from MachOObject.Rafael Espindola
llvm-svn: 178998
2013-04-07Implement MachOObjectFile::getData directly.Rafael Espindola
llvm-svn: 178997
2013-04-07Implement MachOObjectFile::is64Bit directly.Rafael Espindola
llvm-svn: 178996
2013-04-07Implement MachOObjectFile::getHeaderSize directly.Rafael Espindola
llvm-svn: 178995
2013-04-07Implement MachOObjectFile::getHeader directly.Rafael Espindola
llvm-svn: 178994
2013-04-07Implement MachOObjectFile::getHeaderSize and MachOObjectFile::getData.Rafael Espindola
These were the last missing forwarding functions. Also consistently use the forwarding functions instead of using MachOObj directly. llvm-svn: 178992
2013-04-07Remove LoadCommandInfo now that we always have a pointer to the command.Rafael Espindola
LoadCommandInfo was needed to keep a command and its offset in the file. Now that we always have a pointer to the command, we don't need the offset. llvm-svn: 178991
2013-04-07Add MachOObjectFile::LoadCommandInfo.Rafael Espindola
This avoids using MachOObject::getLoadCommandInfo. llvm-svn: 178990
2013-04-07Use getLoadCommandInfo instead of MachOObj->getLoadCommandInfo.Rafael Espindola
llvm-svn: 178989
2013-04-07Construct MachOObject in MachOObjectFile's constructor.Rafael Espindola
llvm-svn: 178988
2013-04-07Remove unused argument.Rafael Espindola
llvm-svn: 178987
2013-04-07Remove MachOObjectFile::getObject.Rafael Espindola
llvm-svn: 178986
2013-04-07Remove two uses of getObject.Rafael Espindola
llvm-svn: 178985
2013-04-07Remove last use of InMemoryStruct in llvm-objdump.Rafael Espindola
llvm-svn: 178979
2013-04-06Remove last use of InMemoryStruct from MachOObjectFile.cpp.Rafael Espindola
llvm-svn: 178948
2013-04-06Don't use InMemoryStruct<macho::SymtabLoadCommand>.Rafael Espindola
This also required not using the RegisterStringTable API, which is also a good thing. llvm-svn: 178947
2013-04-06Don't use InMemoryStruct in getSymbol64TableEntry.Rafael Espindola
llvm-svn: 178946
2013-04-06Don't use InMemoryStruct in getSymbolTableEntry.Rafael Espindola
llvm-svn: 178945
2013-04-06Don't use InMemoryStruct in getRelocation.Rafael Espindola
llvm-svn: 178943
2013-04-05Define versions of Section that are explicitly marked as little endian.Rafael Espindola
These should really be templated like ELF, but this is a start. llvm-svn: 178896
2013-04-05Don't use InMemoryStruct in getSection and getSection64.Rafael Espindola
llvm-svn: 178894
2013-04-05Don't fetch pointers from a InMemoryStruct.Rafael Espindola
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
2013-02-28Move an assert earlier in a file and check that the result ofEric Christopher
our bitwise compare is equal to the field we're looking for. Noticed on inspection. llvm-svn: 176296
2013-02-12Add static cast to unsigned char whenever a character classification ↵Guy Benyei
function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. llvm-svn: 175006
2013-01-31Object: Fix errant fallthrough.Jim Grosbach
llvm-svn: 174079
2012-12-21Add a function to get the segment name of a section.Rafael Espindola
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
2012-12-19Revert 170545 while I debug the ppc failures.Rafael Espindola
llvm-svn: 170547
2012-12-19Add r170095 back.Rafael Espindola
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
2012-12-17Teach MachO which sections contain codeTim Northover
llvm-svn: 170349
2012-12-13Revert "Add a funciton to get the segment name of a section."Eric Christopher
This reverts commit r170095 since it appears to be breaking the bots. llvm-svn: 170105
2012-12-13Add a funciton to get the segment name of a section.Rafael Espindola
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
2012-12-12Remove some dead code.Rafael Espindola
llvm-svn: 169963
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth
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
2012-11-29Object: Pass the buffer name through when making a copy.Benjamin Kramer
Should bring the buildbots back to life. llvm-svn: 168935
2012-11-29Fix a memory leak in MachOObjectFile.Jim Grosbach
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
2012-10-29Add interface for querying object files for symbol values.Tim Northover
Currently only implemented for ELF. Patch by Amara Emerson. llvm-svn: 166918
2012-10-10Cosmetic changesAndrew Kaylor
llvm-svn: 165588
2012-10-10This patch adds new functions to the SectionRef and ObjectFile interfaces to ↵Andrew Kaylor
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
2012-05-24Mark some static arrays as const.Craig Topper
llvm-svn: 157377
2012-05-02Fix the implementation of MachOObjectFile::isSectionZeroInit so it follows ↵Eli Friedman
the MachO spec. llvm-svn: 155976
2012-04-13Remove unused variable.Benjamin Kramer
llvm-svn: 154661
2012-04-12This patch improves the MCJIT runtime dynamic loader by adding new handlingPreston Gurd
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
2012-04-10Add a constructor for DataRefImpl and remove excess initialization.Danil Malyshev
llvm-svn: 154371
2012-03-09[Object]David Meyer
Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big llvm-svn: 152435
2012-03-01[Object]David Meyer
Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object. llvm-svn: 151845
2012-03-01[Object]David Meyer
* 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
2012-02-29[Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and ↵David Meyer
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
2012-02-28In the ObjectFile interface, replace isInternal(), isAbsolute(), isGlobal(), ↵David Meyer
and isWeak(), with a bitset of flags. llvm-svn: 151670
2012-02-28[Object] Add {begin,end}_dynamic_symbols stubs and implementation for ELF.Michael J. Spencer
Add -D option to llvm-nm to dump dynamic symbols. Patch by David Meyer. llvm-svn: 151600