Danil Malyshev
cbe72fc959
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: 145408
2011-11-29 17:40:10 +00:00
Chandler Carruth
37ab257b88
Revert r145180 as it is causing test failures on all the bots.
...
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
2011-11-27 10:37:47 +00:00
Danil Malyshev
2631f93f7d
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: 145180
2011-11-27 10:12:52 +00:00
Owen Anderson
debe01c660
If we're searching for a symbol reference to pretty-print a scattered relocation address, and we don't find a symbol table entry, try section begin addresses as well.
...
llvm-svn: 143151
2011-10-27 21:53:50 +00:00
Owen Anderson
62972f5cd3
Fix pretty printing of i386 local sect diff relocations, TLV relocations, and x86_64 TLV relocations in MachO.
...
llvm-svn: 143140
2011-10-27 20:46:09 +00:00
Owen Anderson
bc14bd3bfb
Add support for scattered relocations to the MachO relocatation pretty printer.
...
llvm-svn: 143051
2011-10-26 20:42:54 +00:00
Owen Anderson
90c49c037e
The order of the two symbol listings in a Macho x86_64 subtractor relocation is reversed from what seems intuitive to me.
...
llvm-svn: 143035
2011-10-26 17:28:49 +00:00
Owen Anderson
04e46b6ae4
Include the full 64 bits of relocation data in the type info for MachO relocations, so that we can recognize scattered relocations.
...
llvm-svn: 143033
2011-10-26 17:10:22 +00:00
Owen Anderson
7be76590e6
Expand relocation type field to 64 bits. MachO scattered relocations require 33 bits of type info.
...
llvm-svn: 143032
2011-10-26 17:08:49 +00:00
Owen Anderson
b92de2de71
Improve pretty printing of GOT relocations in MachO on x86_64.
...
llvm-svn: 143031
2011-10-26 17:05:20 +00:00
Eric Christopher
ff37313f12
Remove unused variable.
...
llvm-svn: 143011
2011-10-26 03:47:16 +00:00
Owen Anderson
377137e2ed
Remove extraneous printing of "-PC".
...
llvm-svn: 142970
2011-10-25 20:44:00 +00:00
Owen Anderson
fa3e5200b8
Add support for the notion of "hidden" relocations. On MachO, these are 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
2011-10-25 20:35:53 +00:00
Owen Anderson
52cd8acafc
Teach the MachO relocation pretty-printer to interpret ARM half-relocations.
...
llvm-svn: 142938
2011-10-25 18:48:41 +00:00
Owen Anderson
171f485f15
More fixes and improvements to MachO relocation pretty-printing, particular for x86 and x86_64 relocations with addends.
...
llvm-svn: 142875
2011-10-24 23:20:07 +00:00
Owen Anderson
c8c94da8c8
Get relocation parsing/dumping to a mostly-working state for MachO files.
...
llvm-svn: 142852
2011-10-24 21:44:00 +00:00
Owen Anderson
953af053eb
Stub out some of the MachO relocation decoding hooks.
...
llvm-svn: 142840
2011-10-24 20:19:18 +00:00
Owen Anderson
cef5641982
STABS symbols are debug symbols.
...
llvm-svn: 142673
2011-10-21 19:26:54 +00:00
Michael J. Spencer
321731539e
Object: Add isSymbolAbsolute and getSymbolSection.
...
llvm-svn: 142317
2011-10-17 23:54:46 +00:00
Michael J. Spencer
017597540e
Object: Add isSymbolWeak.
...
llvm-svn: 142316
2011-10-17 23:54:22 +00:00
Michael J. Spencer
d39466760a
Object: Fix redundant name.
...
llvm-svn: 142238
2011-10-17 20:19:29 +00:00
Owen Anderson
000721f058
The VMAs stored in the symbol table of a MachO file are absolute addresses, not offsets from the section.
...
llvm-svn: 141828
2011-10-12 22:37:10 +00:00
Owen Anderson
34e1707fbb
Don't label a STAB debugging symbol as a function symbol.
...
llvm-svn: 141824
2011-10-12 22:23:12 +00:00
Owen Anderson
fb02ecde5e
sectionContainsSymbol needs to be based on VMA's rather than section indices to properly account for files with segment load commands that contain no sections.
...
llvm-svn: 141822
2011-10-12 22:21:32 +00:00
Owen Anderson
f903c154c7
Section indices in MachO symbol tables begin at 1, not 0.
...
llvm-svn: 141815
2011-10-12 21:43:24 +00:00
Owen Anderson
27c579dba4
Expose MachOObjectFile externally, like we do for COFF. First step in reducing the amount of special-purpose code needed for llvm-objdump.
...
llvm-svn: 141684
2011-10-11 17:32:27 +00:00
Michael J. Spencer
ee3be4f2a9
Fix warning.
...
llvm-svn: 141597
2011-10-10 23:36:56 +00:00
Michael J. Spencer
7989460a1f
Object: add getSectionAlignment.
...
llvm-svn: 141581
2011-10-10 21:55:43 +00:00
Michael J. Spencer
e5fd004719
Change relocation API to be per section. This time without breaking GCC.
...
llvm-svn: 141385
2011-10-07 19:25:32 +00:00
Bill Wendling
206d8a7f48
Revert 141376 and 141377 due to breaking the build.
...
--- 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
llvm-svn: 141379
2011-10-07 18:25:37 +00:00
Michael J. Spencer
b0d61540cb
Change relocation API to be per section.
...
llvm-svn: 141376
2011-10-07 18:15:25 +00:00
Michael J. Spencer
800619f2bb
Object: Add isSection{Data,BSS}.
...
llvm-svn: 140721
2011-09-28 20:57:30 +00:00
Benjamin Kramer
75d1cf3391
Object: make the following changes into SymbolRef
...
- 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!
llvm-svn: 139683
2011-09-14 01:22:52 +00:00
Benjamin Kramer
eba0b40384
Remove dead code.
...
llvm-svn: 139343
2011-09-09 00:22:05 +00:00
Nick Lewycky
940b598f6f
Fix release build:
...
MachOObjectFile.cpp:524: error: unused variable 'NumLoadCommands' [-Wunused-variable]
llvm-svn: 139341
2011-09-09 00:16:50 +00:00
Benjamin Kramer
022ecdf277
Add support for relocations to ObjectFile.
...
Patch by Danil Malyshev!
llvm-svn: 139314
2011-09-08 20:52:17 +00:00
Benjamin Kramer
f6f3e81c07
ObjectFile: Add a method to check whether a section contains a symbol.
...
- No ELF or COFF implementation yet, I don't have a way to test that.
Should be straightforward to add though.
llvm-svn: 135288
2011-07-15 18:39:21 +00:00
Benjamin Kramer
99582e9b52
MachOObjectFile: Get symbol functions ready for 64 bit.
...
llvm-svn: 135282
2011-07-15 17:32:45 +00:00
Benjamin Kramer
c41d4fe243
Output MachO section names in the form SEGMENT,section.
...
llvm-svn: 135231
2011-07-15 00:29:02 +00:00
Benjamin Kramer
56498d167a
Add support for 64 bit objects to MachOObjectFile.
...
- I don't see a better way than duplicating all the code.
llvm-svn: 135229
2011-07-15 00:14:48 +00:00
Benjamin Kramer
b1d80722a8
MachOObjectFile: Change isSectionText to return true for sections named text, not for load commands name __TEXT (which isn't the case in actual object files)
...
llvm-svn: 135228
2011-07-15 00:14:46 +00:00
Michael J. Spencer
1d6167fd30
Object: Add proper error handling.
...
llvm-svn: 133872
2011-06-25 17:55:23 +00:00
Michael J. Spencer
ec29b121ff
Make Binary the parent of ObjectFile and update children to new interface.
...
llvm-svn: 133870
2011-06-25 17:54:50 +00:00
Michael J. Spencer
aa41981dd8
Revert the last two commits in the series. r132911, r132912.
...
llvm-svn: 132913
2011-06-13 11:53:31 +00:00
Michael J. Spencer
a7f9c49aab
Make Binary the parent of ObjectFile and update children to new interface.
...
llvm-svn: 132911
2011-06-13 11:12:33 +00:00
Eric Christopher
ae95ad1935
Use enums for constant values.
...
llvm-svn: 129984
2011-04-22 06:34:01 +00:00
Eric Christopher
22a19816f6
Make the file format strings a little prettier for mach-o.
...
llvm-svn: 129980
2011-04-22 04:08:58 +00:00
Eric Christopher
7b015c7598
Add an ObjectFile implementation for mach-o.
...
Patch by Patrick Walton!
llvm-svn: 129974
2011-04-22 03:19:48 +00:00