Davide Italiano
256ba29add
[llvm-readobj] Add support for MachO DataInCodeDataCommand.
...
Example output:
File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
DataInCode {
Data offset: 300
Data size: 32
Data Regions [
DICE {
Index: 0
Offset: 0
Length: 4
Kind: 1
}
DICE {
Index: 1
Offset: 4
Length: 4
Kind: 4
}
DICE {
Index: 2
Offset: 8
Length: 2
Kind: 3
}
DICE {
Index: 3
Offset: 10
Length: 1
Kind: 2
}
]
}
Differential Revision: http://reviews.llvm.org/D12084
llvm-svn: 245732
2015-08-21 20:28:30 +00:00
Rafael Espindola
d1fc658396
Don't iterate over all sections in the ELFFile constructor.
...
With this we finally have an ELFFile that is O(1) to construct. This is helpful
for programs like lld which have to do their own section walk.
llvm-svn: 244510
2015-08-10 21:29:35 +00:00
Rafael Espindola
e12302b7c2
Delete getDotSymtabSec.
...
Another step in avoiding iterating over all sections in the ELFFile constructor.
llvm-svn: 244496
2015-08-10 20:25:04 +00:00
Rafael Espindola
29d199aa4d
Use continue to reduce indentation. NFC.
...
llvm-svn: 244480
2015-08-10 18:57:42 +00:00
Rafael Espindola
088669ce42
Convert getSymbolSection to return an ErrorOr.
...
This function can actually fail since the symbol contains an index to the
section and that can be invalid.
llvm-svn: 244375
2015-08-07 23:27:14 +00:00
Rafael Espindola
731b9ea15f
Don't look for a SHT_DYNSYM in the ELFFile's constructor.
...
Yet another step in not having it scan every section.
llvm-svn: 244353
2015-08-07 20:11:08 +00:00
Rafael Espindola
246909bb95
Remove the symbol iteration functions that don't take a symbol table.
...
Another step in making ELFFile's constructor not iterate over all sections.
llvm-svn: 244351
2015-08-07 20:07:27 +00:00
Rafael Espindola
0d29f912e2
Add dynamic_table iterators back to ELF.h.
...
In tree they are only used by llvm-readobj, but it is also used by
https://github.com/mono/CppSharp .
While at it, add some missing error checking.
llvm-svn: 244320
2015-08-07 15:25:20 +00:00
Tom Stellard
f76ed1f361
ELF: Add AMDGPU specific defintions
...
Reviewers: rafael
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D11458
llvm-svn: 244303
2015-08-07 01:35:24 +00:00
Davide Italiano
19ff587956
[llvm-readobj] Convert to range-loops.
...
llvm-svn: 244300
2015-08-07 00:35:28 +00:00
Rafael Espindola
833df2a833
Move to llvm-readobj code that is only used there.
...
lld might end up using a small part of this, but it will be in a much
refactored form. For now this unblocks avoiding the full section scan in the
ELFFile constructor.
This also has a (very small) error handling improvement.
llvm-svn: 244282
2015-08-06 21:54:37 +00:00
Simon Atanasyan
0fb481e702
[Mips] Support DT_MIPS_RLD_MAP_REL dynamic section tag in the llvm-readobj
...
llvm-svn: 243833
2015-08-01 12:02:02 +00:00
David Majnemer
e5042e5d24
[COFF] Add IMAGE_SCN_TYPE_NOLOAD to SectionCharacteristics
...
llvm-svn: 243658
2015-07-30 16:47:56 +00:00
Davide Italiano
49b87c8eb7
[llvm-reaobj] Display COFF-specific sections/tables only if the object is COFF.
...
Just skip them otherwise.
llvm-svn: 243086
2015-07-24 02:14:20 +00:00
Rafael Espindola
6ee9519072
Support printing relocations in files with no section table.
...
llvm-svn: 242998
2015-07-23 09:11:05 +00:00
Rafael Espindola
61c30ffea6
Use typdef to simplify the code. NFC.
...
llvm-svn: 242995
2015-07-23 08:48:14 +00:00
Rafael Espindola
60b9bc96e6
Delete ELFEntityIterator. NFC.
...
llvm-svn: 242901
2015-07-22 14:09:20 +00:00
Rafael Espindola
824cff967b
Don't iterate over the program headers in the constructor of ELFFile.
...
Not every program needs this information.
In particular, it is necessary and sufficient for a static linker to scan the
section table.
llvm-svn: 242833
2015-07-21 20:50:53 +00:00
Rafael Espindola
d5c4dc8c4d
Make printValue a member function.
...
We were already passing 3 values it can get from ELFDumper.
llvm-svn: 242829
2015-07-21 19:57:43 +00:00
Rafael Espindola
af31ee4414
Remove always null argument.
...
llvm-svn: 242828
2015-07-21 19:38:32 +00:00
Rafael Espindola
baa0c22119
Replace the last uses of ELF::getSymbolName in llvm-readobj.
...
llvm-svn: 242798
2015-07-21 16:26:21 +00:00
Rafael Espindola
7c88e30437
Use helper function. NFC.
...
llvm-svn: 242795
2015-07-21 16:05:53 +00:00
Rafael Espindola
1a0b4be6e2
llvm-readobj: use the associated string table to print symbols. NFI.
...
This just removes some cases that require ELFFile to eagerly parse the ELF
file.
llvm-svn: 242794
2015-07-21 16:02:10 +00:00
Rafael Espindola
403561d674
Simplify printing the soname. NFC.
...
llvm-svn: 242786
2015-07-21 13:48:41 +00:00
Rafael Espindola
8232c9117b
Add missing c++ marker to .h file.
...
llvm-svn: 242784
2015-07-21 13:42:38 +00:00
Rafael Espindola
329a6aeab9
Remove duplicated code.
...
Both ELFObjectFile and ELFFile had an implementation of getLoadName.
llvm-svn: 242725
2015-07-20 22:41:44 +00:00
Rafael Espindola
0f258e6887
Simplify now that we can iterate backwards. NFC.
...
llvm-svn: 242715
2015-07-20 21:45:56 +00:00
Rafael Espindola
1c58b24a44
Remove Elf_Rela_Iter and Elf_Rel_Iter.
...
Use just the pointers and check for invalid relocation sections.
llvm-svn: 242700
2015-07-20 20:07:50 +00:00
Rafael Espindola
0fb99d1c9a
Simplify iterating over program headers and detect corrupt ones.
...
We now use a simple pointer and have range loops.
llvm-svn: 242669
2015-07-20 13:35:33 +00:00
Rafael Espindola
04bc262b8d
llvm-readobj: Handle invalid references to the string table.
...
llvm-svn: 242658
2015-07-20 03:38:17 +00:00
Rafael Espindola
7c36fd7751
llvm-readobj: call exit(1) on error.
...
llvm-readobj exists for testing llvm. We can safely stop the program
the first time we know the input in corrupted.
This is in preparation for making it handle a few more broken files.
llvm-svn: 242656
2015-07-20 03:23:55 +00:00
Rafael Espindola
7dddead5a9
Refactor duplicated code. NFC.
...
llvm-svn: 242655
2015-07-20 03:01:49 +00:00
Michael J. Spencer
bb17a74bbd
[Object][ELF] Support dumping hash-tables from files with no section table.
...
This time without breaking the bots.
llvm-svn: 241869
2015-07-09 22:32:24 +00:00
Simon Atanasyan
a847de6456
[llvm-readobj] Print MIPS PLT table
...
Now the -mips-plt-got prints both MIPS GOT and PLT tables.
llvm-svn: 241836
2015-07-09 18:23:10 +00:00
David Majnemer
aa29c6dcca
[llvm-readobj] Re-add sanity checking which was accidentally removed in r241764
...
llvm-svn: 241831
2015-07-09 18:14:31 +00:00
Justin Bogner
a395151a4b
llvm-readobj: Fix an unused variable after r241764
...
llvm-svn: 241783
2015-07-09 04:27:36 +00:00
Adrian Prantl
e71dc1d0ed
Temporarily reverting 241765, 241768, and 241772 to unbreak the build bots.
...
llvm-svn: 241781
2015-07-09 02:14:49 +00:00
Michael J. Spencer
b5535ebef9
[Object][ELF] Support dumping hash-tables from files with no section table.
...
llvm-svn: 241765
2015-07-09 00:21:06 +00:00
David Majnemer
7357b5b4b1
[CodeView] Add support for emitting column information
...
Column information is present in CodeView when the line table subsection
has bit 0 set to 1 in it's flags field. The column information is
represented as a pair of 16-bit quantities: a starting and ending
column. This information is present at the end of the chunk, after all
the line-PC pairs.
llvm-svn: 241764
2015-07-09 00:19:51 +00:00
Rafael Espindola
912c2c2a57
Simplify. NFC.
...
llvm-svn: 241458
2015-07-06 15:53:43 +00:00
Rafael Espindola
2c1a53aa22
Check that COFF .obj files have sections with zero virtual address spaces.
...
When talking about the virtual address of sections the coff spec says:
... for simplicity, compilers should set this to zero. Otherwise, it is an
arbitrary value that is subtracted from offsets during relocation.
We don't currently subtract it, so check that it is zero.
If some producer does create such files, we can change getRelocationOffset
instead.
llvm-svn: 241447
2015-07-06 14:26:07 +00:00
Rafael Espindola
06691d6e5a
Return ErrorOr from getSymbolAddress.
...
It can fail trying to get the section on ELF and COFF. This makes sure the
error is handled.
llvm-svn: 241366
2015-07-03 18:19:00 +00:00
Rafael Espindola
165a342cde
Return ErrorOr from SymbolRef::getName.
...
This function can really fail since the string table offset can be out of
bounds.
Using ErrorOr makes sure the error is checked.
Hopefully a lot of the boilerplate code in tools/* can go away once we have
a diagnostic manager in Object.
llvm-svn: 241297
2015-07-02 20:55:21 +00:00
Rafael Espindola
2aa69908b2
Return ErrorOr from getSection.
...
This also improves the logic of what is an error:
* getSection(uint_32): only return an error if the index is out of bounds. The
index 0 corresponds to a perfectly valid entry.
* getSection(Elf_Sym): Returns null for symbols that normally don't have
sections and error for out of bound indexes.
In many places this just moves the report_fatal_error up the stack, but those
can then be fixed in smaller patches.
llvm-svn: 241156
2015-07-01 12:56:27 +00:00
Rafael Espindola
f97ba343b7
Remove Elf_Shdr_Iter. Diagnose files with invalid section header sizes.
...
llvm-svn: 241109
2015-06-30 19:58:10 +00:00
Rafael Espindola
dda409a30b
Use range loops. NFC.
...
llvm-svn: 241105
2015-06-30 19:24:51 +00:00
Rafael Espindola
3a75bab05c
Use range loop.
...
llvm-svn: 241104
2015-06-30 19:13:25 +00:00
Rafael Espindola
e704554299
Use range loop.
...
llvm-svn: 241100
2015-06-30 19:02:00 +00:00
Rafael Espindola
479ebec42f
Fix the name of the iterator functions to match the coding standards.
...
llvm-svn: 241074
2015-06-30 15:33:44 +00:00
Rafael Espindola
5e574afd00
Don't return error_code from a function that doesn't fail.
...
llvm-svn: 241042
2015-06-30 04:08:37 +00:00