summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Formatting fixes.Rafael Espindola2013-04-241-31/+20
| | | | llvm-svn: 180190
* Use a pointer as the relocation iterator.Rafael Espindola2013-04-241-23/+28
| | | | | | | | Since the relocation iterator walks only the relocations in one section, we can just use a pointer and avoid fetching information about the section at every reference. llvm-svn: 180189
* refactor the struct byte swapping to a helper function.Rafael Espindola2013-04-191-70/+20
| | | | llvm-svn: 179851
* Don't read one command past the end.Rafael Espindola2013-04-191-2/+6
| | | | | | | | | Thanks to Evgeniy Stepanov for reporting this. It might be a good idea to add a command iterator abstraction to MachO.h, but this fixes the bug for now. llvm-svn: 179848
* At Jim Grosbach's request detemplate Object/MachO.h.Rafael Espindola2013-04-181-82/+1379
| | | | | | | We are still able to handle mixed endian objects by swapping one struct at a time. llvm-svn: 179778
* Finish templating MachObjectFile over endianness.Rafael Espindola2013-04-131-417/+15
| | | | | | | We are now able to handle big endian macho files in llvm-readobject. Thanks to David Fang for providing the object files. llvm-svn: 179440
* Add 179294 back, but don't use bit fields so that it works on big endian hosts.Rafael Espindola2013-04-121-8/+44
| | | | | | | | | | | | | | Original message: Print more information about relocations. With this patch llvm-readobj now prints if a relocation is pcrel, its length, if it is extern and if it is scattered. It also refactors the code a bit to use bit fields instead of shifts and masks all over the place. llvm-svn: 179345
* Revert my last two commits while I debug what is wrong in a big endian host.Rafael Espindola2013-04-111-44/+8
| | | | llvm-svn: 179303
* Print more information about relocations.Rafael Espindola2013-04-111-8/+44
| | | | | | | | | | With this patch llvm-readobj now prints if a relocation is pcrel, its length, if it is extern and if it is scattered. It also refactors the code a bit to use bit fields instead of shifts and masks all over the place. llvm-svn: 179294
* Fix MachO's getRelocationAdditionalInfo.Rafael Espindola2013-04-111-0/+6
| | | | | | | It was returning the loaded address of the section containing the relocation, which really doesn't seem to be the intent of this function. llvm-svn: 179255
* Template MachOObjectFile over endianness too.Rafael Espindola2013-04-101-9/+9
| | | | llvm-svn: 179179
* Template the MachO types over endianness.Rafael Espindola2013-04-101-6/+6
| | | | | | For now they are still only used as little endian. llvm-svn: 179147
* Convert MachOObjectFile to a template.Rafael Espindola2013-04-091-852/+110
| | | | | | | For now it is templated only on being 64 or 32 bits. I will add little/big endian next. llvm-svn: 179097
* More uses for SymbolTableEntryBase.Rafael Espindola2013-04-091-35/+9
| | | | llvm-svn: 179076
* Add a SymbolTableEntryBase.Rafael Espindola2013-04-091-47/+27
| | | | | | Use it when we don't need to know if we have a 32 or 64 bit SymbolTableEntry. llvm-svn: 179074
* Add a SectionBase struct.Rafael Espindola2013-04-081-24/+24
| | | | | | | Use it to share code and when we don't need to know if we have a 32 or 64 bit Section. llvm-svn: 179072
* Template the MachO types over the word size.Rafael Espindola2013-04-081-65/+86
| | | | llvm-svn: 179051
* Remove is64BitLoadCommand.Rafael Espindola2013-04-081-20/+10
| | | | llvm-svn: 179048
* Add all 4 MachO object types. Use the stored type to implement is64Bits().Rafael Espindola2013-04-081-5/+8
| | | | llvm-svn: 179021
* Make MachOObjectFile independent from MachOObject.Rafael Espindola2013-04-071-16/+9
| | | | llvm-svn: 178998
* Implement MachOObjectFile::getData directly.Rafael Espindola2013-04-071-1/+1
| | | | llvm-svn: 178997
* Implement MachOObjectFile::is64Bit directly.Rafael Espindola2013-04-071-1/+2
| | | | llvm-svn: 178996
* Implement MachOObjectFile::getHeaderSize directly.Rafael Espindola2013-04-071-1/+1
| | | | llvm-svn: 178995
* Implement MachOObjectFile::getHeader directly.Rafael Espindola2013-04-071-14/+15
| | | | llvm-svn: 178994
* Implement MachOObjectFile::getHeaderSize and MachOObjectFile::getData.Rafael Espindola2013-04-071-41/+44
| | | | | | | These were the last missing forwarding functions. Also consistently use the forwarding functions instead of using MachOObj directly. llvm-svn: 178992
* Remove LoadCommandInfo now that we always have a pointer to the command.Rafael Espindola2013-04-071-58/+27
| | | | | | | 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
* Add MachOObjectFile::LoadCommandInfo.Rafael Espindola2013-04-071-8/+23
| | | | | | This avoids using MachOObject::getLoadCommandInfo. llvm-svn: 178990
* Use getLoadCommandInfo instead of MachOObj->getLoadCommandInfo.Rafael Espindola2013-04-071-18/+19
| | | | llvm-svn: 178989
* Construct MachOObject in MachOObjectFile's constructor.Rafael Espindola2013-04-071-16/+20
| | | | llvm-svn: 178988
* Remove unused argument.Rafael Espindola2013-04-071-1/+1
| | | | llvm-svn: 178987
* Remove MachOObjectFile::getObject.Rafael Espindola2013-04-071-0/+14
| | | | llvm-svn: 178986
* Remove two uses of getObject.Rafael Espindola2013-04-071-0/+3
| | | | llvm-svn: 178985
* Remove last use of InMemoryStruct in llvm-objdump.Rafael Espindola2013-04-071-0/+8
| | | | llvm-svn: 178979
* Remove last use of InMemoryStruct from MachOObjectFile.cpp.Rafael Espindola2013-04-061-4/+19
| | | | llvm-svn: 178948
* Don't use InMemoryStruct<macho::SymtabLoadCommand>.Rafael Espindola2013-04-061-20/+43
| | | | | | | This also required not using the RegisterStringTable API, which is also a good thing. llvm-svn: 178947
* Don't use InMemoryStruct in getSymbol64TableEntry.Rafael Espindola2013-04-061-24/+19
| | | | llvm-svn: 178946
* Don't use InMemoryStruct in getSymbolTableEntry.Rafael Espindola2013-04-061-23/+19
| | | | llvm-svn: 178945
* Don't use InMemoryStruct in getRelocation.Rafael Espindola2013-04-061-31/+21
| | | | llvm-svn: 178943
* 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
OpenPOWER on IntegriCloud