Eli Friedman
101c4055c5
Fix the implementation of MachOObjectFile::isSectionZeroInit so it follows the MachO spec.
...
llvm-svn: 155976
2012-05-02 02:31:28 +00:00
Benjamin Kramer
9087b1f54a
Remove unused variable.
...
llvm-svn: 154661
2012-04-13 08:09:12 +00:00
Preston Gurd
6e9bcca355
This patch improves the MCJIT runtime dynamic loader by adding new handling
...
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-12 20:13:57 +00:00
Danil Malyshev
6db4fe8581
Add a constructor for DataRefImpl and remove excess initialization.
...
llvm-svn: 154371
2012-04-10 01:54:44 +00:00
David Meyer
c6de5a081b
[Object]
...
Make Binary::TypeID more granular, to distinguish between ELF 32/64 little/big
llvm-svn: 152435
2012-03-09 20:41:57 +00:00
David Meyer
7f21ecb667
[Object]
...
Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object.
llvm-svn: 151845
2012-03-01 22:19:54 +00:00
David Meyer
44201a2d17
[Object]
...
* 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-03-01 01:36:50 +00:00
David Meyer
e9705e2949
[Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and 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-29 02:11:55 +00:00
David Meyer
31e23de700
In the ObjectFile interface, replace isInternal(), isAbsolute(), isGlobal(), and isWeak(), with a bitset of flags.
...
llvm-svn: 151670
2012-02-28 23:47:53 +00:00
Michael J. Spencer
0aef1b9f18
[Object] Add {begin,end}_dynamic_symbols stubs and implementation for ELF.
...
Add -D option to llvm-nm to dump dynamic symbols.
Patch by David Meyer.
llvm-svn: 151600
2012-02-28 00:40:37 +00:00
Danil Malyshev
5ce4e1a9d3
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
e5e455c97f
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
3bbe062799
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
6508cba44c
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
9aaee13bf1
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
11396b575d
Add support for scattered relocations to the MachO relocatation pretty printer.
...
llvm-svn: 143051
2011-10-26 20:42:54 +00:00
Owen Anderson
8d9656dd53
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
27580bf1eb
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
7a9bb4d47f
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
fc7467fd5e
Improve pretty printing of GOT relocations in MachO on x86_64.
...
llvm-svn: 143031
2011-10-26 17:05:20 +00:00
Eric Christopher
0042cece21
Remove unused variable.
...
llvm-svn: 143011
2011-10-26 03:47:16 +00:00
Owen Anderson
b3538ebf33
Remove extraneous printing of "-PC".
...
llvm-svn: 142970
2011-10-25 20:44:00 +00:00
Owen Anderson
69d98376b9
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
60bbbbced1
Teach the MachO relocation pretty-printer to interpret ARM half-relocations.
...
llvm-svn: 142938
2011-10-25 18:48:41 +00:00
Owen Anderson
3bfe29265a
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
aa91e360eb
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
445fdc6049
Stub out some of the MachO relocation decoding hooks.
...
llvm-svn: 142840
2011-10-24 20:19:18 +00:00
Owen Anderson
806a1e5c78
STABS symbols are debug symbols.
...
llvm-svn: 142673
2011-10-21 19:26:54 +00:00
Michael J. Spencer
25b0873d7f
Object: Add isSymbolAbsolute and getSymbolSection.
...
llvm-svn: 142317
2011-10-17 23:54:46 +00:00
Michael J. Spencer
3f458c5498
Object: Add isSymbolWeak.
...
llvm-svn: 142316
2011-10-17 23:54:22 +00:00
Michael J. Spencer
c787cb4441
Object: Fix redundant name.
...
llvm-svn: 142238
2011-10-17 20:19:29 +00:00
Owen Anderson
a3ffb86b9a
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
6931df0d99
Don't label a STAB debugging symbol as a function symbol.
...
llvm-svn: 141824
2011-10-12 22:23:12 +00:00
Owen Anderson
6e41e4318d
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
43ef26d840
Section indices in MachO symbol tables begin at 1, not 0.
...
llvm-svn: 141815
2011-10-12 21:43:24 +00:00
Owen Anderson
85292f7b5d
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
525906b5d9
Fix warning.
...
llvm-svn: 141597
2011-10-10 23:36:56 +00:00
Michael J. Spencer
ebd507f958
Object: add getSectionAlignment.
...
llvm-svn: 141581
2011-10-10 21:55:43 +00:00
Michael J. Spencer
34d76cf95b
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
ecbddb2b9e
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
14925a859b
Change relocation API to be per section.
...
llvm-svn: 141376
2011-10-07 18:15:25 +00:00
Michael J. Spencer
5948c3822e
Object: Add isSection{Data,BSS}.
...
llvm-svn: 140721
2011-09-28 20:57:30 +00:00
Benjamin Kramer
52607b3842
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
da0ca686c9
Remove dead code.
...
llvm-svn: 139343
2011-09-09 00:22:05 +00:00
Nick Lewycky
ec5437bfc4
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
3c40c2100b
Add support for relocations to ObjectFile.
...
Patch by Danil Malyshev!
llvm-svn: 139314
2011-09-08 20:52:17 +00:00
Benjamin Kramer
5936e08079
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
3a3a5a7f5e
MachOObjectFile: Get symbol functions ready for 64 bit.
...
llvm-svn: 135282
2011-07-15 17:32:45 +00:00
Benjamin Kramer
5365237e2e
Output MachO section names in the form SEGMENT,section.
...
llvm-svn: 135231
2011-07-15 00:29:02 +00:00
Benjamin Kramer
4ab7b03d14
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