1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

105 Commits

Author SHA1 Message Date
Rafael Espindola
8ccd44da5c Create .symtab_shndxr only when needed.
We need .symtab_shndxr if and only if a symbol references a section with an
index >= 0xff00.

The old code was trying to figure out if the section was needed ahead of time,
making it a fairly dependent on the code actually writing the table. It was
also somewhat conservative and would create the section in cases where it was
not needed.

If I remember correctly, the old structure was there so that the sections were
created in the same order gas creates them. That was valuable when MC's support
for ELF was new and we tested with elf-dump.py.

This patch refactors the symbol table creation to another class and makes it
obvious that .symtab_shndxr is really only created when we are about to output
a reference to a section index >= 0xff00.

While here, also improve the tests to use macros. One file is one section
short of needing .symtab_shndxr, the second one has just the right number.

llvm-svn: 204769
2014-03-25 23:44:25 +00:00
Rafael Espindola
592a9a42e8 Teach llvm-readobj to print human friendly description of reserved sections.
llvm-svn: 204584
2014-03-24 05:00:34 +00:00
David Majnemer
4534e0a71a Object: Provide a richer means of describing auxiliary symbols
The current state of affairs has auxiliary symbols described as a big
bag of bytes. This is less than satisfying, it detracts from the YAML
file as being human readable.

Instead, allow for symbols to optionally contain their auxiliary data.
This allows us to have a much higher level way of describing things like
weak symbols, function definitions and section definitions.

This depends on D3105.

Differential Revision: http://llvm-reviews.chandlerc.com/D3092

llvm-svn: 204214
2014-03-19 04:47:47 +00:00
David Majnemer
7df7aea167 Object: Move auxiliary symbol definitions from llvm-readobj
Summary: These definitions are useful to other aspects of LLVM, move them out.

Reviewers: rafael, nrieck, ruiu

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3105

llvm-svn: 204213
2014-03-19 04:33:27 +00:00
Rui Ueyama
d98881f480 Object/COFF: Add function to check if section number is reserved one.
Differential Revision: http://llvm-reviews.chandlerc.com/D3103

llvm-svn: 204199
2014-03-18 23:37:53 +00:00
Alexey Samsonov
c29886ea05 [C++11] Change the interface of getCOFF{Section,Relocation,Symbol} to make it work with range-based for loops.
Reviewers: ruiu

Reviewed By: ruiu

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3097

llvm-svn: 204120
2014-03-18 06:53:02 +00:00
Alexey Samsonov
d507177bf9 [C++11] Introduce ObjectFile::symbols() to use range-based loops.
Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3081

llvm-svn: 204031
2014-03-17 07:28:19 +00:00
Nico Rieck
5564d1b271 llvm-readobj: Print referred symbol name for CLR token definition
llvm-svn: 204024
2014-03-17 01:46:52 +00:00
Nico Rieck
8fcb9744c7 llvm-readobj: Add test for COFF auxiliary symbols as used by C++/CLI
llvm-svn: 204023
2014-03-17 01:46:28 +00:00
Justin Bogner
b27be63011 Support: Make error_category's constructor public
Since our error_category is based on the std one, we should have the
same visibility for the constructor.  This also allows us to avoid
using the _do_message implementation detail in our own categories.

llvm-svn: 203998
2014-03-15 04:05:59 +00:00
Alexey Samsonov
c7665b69a6 [C++11] Introduce SectionRef::relocations() to use range-based loops
Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3077

llvm-svn: 203927
2014-03-14 14:22:49 +00:00
Alexey Samsonov
515a1ac9bb [C++11] Use ObjectFile::sections() in commandline llvm tools
llvm-svn: 203802
2014-03-13 14:37:36 +00:00
Saleem Abdulrasool
caaf63404a Object: rename ARMV7 to ARMNT
The official specifications state the name to be ARMNT (as per the Microsoft
Portable Executable and Common Object Format Specification v8.3).

llvm-svn: 203530
2014-03-11 03:08:37 +00:00
Craig Topper
76695802bd [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203345
2014-03-08 08:27:28 +00:00
Dmitri Gribenko
91b2000465 Add missing std:: qualifiers
llvm-svn: 203246
2014-03-07 14:55:30 +00:00
Rafael Espindola
c684da3709 Fix warning about mismatched signs in comparison.
llvm-svn: 203155
2014-03-06 20:16:24 +00:00
Rafael Espindola
51db912fc8 Fix the printing of n_type.
Despite the name, n_type contains the type of the symbol, but also if it is
extern or private extern.

llvm-svn: 203154
2014-03-06 20:13:41 +00:00
Rafael Espindola
e038798d55 Use the existing N_STAB from the MachO namespace.
llvm-svn: 203152
2014-03-06 19:58:56 +00:00
Ahmed Charles
52ce0c101e Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.

llvm-svn: 203083
2014-03-06 05:51:42 +00:00
Craig Topper
b0056a4ca7 Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
llvm-svn: 202621
2014-03-02 09:09:27 +00:00
Rafael Espindola
4abddc0b33 Change the begin and end methods in ObjectFile to match the style guide.
llvm-svn: 201108
2014-02-10 20:24:04 +00:00
Saleem Abdulrasool
e05d1e5d25 tools: cast the right operand
Properly apply the fix intended by SVN r201032.

llvm-svn: 201036
2014-02-09 03:13:07 +00:00
Saleem Abdulrasool
8b7368c793 tools: explicitly cast to avoid a warning
llvm-svn: 201032
2014-02-09 01:12:21 +00:00
Saleem Abdulrasool
cf3459a929 tools: handle out-of-line personality 0 decoding
In some cases it is possible to have a personality 0 unwinding opcodes in the
extab (such as when .handlerdata is used in the assembly).  Simply decode the 3
opcodes for that case.

llvm-svn: 201030
2014-02-08 23:17:08 +00:00
Saleem Abdulrasool
bb3d3fdcb2 tools: fix Twine abuse
utohexstr provides a temporary string, making it unsafe to use with the Twine
interface which will not copy the string.  Switch to using std::string.

llvm-svn: 200457
2014-01-30 06:19:27 +00:00
Saleem Abdulrasool
8c7875baee tools: remove unnecessary typename
This is acceptted by clang and gcc, but MSVC seems to balk at it.  As it is
unneeded, simply drop it.  Fixes MSVC buildbots.

llvm-svn: 200456
2014-01-30 06:19:24 +00:00
Saleem Abdulrasool
cfb7e2a038 tools: repair Windows build
exp2 is not available on Windows.  Fortunately, we are calculating powers of 2
with expontents within the range of [4,12].  Simply use an equivalent bitshift
operation to repair compilation with MSVC which does not provide this standard
function.

llvm-svn: 200454
2014-01-30 05:20:31 +00:00
Saleem Abdulrasool
b264887853 tools: add support for decoding ARM attributes
Enhance the ARM specific parsing support in llvm-readobj to support attributes.
This allows for simpler tests to validate encoding of the build attributes as
specified in the ARM ELF specification.

llvm-svn: 200450
2014-01-30 04:46:33 +00:00
Rafael Espindola
6148a226d5 Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In
retrospect, that is not too surprising: no object format stores symbols or
sections in a linked list or other structure that requires chasing pointers.
As a consequence, all error checking can be done on begin() and end().

This reduces the text segment of bin/llvm-readobj in my machine from 521233 to
518526 bytes.

llvm-svn: 200442
2014-01-30 02:49:50 +00:00
Rui Ueyama
f81e57de36 Rename IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA.
editbin.exe and link.exe both accepts /highentropyva option to set this bit, so
doing s/VIRTUAL_ADDRESS/VA/ should make sense.

llvm-svn: 200191
2014-01-27 04:22:24 +00:00
Rui Ueyama
3422ecd95a COFF: Add a missing enum value for high entropy ASLR.
That bit is not documented in the PE/COFF spec published by Microsoft, so we
don't know the official name of it. I named this bit
IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VIRTUAL_ADDRESS because the bit is
reported as "high entropy virtual address" by dumpbin.exe,

llvm-svn: 200121
2014-01-26 05:05:23 +00:00
Rui Ueyama
e1a4c7b4e3 llvm-readobj: add support for PE32+ (Windows 64 bit executable).
PE32+ supports 64 bit address space, but the file format remains 32 bit.
So its file format is pretty similar to PE32 (32 bit executable). The
differences compared to PE32 are (1) the lack of "BaseOfData" field and
(2) some of its data members are 64 bit.

In this patch, I added a new member function to get a PE32+ Header object to
COFFObjectFile class and made llvm-readobj to use it.

llvm-svn: 200117
2014-01-26 04:15:52 +00:00
Rafael Espindola
176488ad20 Rename these methods to match the style guide.
llvm-svn: 199751
2014-01-21 16:09:45 +00:00
Saleem Abdulrasool
cf1137c9ec tools: use 64-bit print specifier
Try to repair the ARM Cortex-A15 buildbot by using a more appropriate conversion
specifier.

llvm-svn: 199711
2014-01-21 04:31:29 +00:00
Saleem Abdulrasool
aae6a31cf3 tools: support decoding ARM EHABI opcodes in readobj
Add support to llvm-readobj to decode the actual opcodes.  The ARM EHABI opcodes
are a variable length instruction set that describe the operations required for
properly unwinding stack frames.

The primary motivation for this change is to ease the creation of tests for the
ARM EHABI object emission as well as the unwinding directive handling in the ARM
IAS.

Thanks to Logan Chien for an extra test case!

llvm-svn: 199708
2014-01-21 02:33:15 +00:00
Rafael Espindola
966babad9e Return an ErrorOr<Binary *> from createBinary.
I did write a version returning ErrorOr<OwningPtr<Binary> >, but it is too
cumbersome to use without std::move. I will keep the patch locally and submit
when we switch to c++11.

llvm-svn: 199326
2014-01-15 19:37:43 +00:00
Chandler Carruth
44c680cdaf [cleanup] Add a missing include exposed by resorting other includes.
Should fix the build.

llvm-svn: 199081
2014-01-13 08:09:47 +00:00
Chandler Carruth
03b6c941a3 Re-sort #include lines again, prior to moving headers around.
llvm-svn: 199080
2014-01-13 08:04:33 +00:00
Saleem Abdulrasool
1416d93593 llvm-readobj: address review comments for ARM EHABI printing
Rename bytecode to opcodes to make it more clear.  Change an impossible case to
llvm_unreachable instead.  Avoid allocation of a buffer by modifying the
PrintOpcodes iteration.

llvm-svn: 198848
2014-01-09 04:31:18 +00:00
Saleem Abdulrasool
a66068772d llvm-readobj: fix endianness
Explicitly handle endianness to ensure that bytes are read properly on
big-endian systems.

llvm-svn: 198847
2014-01-09 04:31:14 +00:00
Rafael Espindola
721b465b58 Use getError and remove the error_code operator.
llvm-svn: 198799
2014-01-08 22:03:39 +00:00
Saleem Abdulrasool
869aa34c78 llvm-readobj: add support for ARM EHABI unwind info
This adds some preliminary support for decoding ARM EHABI unwinding information.
The major functionality that remains from complete support is bytecode
translation.

Each Unwind Index Table is printed out as a separate entity along with its
section index, name, offset, and entries.

Each entry lists the function address, and if possible, the name, of the
function to which it corresponds.  The encoding model, personality routine or
index, and byte code is also listed.

llvm-svn: 198734
2014-01-08 03:28:09 +00:00
Simon Atanasyan
3f84b60665 [Mips] Add support for DT_MIPS_RLD_MAP and DT_MIPS_PLTGOT dynamic
section tags to the llvm-readobj.

llvm-svn: 198561
2014-01-05 13:40:27 +00:00
Timur Iskhodzhanov
3d72e1e9e4 Teach the llvm-readobj COFF dumper to dump debug line tables from object files
Reviewed at http://llvm-reviews.chandlerc.com/D2425

llvm-svn: 197674
2013-12-19 11:37:14 +00:00
NAKAMURA Takumi
955efe24ce [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.
llvm-svn: 196908
2013-12-10 11:13:32 +00:00
Simon Atanasyan
620a19c0b4 Add support for DT_VERxxx and DT_MIPS_xxx .dynamic section entries to the
llvm-readobj.

The patch reviewed by Michael Spencer.
http://llvm-reviews.chandlerc.com/D2113

llvm-svn: 194421
2013-11-11 20:51:48 +00:00
Simon Atanasyan
724835dff7 [Mips] Teach llvm-readobj to print MIPS-specific ELF program headers.
The patch reviewed by Michael Spencer.
http://llvm-reviews.chandlerc.com/D1846

llvm-svn: 192093
2013-10-07 08:58:27 +00:00
Rafael Espindola
a279462828 Remove several unused variables.
Patch by Alp Toker.

llvm-svn: 191757
2013-10-01 13:32:03 +00:00
Benjamin Kramer
e8d495c088 ELF: Add support for the exclude section bit for gas compat.
llvm-svn: 190769
2013-09-15 19:53:20 +00:00
Joerg Sonnenberger
930841271b Print string value for DT_RPATH and DT_RUNPATH.
llvm-svn: 189829
2013-09-03 17:13:53 +00:00