|  | Commit message (Collapse) | Author | Age | Files | Lines | 
|---|
| ... |  | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | For Mach-O there were 2 implementations for parsing object files. A
standalone llvm/Object/MachOObject.h and llvm/Object/MachO.h which
implements the generic interface in llvm/Object/ObjectFile.h.
This patch adds the missing features to MachO.h, moves macho-dump to
use MachO.h and removes ObjectFile.h.
In addition to making sure that check-all is clean, I checked that the
new version produces exactly the same output in all Mach-O files in a
llvm+clang build directory (including executables and shared
libraries).
To test the performance, I ran macho-dump over all the files in a
llvm+clang build directory again, but this time redirecting the output
to /dev/null. Both the old and new versions take about 4.6 seconds
(2.5 user) to finish.
llvm-svn: 180624 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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: 180262 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | getRelocationAddress is for dynamic libraries and executables,
getRelocationOffset for relocatable objects.
Mark the getRelocationAddress of COFF and MachO as not implemented yet. Add a
test of ELF's. llvm-readobj -r now prints the same values as readelf -r.
llvm-svn: 180259 | 
| | 
| 
| 
| 
| 
| 
| 
| | While here, don't report a dummy symbol for relocations that don't have symbols.
We used to says such relocations were for the first defined symbol, but now we
return end_symbols(). The llvm-readobj output change agrees with otool.
llvm-svn: 180214 | 
| | 
| 
| 
| 
| 
| 
| | This should bring the ppc bots back. I will try to write a test that would
have found the problem on a little endian system too.
llvm-svn: 180194 | 
| | 
| 
| 
| | llvm-svn: 180190 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 179851 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| | We are still able to handle mixed endian objects by swapping one struct at a
time.
llvm-svn: 179778 | 
| | 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 179303 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 179179 | 
| | 
| 
| 
| 
| 
| | For now they are still only used as little endian.
llvm-svn: 179147 | 
| | 
| 
| 
| 
| 
| 
| | For now it is templated only on being 64 or 32 bits. I will add little/big
endian next.
llvm-svn: 179097 | 
| | 
| 
| 
| | llvm-svn: 179076 | 
| | 
| 
| 
| 
| 
| | Use it when we don't need to know if we have a 32 or 64 bit SymbolTableEntry.
llvm-svn: 179074 | 
| | 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 179051 | 
| | 
| 
| 
| | llvm-svn: 179048 | 
| | 
| 
| 
| | llvm-svn: 179021 | 
| | 
| 
| 
| | llvm-svn: 178998 | 
| | 
| 
| 
| | llvm-svn: 178997 | 
| | 
| 
| 
| | llvm-svn: 178996 | 
| | 
| 
| 
| | llvm-svn: 178995 | 
| | 
| 
| 
| | llvm-svn: 178994 | 
| | 
| 
| 
| 
| 
| 
| | These were the last missing forwarding functions. Also consistently use
the forwarding functions instead of using MachOObj directly.
llvm-svn: 178992 | 
| | 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | This avoids using MachOObject::getLoadCommandInfo.
llvm-svn: 178990 | 
| | 
| 
| 
| | llvm-svn: 178989 | 
| | 
| 
| 
| | llvm-svn: 178988 | 
| | 
| 
| 
| | llvm-svn: 178987 | 
| | 
| 
| 
| | llvm-svn: 178986 | 
| | 
| 
| 
| | llvm-svn: 178985 | 
| | 
| 
| 
| | llvm-svn: 178979 | 
| | 
| 
| 
| | llvm-svn: 178948 | 
| | 
| 
| 
| 
| 
| 
| | This also required not using the RegisterStringTable API, which is also a
good thing.
llvm-svn: 178947 | 
| | 
| 
| 
| | llvm-svn: 178946 | 
| | 
| 
| 
| | llvm-svn: 178945 | 
| | 
| 
| 
| | llvm-svn: 178943 | 
| | 
| 
| 
| 
| 
| | These should really be templated like ELF, but this is a start.
llvm-svn: 178896 | 
| | 
| 
| 
| | llvm-svn: 178894 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| | our bitwise compare is equal to the field we're looking for.
Noticed on inspection.
llvm-svn: 176296 | 
| | 
| 
| 
| 
| 
| | function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration.
llvm-svn: 175006 | 
| | 
| 
| 
| | llvm-svn: 174079 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 |