Commit Graph

59 Commits

Author SHA1 Message Date
Rafael Espindola 0d15f7313f 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 1e48387962 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 717c4d44c4 Remove unused argument.
llvm-svn: 178987
2013-04-07 16:40:00 +00:00
Guy Benyei 83c74e9fad 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 4f223bf7c4 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 b96a320a2e Cosmetic changes
llvm-svn: 165588
2012-10-10 01:45:52 +00:00
Andrew Kaylor 3f31fa05d5 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 d3e2a76ca4 Added accessors for getting coff_relocation info
llvm-svn: 158675
2012-06-18 19:47:16 +00:00
Marshall Clow bfb85e676c Had a closing brace inside an #ifdef -- oops!
llvm-svn: 158485
2012-06-15 01:15:47 +00:00
Marshall Clow 71757ef3ed 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 2138ef6d3d 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 549515e128 Add a constructor for DataRefImpl and remove excess initialization.
llvm-svn: 154371
2012-04-10 01:54:44 +00:00
Michael J. Spencer 9da9e6937f [Object/COFF]: Expose getSectionContents.
llvm-svn: 153051
2012-03-19 20:27:37 +00:00
Michael J. Spencer 53c2d5477a [Object/COFF]: Expose getSectionName.
Also add some documentation.

llvm-svn: 153050
2012-03-19 20:27:15 +00:00
Michael J. Spencer 7a89e0cc01 Fix bug found by warning.
llvm-svn: 152812
2012-03-15 17:49:29 +00:00
David Meyer d53422d1a7 [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 c429b80da1 [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 2fc34c5f84 [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 7e4b976c36 [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 1df4b84db4 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 8c4729fd44 [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 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
Daniel Dunbar 9339d4556e Fix some possible gcc-4.2 may be used uninitialized warnings.
llvm-svn: 145292
2011-11-28 22:19:32 +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
Michael J. Spencer d27d51fbaf Object/COFF: Support common symbols.
llvm-svn: 144861
2011-11-16 23:36:12 +00:00
Michael J. Spencer d5930ca99d Object/COFF: Fix PE reading.
llvm-svn: 144148
2011-11-08 23:34:07 +00:00
Michael J. Spencer d0f5b0e194 object/COFF: Properly initalize uses of DataRefImpl.
llvm-svn: 143562
2011-11-02 19:33:26 +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
Michael J. Spencer 443410d722 Object/COFF: Remove useless test.
llvm-svn: 142408
2011-10-18 19:51:36 +00:00
Michael J. Spencer 097be9f63c 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 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 89a7a5ea1f Object/COFF: Expose more data in the public API.
llvm-svn: 142315
2011-10-17 23:53:56 +00:00
Michael J. Spencer d39466760a Object: Fix redundant name.
llvm-svn: 142238
2011-10-17 20:19:29 +00:00
Michael J. Spencer 9a28851e52 COFF: Implement sectionContainsSymbol for relocatable files only.
llvm-svn: 141884
2011-10-13 20:36:54 +00:00
Michael J. Spencer 7989460a1f Object: add getSectionAlignment.
llvm-svn: 141581
2011-10-10 21:55:43 +00:00
NAKAMURA Takumi 648b2fafd8 lib/Object: Suppress warnings on gcc-4.3.4 cygwin
llvm-svn: 141485
2011-10-08 11:22:53 +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 40ddfedd6c Silence false positive uninitialized variable warnings from GCC.
llvm-svn: 139573
2011-09-13 01:59:24 +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 e6490e03d7 Use memcmp.
llvm-svn: 134439
2011-07-05 20:28:00 +00:00
Rafael Espindola bac192d6cf Really fix typo :-(
llvm-svn: 134436
2011-07-05 19:17:10 +00:00
Rafael Espindola 5a0f0fba30 Fix typo.
llvm-svn: 134433
2011-07-05 19:13:27 +00:00
Rafael Espindola 00aae24a08 Compare all 4 bytes of the header.
llvm-svn: 134427
2011-07-05 18:41:47 +00:00