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
Rafael Espindola
9541db893e
Clarify getRelocationAddress x getRelocationOffset a bit.
...
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
2013-04-25 12:28:45 +00:00
Rafael Espindola
5700fcf335
Remove unused argument.
...
llvm-svn: 178987
2013-04-07 16:40:00 +00:00
Guy Benyei
92dac48079
Add static cast to unsigned char whenever a character classification function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration.
...
llvm-svn: 175006
2013-02-12 21:21:59 +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
Andrew Kaylor
2698e6d553
Cosmetic changes
...
llvm-svn: 165588
2012-10-10 01:45:52 +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
0ee85444ac
Had a closing brace inside an #ifdef -- oops!
...
llvm-svn: 158485
2012-06-15 01:15:47 +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
Danil Malyshev
6db4fe8581
Add a constructor for DataRefImpl and remove excess initialization.
...
llvm-svn: 154371
2012-04-10 01:54:44 +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
Michael J. Spencer
bff63f6e96
Fix bug found by warning.
...
llvm-svn: 152812
2012-03-15 17:49:29 +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
Daniel Dunbar
64fe398fc0
Fix some possible gcc-4.2 may be used uninitialized warnings.
...
llvm-svn: 145292
2011-11-28 22:19:32 +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
Michael J. Spencer
346238dcfc
Object/COFF: Support common symbols.
...
llvm-svn: 144861
2011-11-16 23:36:12 +00:00
Michael J. Spencer
ca21136ca9
Object/COFF: Fix PE reading.
...
llvm-svn: 144148
2011-11-08 23:34:07 +00:00
Michael J. Spencer
7dcaa63cb2
object/COFF: Properly initalize uses of DataRefImpl.
...
llvm-svn: 143562
2011-11-02 19:33:26 +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
1b471da6b0
Object/COFF: Remove useless test.
...
llvm-svn: 142408
2011-10-18 19:51:36 +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
c787cb4441
Object: Fix redundant name.
...
llvm-svn: 142238
2011-10-17 20:19:29 +00:00
Michael J. Spencer
9a10012151
COFF: Implement sectionContainsSymbol for relocatable files only.
...
llvm-svn: 141884
2011-10-13 20:36:54 +00:00
Michael J. Spencer
ebd507f958
Object: add getSectionAlignment.
...
llvm-svn: 141581
2011-10-10 21:55:43 +00:00
NAKAMURA Takumi
2a3eab692a
lib/Object: Suppress warnings on gcc-4.3.4 cygwin
...
llvm-svn: 141485
2011-10-08 11:22:53 +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
b101f55fa4
Silence false positive uninitialized variable warnings from GCC.
...
llvm-svn: 139573
2011-09-13 01:59:24 +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
b054fe79e3
Use memcmp.
...
llvm-svn: 134439
2011-07-05 20:28:00 +00:00
Rafael Espindola
9fdf25214f
Really fix typo :-(
...
llvm-svn: 134436
2011-07-05 19:17:10 +00:00
Rafael Espindola
1b99dbcf82
Fix typo.
...
llvm-svn: 134433
2011-07-05 19:13:27 +00:00
Rafael Espindola
e54f949f37
Compare all 4 bytes of the header.
...
llvm-svn: 134427
2011-07-05 18:41:47 +00:00