Rui Ueyama
9fac39d7e4
readobj: Dump PE/COFF optional records.
...
These records are mandatory for executables and are used by the loader.
Reviewers: rafael
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D939
llvm-svn: 183852
2013-06-12 19:10:33 +00:00
Rui Ueyama
f9939fdb3c
[PECOFF] Remove COFF header from PE header for simplicity.
...
COFF header is always present both in executable and in object file. PE header
is present only in executable. So the natural way to handle PE/COFF file is
treating COFF is mandatory header and PE is optional. Current data structre
does not allow it, because PE header includes COFF header. Removing COFF
header will simplify the code to handle PE/COFF files.
Reviewers: Bigcheese
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D952
llvm-svn: 183788
2013-06-11 21:39:48 +00:00
Rui Ueyama
8be98a268d
[Object/COFF] BaseOfData field should be absent in PE32+.
...
llvm-svn: 183534
2013-06-07 16:58:30 +00:00
Rafael Espindola
6f41305fd8
Handle relocations that don't point to symbols.
...
In ELF (as in MachO), not all relocations point to symbols. Represent this
properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj
ELF's dumper to handle relocatios without symbols.
llvm-svn: 183284
2013-06-05 01:33:53 +00:00
Rui Ueyama
91b0546532
[Object/COFF] Add dos_header, pe32{,plus}_header and data_directory.
...
Reviewers: Bigcheese
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D905
llvm-svn: 183087
2013-06-02 21:08:45 +00:00
Rafael Espindola
56fa3ce519
Change getRelocationAdditionalInfo to be ELF only.
...
It was only implemented for ELF where it collected the Addend, so this
patch also renames it to getRelocationAddend.
llvm-svn: 181502
2013-05-09 03:39:05 +00:00
Tim Northover
86db334e17
Add interface for querying object files for symbol values.
...
Currently only implemented for ELF.
Patch by Amara Emerson.
llvm-svn: 166918
2012-10-29 10:47:00 +00:00
Sean Silva
2174f713f4
Remove unnecessary classof()'s
...
isa<> et al. automatically infer when the cast is an upcast (including a
self-cast), so these are no longer necessary.
llvm-svn: 165767
2012-10-11 23:30:49 +00:00
Andrew Kaylor
b850da774b
This patch adds new functions to the SectionRef and ObjectFile interfaces to 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-10-10 01:41:33 +00:00
Marshall Clow
c56632d5e5
Added accessors for getting coff_relocation info
...
llvm-svn: 158675
2012-06-18 19:47:16 +00:00
Marshall Clow
49e964c47f
Adding acessors to COFFObjectFile so that clients can get at the (non-generic) bits
...
llvm-svn: 158484
2012-06-15 01:08:25 +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
Michael J. Spencer
e5d5ca4072
[Object/COFF]: Expose getSectionContents.
...
llvm-svn: 153051
2012-03-19 20:27:37 +00:00
Michael J. Spencer
2174510edf
[Object/COFF]: Expose getSectionName.
...
Also add some documentation.
llvm-svn: 153050
2012-03-19 20:27:15 +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
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
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
Michael J. Spencer
cdfd6ee8bc
Object/COFF: Change type from a struct to a uint16_t. The struct would be
...
incorrect for bigendian systems.
llvm-svn: 142403
2011-10-18 19:31:59 +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
a9bbb5d675
Object/COFF: Expose more data in the public API.
...
llvm-svn: 142315
2011-10-17 23:53:56 +00:00
Michael J. Spencer
3a7d4d9fe0
Object: Implement casting for concrete classes.
...
llvm-svn: 142314
2011-10-17 23:53:37 +00:00
Michael J. Spencer
c787cb4441
Object: Fix redundant name.
...
llvm-svn: 142238
2011-10-17 20:19:29 +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
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
Michael J. Spencer
83e956656a
Object: Add proper error handling.
...
llvm-svn: 133872
2011-06-25 17:55:23 +00:00
Michael J. Spencer
d5934fefee
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
8288453980
Revert the last two commits in the series. r132911, r132912.
...
llvm-svn: 132913
2011-06-13 11:53:31 +00:00
Michael J. Spencer
642af05937
Make Binary the parent of ObjectFile and update children to new interface.
...
llvm-svn: 132911
2011-06-13 11:12:33 +00:00